Today Xiaobian wants to introduce you to the ls command in the Linux command. The ls command can be said to be one of the most commonly used commands for listing files in the directory. The following is a detailed introduction to the ls command. usage.
ls command is a list of abbreviations, a list of default ls used to print out the current directory, if ls specify a different directory, it will display the specified directory list of files and folders. The ls command can not only view the files contained in the linux folder, but also view file permissions (including directories, folders, file permissions), view directory information, and so on. The ls command is used in many daily Linux operations!
1. Command format:
ls [options] [directory name]
2. Command function:
List all the children in the target directory Directory and files.
3. Common parameters:
-a, –all List all files in the directory, including with . Implied files at the beginning
-A Same as -a, but not listed. ” (indicating the current directory) and “. . ” (represents the parent directory of the current directory).
-c mate-lt: sort and display ctime according to ctime (time when file status was last changed) -l: display ctime but sort by name otherwise: sort according to ctime
-C Columns list items from top to bottom
–color[=WHEN] Controls whether color resolution files are used. WHEN can be ‘never’,‘always’or‘auto’one of them
-d, –directory to display the directory as a file instead of displaying the file under it.
-D, –dired Produces results for use in dired mode for Emacs
-f Does not sort output files, -aU option takes effect, -lst option fails
-g is similar to -l, but does not list owner
-G, –no-group does not list any information about groups
-h, –human-readable List file sizes in an easy-to-understand format (eg 1K 234M 2G)
–si is similar to -h, but the file size takes the power of 1000 instead of 1024
-H, – Dereference-command-line uses the symbolic link in the command line to indicate the true destination
–indicator-style= mode to specify the indicator "method" after each item name: none (default), Classify (-F),file-type (-p)
-i, –inode Print out the inode number of each file
-I, –ignore=style not printed Any project that conforms to the shell universal character "Style"
-k ie –block-size=1K, representing the file as k bytes Size.
-l In addition to the file name, the file permissions, owner, file size and other information are listed in detail.
-L, –dereference When displaying symbolic link file information, displaying the object indicated by the symbolic link instead of the symbolic link itself
-m All items are separated by commas, and Fill the entire line width
-o Similar to -l, showing the details of the file except the group information.
-r, –reverse Arrange in reverse order
-R, –recursive List all subdirectory layers at the same time
-s, –size in block size List the size of all files for the unit
-S Sort by file size
–sort=WORD The following are the optional WORDs and the corresponding options they represent:
Extension -X status -c
none -U time -t
size -S atime -u
time -t access -u
version - v use -u
-t Sort by file modification time
-u Matching -lt: Display access time and sort by access time
Matching -l: Displaying access time But sort by name
Otherwise: sort by access time
-U not sort; list items according to the original order of the file system
-v sort by version
-w, –width=COLS Specify the screen width yourself instead of the current value
-x List items line by line instead of column by column
-X Sort by extension
-1 List only one file per line
–help Display this help and leave
–version Display version information and leave
4. Common examples:
Example 1: List the details of all files and directories under the /home/peidachang folder
Command: ls -l -R /home /peidachang
Pay attention to the format of the command when using the ls command: after the command prompt, the first is the keyword of the command, then the command parameter, there must be a dash before the command parameter. ”, all command parameters have a specific role, you can choose one or more parameters as needed, after the command parameters is the command operation object. In the above command "ls -l -R /home/peidachang", "ls" is the command keyword, "ld-r-r" is the parameter, “ /home/peidachang” is the operation object of the command . In this command, two parameters are used, respectively, “l” and "R”, of course, you can also put them together, as shown below:
Command: ls - lR /home/peidachang
This form is exactly the same as the command form above. In addition, if the operation object of the command is located in the current directory, you can directly operate the operation object; if it is not in the current directory, you need to give the full path of the operation object. For example, in the above example, my current folder is the peidachang folder. I want to operate on the Peidachang file in the home folder. I can directly enter ls -lR peidachang or ls -lR /home/peidachang.
Previous12Next Total 2 Pages
vim is a text editor, can be used in Linux systems, for the use of Linux commands can refer to the s
IPv6 and IPv4 belong to the same network protocol. In Linux systems, when IPv6 and
Usually the system has its own firewall, the existence of the firewall to ensure th
In the KDE desktop environment of Ubuntu system, many users will encounter flashbac
How to back up and restore Linux file permissions
Linux beginners need to learn the summary of commands
How to install the iotop command on a Linux system
How to encrypt emails under Linux?
Ubuntu wireless network card search can not find a solution
How to quickly clear Linux file content
Summary of zypper command usage in SUSE Linux system
How to use vim to set up network on CentOS
Ubuntu 14.04 install java method
Annoying tips to remove the security center under Vista
Windows XP how to cancel the D disk auto play
Let xp easily have the win7 taskbar's small coup
Win10 Mobile Build 10080 upgrade channel is about to close
Integrated copy and move in the Windows 7 right-click menu
Win10 will use the split screen function to increase the work efficiency by
Prerequisite: Windows Fancy Shutdown
How to enable Windows 8 system sleep mode
Solve the mouse tail method of Win7 system
Win10 Tip: How do I determine if my computer is suitable for Hyper-V virtual machines?