Hello, all the readers hope you are enjoying my blogs. In this blog, we start using Linux Shell Commands. we learn two Basic Shell Commands ( ls).

if you are using any type of Linux or any other distribution of Linux you are familiar with shell, and those who start using Linux newly this article is useful for those beginners. if you did not install any Linux Distribution yet so I highly suggest reading my How To Install Ubuntu On Machine blog. which I briefly guide you on how to install ubuntu.

Use of ‘ls’ Command In Linux

In this article we start using ‘ls Command’ and I also show you some screenshot of ls command that how they act with argument and without argument.

When you use ls without argument ls will show the directory content with alphabetical order. Like directory name starting with alphabet A, it will show you first.

Linux Shell Commands(Basic shell commands)
Basic Shell Command (ls) image

in this image, you see that blue color name and white color name now the day’s shell has some color formation. Like you see in the image all directory is in blue color and all your files are white color.there is an argument with you that you can see all your directory with forward-slash ( / ) and your files are shown without slash this is best before the shell is not coming with color formation.

Shell Command (ls -l)

Linux Shell Commands(Basic shell commands)
Linux Shell Command ls -l

In this image, you can see lots of information like file permission file owner file size last modified date with time and file name. now let’s talk briefly.

The first column shows about file permission that dash sign means its file, and d means its directory and l means that file has a link file also. like in the image you can see vtrgb file has link file in/etc/alternatives/vtrgb.

the second column show about link, the third column is about file owner and file-group fourth column shows file size but if you run ls -l it will show file size in kilobyte from if you want to see size in human-readable form like megabyte then add h argument.

you can pass different number arguments like you can type full command ls -lh it will show you file size in megabyte. The fifth column gives information about the modification time of the file and the last one is to give the file name.

ls -t and ls -r
first, we talk ls -t is used to see directory content last modification time as you can see in output which file are you modified last that file appears first.

ls -r is used to see directory content in reverse alphabet order.

Shell Command (ls -a)

 Difference Between ls and ls -a
Difference Between ls and ls -a

In the image you can see when I tun ‘ls -an’ it will show me all files even it will start with a dot, but when I run only ls it will not show any file or folder which starts with a dot.

ls -S is used to see large files in first it is so useful when you want to see which file is taking more space in system hard drive.

In Unix like operating system, everything is run on text file configuration that’s why Linux is so upgradeable operating system that anyone can customize for its own use that’s why Unix has file inode system. Each file has a unique integer number which is called inode number of file

Inode store every file information like file type, file permission, file size, file user id, and group id,

If you want to edit a file you type file name but Linux search that file with an inode number. so ls -l is used to see inode number of file or directory.

Reference: linuxcommand.org

1 thought on “Linux Shell Commands(Basic shell commands)”

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top