LS: Lists the files and subdirectories under the current directory.
1. Command format
ls [ options] [directory name]
2. Command function
view files and subdirectories in the current directory
3. Command parameters
- A: Lists all files and subdirectories (including hidden files) in the current directory
-A: Lists all files and subdirectories in the current directory (except ' current directory: use. To represent ' and ' parent directory: To represent all files outside of the
-L: Lists files and subdirectories with detailed information in the current directory
-H: Lists the files and subdirectories under the current directory for ' unit conversions ' (combined with-L)
-D: Lists the properties of the current directory (in conjunction with-L)
-I: Lists the inode for files and subdirectories in the current directory
-r: Displays the files and subdirectories in the current directory in reverse order
-R: Recursively displays files and subdirectories in the current directory
4. Command instances
Example 1: Viewing a file
[[email protected] ~]# ls
ABC ABCD anaconda-ks.cfg Desktop install.log Install.log.syslog
Example 2: View all Files
[Email protected] ~]# ls-a
. . bash_profile. gconf. KDE
.. . bashrc. gconfd. Local
ABC. CSHRC. Gnome2. Mcop
Abcd. Dcopserver_bogon__0. Gnome2_private. qt
Anaconda-ks.cfg. dcopserver_bogon_:0. Iceauthority. TCSHRC
. bash_history Desktop Install.log. xsession-errors
. bash_logout. DMRC Install.log.syslog
Example 3: View all Files (. and.. not shown)
[Email protected] ~]# ls-a
ABC. Bash_profile Desktop gnome2_private. Local
ABCD BASHRC. DMRC. Iceauthority. Mcop
Anaconda-ks.cfg. cshrc. gconf Install.log. qt
. bash_history. Dcopserver_bogon__0. GCONFD Install.log.syslog. TCSHRC
. Bash_logout. dcopserver_bogon_:0. Gnome2. KDE. xsession-errors
Example 4: View more information
[Email protected] ~]# ls-l
Total 72
Drwxr-xr-x 2 root root 4096 Dec 16:09 ABC
Drwxr-xr-x 3 root root 4096 Dec 16:02 ABCD
-RW-------1 root root 1259 Nov 19:18 anaconda-ks.cfg
drwx------2 root root 4096 Nov 19:25 Desktop
-rw-r--r--1 root root 39302 Nov 19:17 Install.log
-rw-r--r--1 root root 4062 Nov 19:17 install.log.syslog
Example 5: unit conversions
[Email protected] ~]# LS-LH
Total 72K
Drwxr-xr-x 2 root root 4.0K Dec 16:09 ABC
Drwxr-xr-x 3 root root 4.0K Dec 16:02 ABCD
-RW-------1 root root 1.3K Nov 19:18 anaconda-ks.cfg
drwx------2 root root 4.0K Nov 19:25 Desktop
-rw-r--r--1 root root 39K Nov 19:17 Install.log
-rw-r--r--1 root root 4.0K Nov 19:17 install.log.syslog
Example 6: Displaying the properties of itself
[Email protected] ~]# Ls-ld
Drwxr-x---root root 4096 Dec 21 16:09.
Example 7: Show Inode
[Email protected] ~]# ls-i
2709225 ABC 2709129 anaconda-ks.cfg 2709122 install.log
2709164 ABCD 2709163 Desktop 2709123 Install.log.syslog
Example 8: Reverse Display
[Email protected] ~]# Ls-r
Install.log.syslog install.log Desktop anaconda-ks.cfg ABCD ABC
Example 9: Recursive display
[Email protected] ~]# Ls-r
.:
ABC ABCD anaconda-ks.cfg Desktop install.log Install.log.syslog
./ABC:
./ABCD:
Abcd
./ABCD/ABCD:
./desktop:
Home.desktop System.desktop Trash.desktop
This article is from the "cold-blooded Killer" blog, please be sure to keep this source http://deathkiller.blog.51cto.com/9130248/1592293
LS for common commands of Linux