[root@wang /]# sort 排序^C [root@wang /]# sort /etc/passwd adm:x:3:4:adm:/var/adm:/sbin/nologin bin:x:1:1:bin:/bin:/sbin/nologin daemon:x:2:2:daemon:/sbin:/sbin/nologin dbus:x:81:81:System message bus:/:/sbin/nologin ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin games:x:12:100:games:/usr/games:/sbin/nologin gopher:x:13:30:gopher:/var/gopher:/sbin/nologin haldaemon:x:68:68:HAL daemon:/:/sbin/nologin halt:x:7:0:halt:/sbin:/sbin/halt lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin mail:x:8:12:mail:/var/spool/mail:/sbin/nologin nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin nobody:x:99:99:Nobody:/:/sbin/nologin operator:x:11:0:operator:/root:/sbin/nologin postfix:x:89:89::/var/spool/postfix:/sbin/nologin root:x:0:0:root:/root:/bin/bash rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin rpc:x:32:32:Rpcbind Daemon:/var/cache/rpcbind:/sbin/nologin saslauth:x:499:76:"Saslauthd user":/var/empty/saslauth:/sbin/nologin shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin sync:x:5:0:sync:/sbin:/bin/sync uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin vcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologin wanghaipeng:x:501:502::/home/wanghaipeng:/bin/bash whp:x:500:501::/home/whp:/bin/bash [root@wang /]# sort -t: -k3 /etc/passwd root:x:0:0:root:/root:/bin/bash uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin operator:x:11:0:operator:/root:/sbin/nologin bin:x:1:1:bin:/bin:/sbin/nologin games:x:12:100:games:/usr/games:/sbin/nologin gopher:x:13:30:gopher:/var/gopher:/sbin/nologin ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin daemon:x:2:2:daemon:/sbin:/sbin/nologin rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin rpc:x:32:32:Rpcbind Daemon:/var/cache/rpcbind:/sbin/nologin adm:x:3:4:adm:/var/adm:/sbin/nologin lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin saslauth:x:499:76:"Saslauthd user":/var/empty/saslauth:/sbin/nologin whp:x:500:501::/home/whp:/bin/bash wanghaipeng:x:501:502::/home/wanghaipeng:/bin/bash sync:x:5:0:sync:/sbin:/bin/sync shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin haldaemon:x:68:68:HAL daemon:/:/sbin/nologin vcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologin halt:x:7:0:halt:/sbin:/sbin/halt sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin mail:x:8:12:mail:/var/spool/mail:/sbin/nologin dbus:x:81:81:System message bus:/:/sbin/nologin postfix:x:89:89::/var/spool/postfix:/sbin/nologin nobody:x:99:99:Nobody:/:/sbin/nologin [root@wang /]# sort -t: -k3 /etc/passwd 段排序 冒号分割 第三段^C [root@wang /]# sort -t: -k3,5 -n /etc/passwd 区间排序^C [root@wang /]# sort -t: -k3 -n -r /etc/passwd 倒序^C [root@wang /]# touch 2.txt [root@wang /]# vim 2.txt [root@wang /]# sort 2.txt 1 2 3 4 5 6 a dsf sdfsf [root@wang /]# sort -n -r 2.txt 6 5 4 3 2 1 sdfsf dsf a [root@wang /]# sort -u 2.txt ^C [root@wang /]# sort -u 2.txt ^C sort: 获取文件状态失败(stat): ^C: 没有那个文件或目录 [root@wang /]# sort -u 2.txt 排序 去重复^C [root@wang /]# vim 2.txt [root@wang /]# sort -un 2.txt sdfsf 1 2 3 4 5 6 [root@wang /]# cat 2.txt 1 2 3 4 5 6 sdfsf a dsf 1 2 3 a sd [root@wang /]#