1、解除端口占用
# 1、找出占用端口进程的pid
lsof -i:port
或者
ps -ef | grep <command>
# 2、终止进程
kill -9 pid
2、让进程在后台运行
- nohup:nohup ping www.ibm.com &
- setsid:setsid ping www.ibm.com
nohup java -jar XXX.jar > /var/log/XXX.log 2>&1 &
3、查看CPU信息
/proc/meminfo
4、查看内存使用率最高的进程
top
M:按内存占用降序排列
P:按CPU占用降序排列
5、查看文件头/尾10行内容
head -n 10
tail -n 10
5、过滤文件内容中包含“error”的行
grep "error" file_name
cat file_name | grep "error"
7、查看某端口号
netstat -anp | grep 端口号
8、查看某进程号
ps -ef | grep ps_name
ps -ef | grep ps_number
9、查看IP地址
ifconfig
10、在当前用户家目录中查找文件
find ~/ -name xx.txt
11、查找xx进程并结束这个进程
ps -ef | grep xx
kill -9 xx端口号
12、动态查看日志文件
tail -f log_file
tailf log_file
13、磁盘空间
//查看系统磁盘空间
df -aTh
//查看文件夹空间占用,深度为1
du -h –max-depth=1 *
14、查看系统开放的端口有哪些
netstat -anptu
15、查看哪个进程在使用3306端口
lsof -i:3306
16、压缩成tar.gz的命令,以及解压
#压缩
tar zcvf xxx.tar.gz file
#解压
tar zxvf xxx.tar.gz
17、查看程序安装位置
where is 程序名
18、内存占用
free -m