查看磁盘空间:df -h
查看当前目录下各子目录的占用空间:du -sh * 或者du -h --max-depth=1
查找大文件:find . -type f -size +800M
查看系统的发行版本:
ls -l /etc/*-release
cat /etc/os-release 或者cat /etc/redhat-release 或者cat /etc/lsb-release
查看系统内核版本:uname -a
如:显示Linux ubuntu 4.15.0-192-generic #203-Ubuntu SMP Wed Aug 10 17:40:03 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux,说明Linux内核版本是4.15.0
目前linux 内核最新版本6.4
查看有哪些user:cat /etc/passwd |grep /bin/bash
block端口:
sudo iptables -I INPUT -p udp --dport 5004 -j DROP
sudo iptables -I OUTPUT -p udp --dport 5004 -j DROP
sudo iptables -I INPUT -p udp --dport 5004 -j REJECT
sudo iptables -I OUTPUT -p udp --dport 5004 -j REJECT
unblock端口:
sudo iptables -D INPUT -p udp --dport 5004 -j DROP
sudo iptables -D OUTPUT -p udp --dport 5004 -j DROP
修改文件的所有者:sudo chown -R lal:lal * (change owner)
关于挂载mount命令,如出错可能是因为系统默认不安装nfs的相关工具。
方法一:安装nfs-common。
sudo apt-get install nfs-common -y
方法二:高版本Ubuntu中,可安装nfs-utils。
sudo apt-get install nfs-utils -y
查看端口被哪个进程占用:
sudo lsof -i tcp:443 | grep LISTEN
sudo kill pid
电脑443端口被限制了,可以做一下端口转发,即修改/etc/pf.conf:
rdr-anchor "com.apple/*"
rdr pass on en0 inet proto tcp from any to any port 8443 -> 127.0.0.1 port 443
然后sudo pfctl -ef /etc/pf.conf