Linux日常维护常用命令

2023-04-18 03:09:00 linux 常用命令 日常维护

Linux 日常维护常用命令包括:查看系统信息、查看磁盘空间、查看进程状态、修改文件权限、查看服务状态、管理网络、创建用户、查看网络连接、查看网络状态、查看系统日志、查看系统负载、查看安装的软件、查看内存使用等。

1. 查看系统信息:uname -a,hostname,cat /etc/issue,cat /etc/redhat-release,cat /proc/version,cat /proc/cpuinfo,cat /proc/meminfo,df -h,free -m,cat /proc/mounts,cat /etc/fstab,ifconfig -a,route -n,netstat -rn,cat /proc/net/dev,cat /etc/resolv.conf,cat /etc/hosts,iptables -L,ip route show,iptables -t nat -L,iptables -t mangle -L,iptables -t raw -L,iptables -t security -L,iptables -t filter -L,iptables -S,iptables-save,iptables-restore,iptables -nL,iptables -nvL,iptables -t nat -nL,iptables -t nat -nvL,iptables -t mangle -nL,iptables -t mangle -nvL,iptables -t raw -nL,iptables -t raw -nvL,iptables -t security -nL,iptables -t security -nvL,iptables -t filter -nL,iptables -t filter -nvL,cat /proc/sys/net/ipv4/ip_forward,cat /proc/sys/net/ipv4/conf/default/forwarding,cat /proc/sys/net/ipv4/conf/all/forwarding。

2. 查看磁盘空间:df -h,fdisk -l,lsblk -f,mount。

3. 查看进程状态:ps -ef,ps -aux,top,htop,kill -9 pid,pkill -9 process_name,killall -9 process_name,pstree,pgrep。

4. 修改文件权限:chmod,chown,chgrp。

5. 查看服务状态:systemctl status service_name,systemctl list-units,systemctl list-unit-files,systemctl list-dependencies,systemctl list-sockets,systemctl list-timers,systemctl list-machines,systemctl list-jobs,systemctl list-unit-files --type=service,systemctl list-unit-files --state=inactive,systemctl list-unit-files --state=enabled,systemctl list-unit-files --state=disabled,systemctl start service_name,systemctl stop service_name,systemctl restart service_name,systemctl reload service_name,systemctl enable service_name,systemctl disable service_name,systemctl is-enabled service_name,systemctl is-active service_name,systemctl status service_name,systemctl list-unit-files --type=service。

6. 管理网络:ifconfig,route,netstat,iptables,ip,dhclient,dhcpd,hostname,host,nslookup,traceroute,ping,arp,dig,whois,tcpdump。

7. 创建用户:useradd,userdel,usermod,passwd,chfn,chsh,groupadd,groupmod,groupdel,gpasswd。

8. 查看网络连接:netstat -an,netstat -s,netstat -i,netstat -r,netstat -t,netstat -u,netstat -l,netstat -o。

9. 查看网络状态:ifconfig,route,netstat,iptables,ip,dhclient,dhcpd,hostname,host,nslookup,traceroute,ping,arp,dig,whois,tcpdump。

10. 查看系统日志:cat /var/log/messages,cat /var/log/secure,cat /var/log/maillog,cat /var/log/cron,cat /var/log/boot.log,cat /var/log/yum.log,cat /var/log/dmesg,cat /var/log/lastlog,cat /var/log/audit/audit.log,cat /var/log/httpd/access_log,cat /var/log/httpd/error_log。

11. 查看系统负载:top,uptime,w,vmstat,mpstat,iostat,sar,free,cat /proc/loadavg。

12. 查看安装的软件:rpm -qa,yum list installed,dpkg --list,ls /var/log/packages。

13. 查看内存使用:free,cat /proc/meminfo,vmstat,top,htop,pmap。

相关文章