Linux system management and maintenance -ls command

  

1. The function description displays the contents of the specified working directory and lists the files and subdirectories contained in the working directory. This command is similar to dir under Windows
. In addition, Linux also provides the dir command, users can also use the dir command instead of the ls command. The syntax of ls is as follows: ls [options] [path or file] ls options are described in Table 4.1. Table 4.1 Options for ls and their meanings

Option Meaning-a Display all files and subdirectories under the specified directory, including hidden files (the files or directories at the beginning of “.” under Linux are considered as hidden documents) ) -d only displays the directory list, does not display the file -l In addition to the file name, the file, subdirectory permissions, user and size information are listed in detail -s output the file size after each file name - k Represents the size of the file in k-bytes -u sorted by the time the file was last accessed -t sorted by time -o displays details other than group information -x is output by column, horizontally sorted -r against directory To sort -q with ? instead of non-exportable characters -m horizontal output file name, and with “,” as a separator -S sort by file size -R list all subdirectories of files -pF in each A character is appended to the file name to indicate the type of the file. “*” indicates executable ordinary files, “/” indicates directory, “@” indicates symbolic links, “| ” indicates FIFOs, “=” indicates sockets -C is output by column, vertical sort -R lists files in all subdirectories -Q encloses the output file name in double quotes

2. For example, list the files in the /home directory and their subdirectories. # ls -l /home-rw-r--r-- 1 root root 0 Jul 7 22:39 db2drwx------ 3 mysql mysql 4096 Oct 10 2007 mysqldrwx------ 3 oracle oracle 4096 Oct 16 2007 oracle shows the details of all files and their subdirectories under /home/oracle, and displays the file type tags. # ls -alFtotal 56drwx------ 4 oracle oracle 4096 Jul 7 22:43 ./drwxr-xr-x 4 root root 4096 Jul 7 22:39 ../-rw------- 1 oracle Oracle 238 Dec 20 2007 .bash_history-rw-r--r-- 1 oracle oracle 304 Oct 16 2007 .bash_logout-rw-r--r-- 1 oracle oracle 191 Oct 16 2007 .bash_profile-rw-r--r -- 1 oracle oracle 124 Oct 16 2007 .bashrc-rw-r--r-- 1 oracle oracle 383 Oct 16 2007 .emacs-rw-r--r-- 1 oracle oracle 120 Oct 16 2007 .gtkrcdrwxr-xr- x 3 oracle oracle 4096 Oct 16 2007 .kde/drwxr-xr-x 2 root root 4096 Jul 7 22:41 .linux/lrwxrwxrwx 1 root root 10 Jul 7 22:43 mount -> /bin/mount*-rwxr- Xr-x 1 root root 4283 Jul 7 22:42 nfs*-rw-r--r-- 1 oracle oracle 22 Oct 16 2007 .rhosts

Copyright © Windows knowledge All Rights Reserved