The difference between ls, ls -a, ls -A, ls -l, ls -al, ls -lrt

ls

linux ls command – Show files and directories that are not hidden.

➜  ls
ls

ls -a

linux ls -a command, display all files and subdirectories in the current directory, including hidden “.” And “..” etc.

  • ls -a Include directory entries whose names begin with a dot (.).
➜  ls -a
ls -a

ls -A

linux ls -A command, show all files and subdirectories in the current directory, including hidden files, but excluding . And ..

  • ls -A List all entries except for . and … Always set for the super-user.
➜  ls -A
ls -A

ls -l

linux ls -l command, display detailed information of non-hidden files and directories.

  • ls -l List in long format.
➜  ls -l
ls -l

ls -al

linux ls -al command, display all files and subdirectories in the current directory, including hidden “.” And “..” etc. details.

➜  ls -al

ls -lrt

linux ls -lrt command, sort non-hidden files and directories by date from old to new.

  • ls -r reverse the order
  • ls -t sort by time modified
➜  ls -lrt

Add a Comment

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