Warning: Trying to access array offset on value of type bool in /usr/home/razi3el/domains/endtech.eu/public_html/wp-content/plugins/elementor/includes/base/widget-base.php on line 223 Warning: Undefined array key -1 in /usr/home/razi3el/domains/endtech.eu/public_html/wp-content/plugins/elementor/includes/base/controls-stack.php on line 695

Blog

ls command

Linux ls command

Linux ls is a Linux shell command that displays the contents of file directories and directories.

Syntax of the ls command

ls [OPTION] [CATALOG]

ls command options

  • -l known as long format which displays detailed information about files and directories.
  • -A Represent all files Include hidden files and directories in the list.
  • -T Sort files and directories by their last modified time, displaying the most recently modified ones first.
  • -R known as reverse order which is used to reverse the default listing order.
  • -S Sort files and directories by size, listing the largest first.
  • -R Recursively list files and directories, including subdirectories.
  • -I known as inode, which displays the index number (inode) of each file and directory.
  • -G known as group, which displays the ownership of a group of files and directories instead of the owner.
  • -H Print file sizes in human-readable format (e.g. 1K, 234M, 2G).
  • -D Display only directories, not their contents.

View all file/directory information

ls -l

View the file size with the ls command

ls-lh

View directory information

ls -l /etc

View files based on last modified time

ls-lt

Displaying files based on the last modified time but in reverse order

ls -ltr

View hidden files in Linux

ls-a

View the UID and GID file

ls -n [CATALOG]

Display files with hidden control characters

ls -q
Scroll to Top