网络管理
ifconfig
ifconfig
sudo ifconfig ens33 down
sudo ifconfig ens33 up
ip address
ip address
nmcli
NetworkManager
nmcli connection show
cd /etc/NetworkManager/system-connections
sudo cat "有线连接 1.nmconnection"
nmcli connection delete "有线连接 1"
sudo systemctl restart NetworkManager
nmcli connection add type ethernet con-name ens33 ifname ens33 connection.autoconnect yes
sudo diff "有线连接 1.nmconnection" ens33.nmconnection
nmcli connection modify ens33 ipv4.method manual ipv4.addresses 192.168.95.95/24 ipv4.gateway 192.168.95.1 ipv4.dns 192.168.95.1 connection.autoconnect yes
nmcli connection up ens33
Linux 查看端口占用情况
Linux 查看端口占用情况可以使用 lsof 和 netstat 命令。
lsof
lsof(list open files)是一个列出当前系统打开文件的工具。
lsof 查看端口占用语法格式:
lsof -i:端口号
多 lsof 的命令如下:
lsof -i:8080:查看8080端口占用
lsof abc.txt:显示开启文件abc.txt的进程
lsof -c abc:显示abc进程现在打开的文件
lsof -c -p 1234:列出进程号为1234的进程所打开的文件
lsof -g gid:显示归属gid的进程情况
lsof +d /usr/local/:显示目录下被进程开启的文件
lsof +D /usr/local/:同上&#x