English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Linux ls command

Linux Command大全

The Linux 'ls' command (English full spelling: list files) is used to display the contents of the specified working directory (lists the files and subdirectories contained in the current working directory).

Grammar

 ls [-alrtAFR] [name...]

Parameters :

  • -a Display all files and directories (. at the beginning of hidden files will also be listed)
  • -l In addition to the file name, also list detailed information such as file type, permissions, owner, and file size
  • -r Display files in reverse order (originally sorted by alphabetical order)
  • -t List files in the order of creation time
  • -A Same as -a , but do not list "." (current directory) and ".." (parent directory)
  • -", a symbol will be added after the file name in the list; for example, executable files will be added "*", directories should be added "/"
  • -R If there are files in the directory, the following files will also be listed in sequence:

Online Examples

List all directories under the root directory (/):

# ls /
bin               dev   lib         media  net   root     srv  upload  www
boot              etc   lib64       misc   opt   sbin     sys  usr
home  lost+found  mnt    proc  selinux  tmp  var

List all files in the current working directory that start with s, the newer ones are listed at the end :

ls -ltr s*

To /Detailed list of all directories and files below the bin directory :

ls -lR /bin

List all files and directories in the current working directory;/", executable files should be added "*" :

ls -AF

Linux Command大全