Basic #Linux_Commands
1. Command: ls
The command “ls” stands for (List Directory Contents), List the contents of the folder, be it file or folder, from which it runs.The command “ls -l” list the content of folder, in long listing fashion.
Command “ls -a“, list the content of folder,including hidden files starting with ‘.’.]
Note: In Linux file name starting with ‘.‘ is hidden. In Linux every file/folder/device/command is a file. The output of ls -l is:
- d (stands for directory).
- rwxr-xr-x is the file permission of the file/folder for owner, group and world.
- The 1st ravisaive in the above example means that file is owned by user ravisaive.
- The 2nd ravisaive in the above example means file belongs to user group ravisaive.
- 4096 means file size is 4096 Bytes.
- May 8 01:06 is the date and time of last modification.
- And at the end is the name of the File/Folder.
List Files with Human Readable Format with option -lh
With combination of -lh option, shows sizes in human readable format.List Files and Directories with ‘/’ Character at the end
Using -F option with ls command, will add the ‘/’ Character at the end each directory.
&&
List Files in Reverse Order
The following command with ls -r && -R option display files and directories in reverse order.Reverse Output Order
With combination of -ltr will shows latest modification file or directory date as last.
&& Sort Files by File Size
With combination of -lS displays file size in order, will display big in size first.Display Inode number of File or Directory
We can see some number printed before file / directory name. With -i options list file / directory with inode number.
&& Shows version of ls command
Check version of ls command.
&& Show Help Page
List help page of ls command with their option.&&
List Directory Information
With ls -l command list files under directory /tmp. Wherein with -ld parameters displays information of /tmp directory.&&
Display UID and GID of Files
To display UID and GID of files and directories. use option -n with ls command.&& ls command and it’s Aliases
We have made alias for ls command, when we execute ls command it’ll take -l option by default and display long listing as mentioned earlier.To remove an alias previously defined, just use the unalias command.