ls: List directory contents (the default is the current working directory)
Format: command [options] [parameters]
Options:
-a: List all files and directories (including hidden files and directories)
-l: List in long format
-d: List only the directory itself
-h: Used with the -l option to display the file size in a friendly way (if -h is not added, the default file size is displayed in bytes);
Example:
[root@uni test]# ls
dir file file1
[root@uni test]# ls -l
Total usage 10248
drwxr-xr-x 2 root root 4096 July 16 15:30 dir
-rw-r--r-- 1 root root 7 July 16 15:30 file
-rw-r-- r-- 1 root root 10485760 July 16 15:32 file1
[root@uni test]# ls -lh
Total usage 11M
drwxr-xr-x 2 root root 4.0K July 16 15:30 dir
-rw-r--r-- 1 root root 7 July 16 15:30 file
-rw-r--r-- 1 root root 10M July 16 15:32 file1
[root@uni test]# ls -alh
Total usage 11M
drwxr-xr-x 3 root root 4.0K July 16 15:32 .
drwxr-xr-x. 3 root root 4.0K July 16 14:04 ..
drwxr-xr-x 2 root root 4.0K July 16 15:30 dir
-rw-r- -r-- 1 root root 7 July 16 15:30 file
-rw-r--r-- 1 root root 10M July 16 15:32 file1
[root@uni test] #ls -ldh
drwxr-xr-x 3 root root 4.0K July 16 15:32 .
The above is the detailed content of Simple operation under LINUX system--View file and directory attributes. For more information, please follow other related articles on the PHP Chinese website!