In Linux, most things are done by working with files. And to organize these files, Linux has what are called directories or folders, which are set up like a tree. But these directories are also files in their own right. There are 3 kinds of files in Linux:
Regular Files:
In Linux, it is the most common type of file. It has files like text files, image files, binary files, and so on. The touch (Note: click here to learn more about touch command) command can be used to make these kinds of files. Most of the files in the Linux/UNIX system are part of them. The regular file has ASCII or human-readable text, program binaries that can be run, program data, and a lot more.
Directories:
These directories are known as folders in Windows. The list of file names and the pertinent data are kept in these files. The root directory (/) serves as the system’s foundation; other important directories are /bin for essential user binaries, /boot for static boot files, and /home for user home directories (Note: click here to learn more about directories). The mkdir (Note: click here to learn more about mkdir command) command allow us to create new folders.
Special Files:
Special files represents a real physical device that is used for I/O operations, like a printer. On UNIX and Linux systems, device I/O is done with devices or special files. You can find them in a file system just like any other file or directory.
File Listings
The “-l” option provides more details about the files displayed by the “ls” program.
ls -l
Detailed descriptions of each column given below:
Column | Details |
---|---|
1st | Identifies the kind of file and any associated permissions. Here “d” indicates directory and directory file lists files and folders. |
2nd | Identifies the number of memory blocks consumed by the file or directory. |
3rd | Identifies the file’s creator or owner. |
4th | Identifies the group of the owner. |
5th | Identifies the file size in bytes. |
6th | Identifies the time and date of the last time a file was created or edited. |
7th | Identifies the file or the directory name. |
Hidden Files
- Use the following command to list all the hidden files in the system:
ls -a
Here,
- Single dot (.) : Identifies the current directory.
- Double dot (..) : Identifies the parent directory.
Create, Copy, Move, Delete, Contents
To learn how to create, copy, move, delete and see the contents of a file click here.