8 Regular files
In most operating systems (OSs), a “file” is a non-volatile entity that contains a contaguous stream of octets (bytes).
A “file” has to exist in a directory (aka folder), and a file must have a unique name with in the containing
directory.
There are many actions you can perform to a regular file. For example, you can create a file, query a file, copy a file,
rename a file, move a file or delete a file. In Linux, these are the commands to perform these operations in a command line
interface (CLI):
- touch test
This command touches the file test. If the file does not exist, a new file is created. If the file does exist, its
timestamp is updated.
- ls -l test
This command lists the file test with all the details.
- cp test test1
This command copies the file test to a new file test1.
- mv test test.bak
This command renames the file test to test.bak. The same command is also used to move a file from one
directory to another.
- rm test.bak
This command deletes the file test.bak.
- stat test.bak
This command reports all the important status of the file.