banner



What Do Differnt Colors Mean In Terminal

In Linux everything present is considered as a file, so to differentiate file types from each other for amend visibility to user, Linux has specific colour codes for the unlike file types.

Below, we will try to create some of the files and know its colors.

                      $ mkdir linux-colour-coding                  

White Color – Indicates regular files. so it can exist text file, word document or pdf document etc. Lets create simple text file as,

          $ repeat "hello text file" > textfile.txt        

All the normal files created / present, by default has the permission gear up to "664"

          $ ls -alh -rw-rw-r-- one myuser myuser   16 Aug 23 07:43 textfile.txt        

Bright Dark-green – Indicates file which are executable. All the executable files in Linux has "x" i.east. executable permissions set, which makes the permissions as "775"
Lets create one simple C program and compile it to generate executable as,

                      $ vim helloworld.c                  
          #include <stdio.h> int chief(int argc, char **argv) {         printf("how-do-you-do globe\n");         return 0; }        


Compile to generate executable file equally,

                      $ gcc -o helloworld_exe helloworld.c                  

We can bank check the default permissions ready by to a higher place compilation for executable "helloworld_exe" is "775" as,

          $ ls -alh -rw-rw-r-- ane myuser myuser   92 Aug 23 07:52 helloworld.c -rwxrwxr-x ane myuser myuser seven.2K Aug 23 07:52 helloworld_exe        

Blue – Indicates its a directory. Default permissions of the newly created directory is 775

                      $ mkdir directory_name                  
          $ ls -alh drwxrwxr-ten 2 myuser myuser iv.0K Aug 23 09:36 directory_name        

Yellow – Indicates its a device file. Most of the device files created past Linux kernel resides in /dev . Below is an case of device file which will exist displayed in yellow color.

          $ ls -al /dev/console  crw------- 1 root root 5, one Aug 23 09:25 /dev/panel                  

Cyan / light-green-bluish – Indicates its a softlink to another file. We tin can create a softlink to our previously created executable as,

                      $ ln -sf helloworld_exe helloworld_softlink                  
                      $ ls -alh   -rwxrwxr-x 1 myuser myuser seven.2K Aug 23 09:59 helloworld_exe lrwxrwxrwx ane myuser myuser 14 Aug 23 10:00 helloworld_softlink -> helloworld_exe        

Red with low-cal black groundwork – Indicates its a cleaved softlink. Means, the file where the link was pointing has been deleted.
We will endeavour to create a broken softlink as,

                      $ gcc -o helloworld_exe1 helloworld.c $ ln -sf helloworld_exe1 helloworld_softlink_broken $ rm -rf helloworld_exe1 $ ls -alh lrwxrwxrwx ane myuser myuser   15 Aug 23 x:05 helloworld_softlink_broken -> helloworld_exe1        

Here, helloworld_exe1 nosotros purposefully deleted to create broken softlink.

Magneta ( a light mauvish-reddish colour ) Indicates it is a "Paradigm" or "Video" file depending on the extension of file.

          $ ls -alh -rw-rw-r-- ane myuser myuser  93K Aug 23 10:11 mypicture.jpg                  


Red – Indicates its archive / compressed file.

We volition create a uncomplicated zip with the existing files as,

          $ zip -r hi.zippo helloworld.c helloworld_exe    calculation: helloworld.c (deflated 3%)   adding: helloworld_exe (deflated 68%)   $ ls -alh -rw-rw-r-- one myuser myuser 2.8K Aug 23 10:18 hullo.zip -rw-rw-r-- one myuser myuser  93K Aug 23 10:11 mypicture.jpg  $ file hello.zilch  hullo.cypher: Zip archive data, at least v2.0 to extract        

So finally this will Look Like below,

What Do Differnt Colors Mean In Terminal,

Source: https://lynxbee.com/meaning-of-different-colors-in-ls-command/

Posted by: luongofolls1990.blogspot.com

0 Response to "What Do Differnt Colors Mean In Terminal"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel