cat /etc/redhat-releasemkdir 文件夹名kill 7554sudo fuser 80/tcprm -rf 文件名tar -xzf 压缩包名.tar.gzfind / -name "*文件名.扩展名*"useradd -m 用户名
passwd 用户名userdel 用户名cat /etc/passwd|cut -d: -f1su - 用户名sudo chmod 700 路径
sudo chown root:账户 路径
ls -ld 路径注:700模式,意味着该目录除了设置的用户能读写执行此目录以外,拒绝其他任何用户访问。777模式意味着允许任何用户读写执行。600模式,意味着该目录除了设置的用户能读写此目录以外,拒绝其他任何用户访问。
groupsrebootdf -h注:size一共多大,used使用了多少,Avail剩余多少。
sudo systemctl start hellowsudo systemctl restart hellowsudo systemctl reload hellowsudo systemctl stop hellow1.编辑当前用户的定时任务列表
sudo crontab -e2. 在该文档中填写以下代码
0 */6 * * * systemctl restart reader注:这条命令的意思是,在每小时的第0分钟(即整点),每过6小时执行一次 systemctl restart reader命令。定时任务列表路径为/var/spool/cron/。
3.键盘按下esc,:wq,回车,进行退出编辑并保存。
sudo systemctl enable hellowsudo systemctl disable hellowsystemctl status hellowjournalctl -u hellow注:hellow.service为服务名。
ip addr
ip addr show ens33netstat -tulpn | grep 80注:80为要查看的端口。
top -o %MEM
top -o %CPU注:也可通过查询系统服务状态的方式查看对应服务运行所占内存,VIRT进程占用的虚拟内存值,RES进程占用的物理内存值。执行top后按e可切换显示单位。
yum install -y htop
htopfree -h注:
used:已使用内存
total:内存总量
防火墙日志路径:通常位于/var/log/firewalld
systemctl status firewalld systemctl start firewalld systemctl enable firewalld firewall-cmd --reloadsudo firewall-cmd --list-ports
sudo firewall-cmd --zone=public --list-allfirewall-cmd --permanent --add-rich-rule='rule family=ipv4 source address="123.1.1.1" drop'firewall-cmd --permanent --remove-rich-rule='rule family=ipv4 source address="123.1.1.1" drop'firewall-cmd --permanent --add-rich-rule='rule family=ipv4 source address="116.255.0.0/16" drop'firewall-cmd --permanent --add-rich-rule='rule family=ipv4 source address="116.255.196.0/24" drop'sudo firewall-cmd --permanent --add-port=2000/tcpsudo firewall-cmd --permanent --remove-port=2000/tcp注:这只是禁止外网及局域网访问2000端口,服务器本地的项目依然可以访问2000端口。
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="0.0.0.0/0" port protocol="tcp" port="2000" reject'firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="192.168.0.0/16" port port="2000" protocol="tcp" accept'sudo firewall-cmd --zone=public --add-rich-rule='rule family="ipv4" source address="192.168.2.0/24" port port="22" protocol="tcp" accept' --permanentfirewall-cmd --permanent --remove-rich-rule='rule family="ipv4" source address="0.0.0.0/0" port protocol="tcp" port="2000" reject'firewall-cmd --permanent --remove-rich-rule='rule family="ipv4" source address="192.168.0.0/16" port port="2000" protocol="tcp" accept'1.第一次安装CentOS一定要选择最完整版,不要选择精简版!因为依赖关系问题更容易处理,功能也更全。
2.服务器配置主要看内存和带宽,因为价格低的服务器内存都很小,内存不够工具都不够装,带宽不够多来几个人访问项目就会很卡。