Understanding the different file types in Linux

, , No Comments
Ever wondered why you see different colors when you do ls in linux?
In this post I'll show you what each color stands for. 

In the screenshot below, I did ls -l which will show extra details - file type, file permission, file owner, owner's group, date of creation/modification and file name.
'Cos I did this on my android phone which runs a stripped version of Bash shell, the colors aren't showing. If you do this on a Linux PC, the file names will be colored differently.

Linux has 6 file types, and everything in Linux is referred to as a file - directories/folders, devices, even system processes.
•Ordinary files: These are regular files. (white/black)
•Directories: These are files that contains other files and directories, and provide pointers to them. (blue)
•Symbolic links: These special files link to another file, in a different location. (Cyan)
•Block and character device files: All physical devices in Linux are represented by device files. e.g. /dev/sda (yellow)
•Socket file: Provides protected inter-process networking. (Purple)
•Named Pipe file: Like socket files but doesn’t use network socket semantics. (Red)
•$ ls –l indicates all these types
– -rw-r--r--   ordinary file
–brw-rw----   block device file
–crw-rw-rw-  character device file
–drwxr-xr-x  directory file
–lrwxrwxrwx  symbolic file
–srw-rw-rw-  socket file
–prw-rw-rw-  named pipe file


Post a Comment

You can be sure of a response, a very relevant one too!

Click on Subscribe by Email just down below the comment box so you'll be notified of my response.