Information view
端口占用:lsof -i:端口 查看MAC网卡:ifconfig -a 其中 HWaddr字段就是mac地址时间戳转换:时间戳转字符串:date -d @1509602291 "+%Y-%m-%d-%h"字符串转时间戳:?date -d "2010-10-18 00:00:00" +%s?
Text manipulation
(1) Text filtering: grep
Common option:
--color:过滤字段红字标红-v:不包含-A N:匹配字段前N行-B N:匹配字段后N行
(2) View tail n rows: Tail
(3) View file header N rows: Head
File operations
(1) Local file copy to remote server
//上传scp -P Port 本地文件完整路径 [email protected]远程[email protected]远程服务端口号:目标绝对路径//下载scp -P Port [email protected]远程[email protected]远程服务端口号:文件绝对路径 本地目录
(2) Compression and decompression
zip// 压缩 zip xxx.zip 文件// 压缩目录 zip -r xxx.zip 目录// 例如:zip -r ./aa.zip ./*// 解压到指定目录 unzip xxx.zip -d xxxtar? 解包:tar xvf FileName.tar 打包:tar cvf FileName.tar DirName (注:tar是打包,不是压缩!) ——————————————— ?.gz 解压1:gunzip FileName.gz 解压2:gzip -d FileName.gz 压缩:gzip FileName——————————————— .tar.gz 和 .tgz 解压:tar zxvf FileName.tar.gz 压缩:tar zcvf FileName.tar.gz DirName ———————————————.bz2 解压1:bzip2 -d FileName.bz2 解压2:bunzip2 FileName.bz2 压缩: bzip2 -z FileName
Process/Thread Classes
(1) View port occupancy:
lsof -i:port
(2) Kill process
kill PIDkill -9 PID //强制kill进程killall XXX
(3) View process start time
ps -p PID -o lstartps -eo etime???运行多长时间.
(4) View app process number
ps -ef | grep appName
Linux Common commands