list command in unix : ls
ls
It will show the full list or content of your directory
ls -a
In Linux/Unix, hidden files start with . (dot) symbol and they are not visible in the regular directory. The (ls -a) command will enlist the whole list of the current directory including the hidden files.
ls -l
It will show the list in a long list format.
Column 1 : indicates information regarding file permission.
Column 2 : indicates the number of links to the file.
Column 3 & 4 : indicates the owner and group information.
Column 5 : indicates the file size in bytes.
Column 6 : shows the date and time on which the file was recently modified.
Column 7 : shows the file or directory name.
ls ~
ls ~ command shows the contents of the home directory
ls -g
If we don't want to display the owner information in your list, then we can exclude this column with the help of this command.
ls -lrt
The ls command is used for listing the contents of a directory. The lrt
part is a combination of three different options:
- l: This is for the long listing of the contents. It shows one file in each line with additional info such as permissions, ownership, size, timestamps etc.
- t: This one sorts the long listing output based on time.
- r: This one reverses the order of ls command output.
ls -n
It is used to print group ID and owner ID instead of their names.
ls -li
This command prints the index number if file is in the first column.
ls -p
It is used to identify the directory easily by marking the directories with a slash (/) line sign.
ls --version
It checks the version of ls command.