文本排序及统计
- ls列表顺序
默认按字母升序排列
-S:按文档大小降序排列
-t:按文档的修改时间降序排列-
-r :反序排列
[root@localhost test]
-rw-r--r-- 1 root root 334 9月 26 14:18 demo14.sh
-rw-r--r-- 1 root root 183 9月 26 14:42 demo15.sh
-rw-r--r-- 1 root root 176 9月 26 10:12 demo10.sh
[root@localhost test]
-rw-r--r-- 1 root root 26 9月 24 15:04 demo2.sh
-rw-r--r-- 1 root root 33 9月 24 16:05 demo5.sh
-rw-r--r-- 1 root root 43 9月 24 15:27 demo3.sh
[root@localhost test]
-rw-r--r-- 1 root root 88 9月 26 15:09 demo19.sh
-rw-r--r-- 1 root root 137 9月 26 15:00 demo18.sh
-rw-r--r-- 1 root root 61 9月 26 14:49 demo17.sh
- uniq
用法1: uniq文件 ; 用法2∶命令| uniq
uniq -c 统计重复次数 - sort
基本用法
用法1 : sort文件 ;
用法2∶命令│ sort常用命令选项
-u︰去除重复行
-n :按数字顺序升序排列- -r∶反向排序
-k :优先对第几列的内容排序
//按内存使用量排序
[root@localhost test]
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 2036 0.0 15.5 1118636 285468 ? Ssl 9月24 1:34 /usr/libexec/packagekitd
root 2406 0.3 7.8 4224268 143232 tty2 Sl+ 9月24 13:58 /usr/bin/gnome-shell
root 16418 0.0 6.9 3095244 127472 tty2 Sl+ 9月24 3:11 /usr/lib64/firefox/firefox
root 2758 0.0 3.5 1180632 65680 tty2 Sl+ 9月24 0:16 /usr/bin/gnome-software --gapplication-service