Linux系统操作离不开命令,基础命令更显得尤为重要,下面几个让我们来一一尝试
ls:列出当前目录的内容或指定目录
用法:ls [options] [files_or_dirs]
ls -a包含隐藏文件
ls -l显示额外的信息
ls -R目录递归通过
ls -ld目录和符号链接信息
ls -1 文件分行显示
ls �S 按从大到小排序
ls �u 配合-t选项,显示并按atime从新到旧排序
ls �U 不排序按目录存放顺序显示
ls -a 列出目录下的所有文件或目录包括隐藏文件
[root@localhost /]# ls -a
. bin etc lib64 opt run sys tmp
.. boot home media proc sbin test usr
.autorelabel dev lib mnt root srv testdir var
ls -R
[root@localhost /]# ls -R /home
/home:
mageedu shui xiaoshui
/home/mageedu:
/home/shui:
/home/xiaoshui:
text
/home/xiaoshui/text:
ls -1
[root@localhost /]# ls -1 /home/
mageedu
shui
xiaoshui
ls -S 按照所占内存从大到小进行排序
[root@localhost /]# ls -Sl /root
total 16
-rw------- 1 root root 5237 Jul 28 12:23 history.1
-rw-------. 1 root root 2633 Jul 25 20:42 anaconda-ks.cfg
-rw------- 1 root root 119 Jul 26 14:28 history_log
drwxr-xr-x 2 root root 6 Jul 27 15:11 test
drwxrwxr-x 2 xiaoshui xiaoshui 6 Jul 27 15:15 text
-rw-r--r-- 1 root root 0 Jul 26 17:32 1
-rw-r--r-- 1 root root 0 Jul 26 17:32 100
-rw-r--r-- 1 root root 0 Jul 26 17:32 12
ls -tu 按照atime(访问时间进行排序)
[root@localhost /]# ls -ltu /root
total 16
drwxr-xr-x 2 root root 6 Jul 28 20:03 test
drwxrwxr-x 2 xiaoshui xiaoshui 6 Jul 28 20:03 text
-rw------- 1 root root 5237 Jul 28 12:23 history.1
-rw-r--r-- 1 root root 0 Jul 27 09:13 1
-rw-r--r-- 1 root root 0 Jul 26 17:32 12
-rw-r--r-- 1 root root 0 Jul 26 17:32 100
-rw------- 1 root