产品服务AMH 免费服务器主机面板SSL证书 免费SSL证书申请编程助手免费智能写代码、翻译NewAMYSQL 免费MySQL管理工具AMFTP 免费FTP管理客户端

AMH 社区首页

 AMH社区 - 开放自由有价值的社区

[综合话题] Linux命令整理第二部分

linmi
铝牌会员
222.42 价值分

linmi 发表于 2017-08-24 13:14:21
9. sort

以升序对文件内容排序

$ sort names.txt
以降序对文件内容排序

$ sort -r names.txt
以第三个字段对/etc/passwd的内容排序

$ sort -t: -k 3n /etc/passwd | more
10. export

输出跟字符串oracle匹配的环境变量

$ export | grep ORCALE
declare -x ORACLE_BASE="/u01/app/oracle"
declare -x ORACLE_HOME="/u01/app/oracle/product/10.2.0"
declare -x ORACLE_SID="med"
declare -x ORACLE_TERM="xterm"
设置全局环境变量

$ export ORACLE_HOME=/u01/app/oracle/product/10.2.0
11. xargs

将所有图片文件拷贝到外部驱动器

$ ls *.jpg | xargs -n1 -i cp {} /external-hard-drive/directory
将系统中所有jpd文件压缩打包

$ find / -name *.jpg -type f -print | xargs tar -cvzf images.tar.gz
下载文件中列出的所有url对应的页面

$ cat url-list.txt | xargs wget –c
12. ls

以易读的方式显示文件大小(显示为MB,GB...)

$ ls -lh
-rw-r----- 1 ramesh team-dev 8.9M Jun 12 15:27 arch-linux.txt.gz
以最后修改时间升序列出文件

$ ls -ltr
在文件名后面显示文件类型

$ ls -F
更多示例:Unix LS Command: 15 Practical Examples

13. pwd

输出当前工作目录

14. cd

cd -可以在最近工作的两个目录间切换
使用shopt -s cdspell可以设置自动对cd命令进行拼写检查

更多示例:6 Awesome Linux cd command Hacks

15. gzip

创建一个*.gz的压缩文件

$ gzip test.txt
解压*.gz文件

$ gzip -d test.txt.gz
显示压缩的比率

$ gzip -l *.gz
compressed uncompressed ratio uncompressed_name
23709 97975 75.8% asp-patch-rpms.txt
16. bzip2

创建*.bz2压缩文件

$ bzip2 test.txt
解压*.bz2文件

bzip2 -d test.txt.bz2
更多示例:BZ is Eazy! bzip2, bzgrep, bzcmp, bzdiff, bzcat, bzless, bzmore examples

17. uzip

解压*.zip文件

$ unzip test.zip
查看*.zip文件的内容

$ unzip -l jasper.zip
Archive: jasper.zip
Length Date Time Name
-------- ---- ---- ----
40995 11-30-98 23:50 META-INF/MANIFEST.MF
32169 08-25-98 21:07 classes_
15964 08-25-98 21:07 classes_names
10542 08-25-98 21:07 classes_ncomp
18. shutdown

关闭系统并立即关机

$ shutdown -h now
10分钟后关机

$ shutdown -h +10
重启

$ shutdown -r now
重启期间强制进行系统检查

$ shutdown -Fr now
评价: 这个话题有价值吗?  没有 (0分)   有, 感谢 (7.57分)
2017-08-24 13:14:21 1
 1  (总1页)
AMH社区列表
用户服务中心