【linux常用指令】

10/20/2022 linux

linux常用指令来喽

# 进程管理(该系统当前登录人数)

w 显示当前在线情况,ke自行开启多个shell窗口调试
pkill -kill -t pts/1 杀死指定进程pts/1

[root@localhost /] w
 21:50:36 up 1 min,  3 users,  load average: 0.05, 0.03, 0.01
USER     TTY        LOGIN@   IDLE   JCPU   PCPU WHAT
root     tty1      21:49   60.00s  0.00s  0.00s -bash
root     pts/0     21:50    4.00s  0.00s  0.00s w
root     pts/1     21:50    1.00s  0.00s  0.00s -bash
[root@localhost /] pkill -kill -t pts/1
[root@localhost /] w
 21:53:44 up 4 min,  2 users,  load average: 0.00, 0.01, 0.01
USER     TTY        LOGIN@   IDLE   JCPU   PCPU WHAT
root     tty1      21:49    4:08   0.00s  0.00s -bash
root     pts/0     21:50    0.00s  0.00s  0.00s w
1
2
3
4
5
6
7
8
9
10
11
12

# cup 系统相关

# 文件

实时查看文件变动命令

tail -f 1.txt 
1

查看端口占用情况

netstat -anp|grep 1314
# 查看该端口下启动的进程信息
lsof -i tcp:80
1
2
3

tar 打包压缩文件/文件夹

tar zcvf test.zip.tar  test.png
tar zcvf test.zip.tar  test/
1
2

tar 压缩文件解压

tar zxvf test.zip.tar
1

# 防火墙

# 查看防火请状态
systemctl status firewalld 
service iptables status
# 暂时关闭防火墙
systemctl stop firewalld
service iptables stop
# 永久关闭防火墙
systemctl disable firewalld
chkconfig iptables off
# 重启防火墙
systemctl enable firewalld
service iptables restart
1
2
3
4
5
6
7
8
9
10
11
12
Last Updated: 3/30/2023, 4:36:37 PM