Linux环境常用命令

bash

host                    #查看IP对应机器名

hostname         #查看本机名         hostname –i     #查看本机IP

mssh --host-list '10.4.20.87,10.4.20.88,10.4.20.92,10.4.20.93' --host-timeout 200 'cd .service; svc -h suggestion_new_service_run; sleep 120'

netstat –nlpt   #查看网络端口

nmap -p 7021 10.42.117.16    #扫描网络端口

ps aux                #查看进程,进程memory使用

 

top -c                   #查看CPU、Memory使用率,可配合grep使用(top -c |grep xxx)

diff –rau dir1 dir2     #对比两个目录的差异

du –sh --max-depth=1 .             #查看占用文件系统存储

df –h                  #查看文件系统配额

lsof                    #查看目录下打开的文件

 

zip (-r) cat.zip cat     #zip压缩文件或目录     unzip         #解压zip文件

 

tar zcvf cat.tar.gz cat/     #tar.gz压缩文件或目录

tar zxvf cat.tar.gz             #tar.gz解压文件或目录

iconv -c -f utf8 -t gb18030    #转码

 

join -a 1 -a 2 -t$'\t' -1 2 -2 2 -o '1.1,0,1.3,2.1' -e'0' a.txt b.txt

#全连接(-a 1 -a 2)a.txt和b.txt两个文件的第2列(-1 2 -2 2),使用'\t'分隔,缺失位补'0',显示格式是:(file1列1,匹配列,file1列3,file2列1)('1.1,0,1.3,2.1')

https://linux.die.net/man/1/join

 

screen

screen -S s1

screen -ls

screen -r s1

screen -d

 

ctrl-a + c

ctrl-a + 0..9

ctrl-a + p    ctrl-a + n

ctrl-a + d

ctrl-a + k

 

更全面的:

命令行的艺术 (GitHub 星标 6 万多)

https://mp.weixin.qq.com/s/qN_qC9m2JoAAnMScukDUUw

posted on 2019-02-11 21:04  冰山上的博客  阅读(230)  评论(0编辑  收藏  举报