Linux Filesystem colour codes

When we fire ls –all in linux cli, files may be listed in different colours  

The color code of the files is as follows:

Blue: Directory file

White: Normal file

Green: Executable file

Yellow: Device file

Magenta: Picture file

Cyan: link file

Red: Compressed file

File Symbol

-(Hyphen) = Normal file

d=directory

l=link file

b=Block device file

c=character device file
Advertisements

About amalgjose
I am an Electrical Engineer by qualification, now I am working as a Software Engineer. I am very much interested in Electrical, Electronics, Mechanical and now in Software fields. I like exploring things in these fields. I like travelling, long drives and very much addicted to music.

5 Responses to Linux Filesystem colour codes

  1. Jonathan says:

    Looking at the htdocs directory on Ubuntu, I see most html files are green and some are white. A couple of these html files are identical, so why are they marked differently?

  2. amalgjose says:

    Hi Jonathan, The reason is that, the green files will have execute permission also. Issue the command ‘ls -all’ to see the file permissions. The white files may not have execute permission. You can try it simply by creating a sample file and checking the permissions & colour. Then give u+x permission and again check the colour.

    • Jonathan says:

      Yes, you are right. I wonder how this would happen?

      I develop these files using the same IDE, and publish them to the web server in the same manner using rsync. They are in the same directory. Yet, most have x perm applied, but just a couple do not have x perm applied.

      Thanks for clarifying ‘how’ the colors are determined.

      • Jonathan says:

        I think I figured out why some files have different perms. I previously used Netbeans and Eclipse for PHP editor. I recently started using PHPStorm. The most recent files that were created with PHPStorm do NOT have x perms, but the previously created files by Netbeans and Eclipse do have x perms.

        Why on earth would those other IDE’s apply x perms on new html files is beyond me…but I’m glad I know the story now.

  3. Jonathan says:

    I probably shouldn’t make that assumption quite yet. Another factor I didn’t think of is, I initially uploaded these files using WinSCP. I might have had the initial upload perm configured incorrectly…? Since moving fully to Ubuntu for my dev box, I started using rsync. This very well could be the reason new files do not have x perms, but old files do. I don’t know, and don’t care at this point. Just wanted to add to my comment so I don’t lead someone to believe it was a problem with the IDE’s referenced.

    Thanks again!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: