Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
The bash shell provides lots of commands for manipulating files on the Linux filesystem. This section walks you through the basic commands you will need to work with files from the CLI for all your file-handling needs.
Creating Files
Every once in a while you will run into a situation where you need to create an empty file. Sometimes applications expect a log file to be present before they can write to it. In these situations, you can use the touch command to easily create an empty file:
$ touch test1
$ ls -il test1
1954793 -rw-r--r-- 1 rich rich 0 Sep 1 09:35 test1
$
The touch command creates the new file you specify and assigns your username as the file owner. Because the -il parameter was used for the ls command, the first entry in the listing shows the inode number assigned to the file. Every file on a Linux filesystem has a unique inode number.