2.2 List and create empty files:ls, touch
To know what documents are located in our current folder, we can type “ls” to list the content. “ls” has many flags that help expand or specify the type of information you’re looking for. If we want to know the most common flags we can type “ls –help”. For example “ls -l” will print the content in a long list format:
Sometimes we would like to create empty files for certain purpose. This can be done with the command “touch” follow by a file name or list of file names (you can type as many file names as you want separated by a space):
touch fileA.txt
ls
#fileA.txt subdir
touch fileB.txt fileC.txt
ls
#fileA.txt fileB.txt fileC.txt subdir
cd subdir
touch fileD.txt
ls
#fileD.txt
cd ..Another cool function of “ls” is that we can list specific content by typing “ls” follow by the files or documents we want to look at.
In the example above, * and [] are regular expressions used to represent any character or a list of specific one., In our case we are asking for any file that contains the suffix .txt or the prefix fileA or fileB (you will learn more about it later).