查找文件[路径,名称]
find / -name 名称
whereis 要搜索的名称
杀死进程[名称]
killall -9 名称
杀死运行端口进程,如:39001
kill `netstat -anp|grep 39001|awk '{printf $7}'|cut -d/ -f1`
上传下载文件命令rz、sz
yum -y install lrzsz
sz log.txt 下载
rz 上传
查目录下文件大小[最大深度,目录]
du -h --max-depth=3 /home/
释放所有删除进程,慎用,会导致大量服务崩溃!!!!
lsof | grep delete | awk '{print $2}' | xargs kill
io监视工具
apt install iotop
iotop
文件写入监视
apt install inotify-tools
inotifywait -mrq --timefmt '%d%m%y %H:%M' --format '%T %w%f' -e modify -e create /var
# 磁盘监视
inotifywait -mrq --timefmt '%d%m%y %H:%M' --format '%T %w%f' -e modify -e create /opt
软链接
ln -s 源文件(最好写绝对路径) 目标文件
tgz压缩,解压
tar cfz app.tgz *
tar zxvf app.tgz
zip压缩,解压
zip -r ds.zip ./*
unzip ds.zip
解压中文乱码:
unzip -O cp936 1.zip
yum install unzip
清空命令行执行记录
rm -rf /root/.bash_history;history -c
查看当前登录的ssh用户
who
查看自己登录的用户
who am i
踢掉指定用户
pkill -kill -t pts/1
gzexe加密,解密:
加密: gzexe test.sh (test.sh~ 是备份文件,test.sh是加密文件)
解密: gzexe -d test.sh
查询httpd端口
netstat -nutlp | grep httpd
复制文件[原文件目录,新的目录]
cp /etc/hosts /root/
修改权限[权限,绝对路径]
chmod 777 /var/lib/mysql/llws
给目录下所有子文件设置权限:
sudo chmod -R 777 emqx/
添加可执行权限
chmod a+x /usr/bin/fas_openvpn
批量替换目录文件
sed -i "s#网址或目录#要替换的网址或目录#g" `grep 网址或目录 -rl /root/tz.php`
系统版本
cat /proc/version
uname -a
lsb_release -a
cat /etc/redhat-release
重启 shutdown -r now或reboot
关机 halt
检查制定端口占用
netstat -lnp|grep 53
检查TCP端口开启
netstat -ntpl
检查UDP端口开启
netstat -nulp
修改服务器时间
date -s 09/01/2017
杀死指定端口进程,如1888端口
kill -9 $(lsof -i tcp:1888 -t)
查看当前等待端口数量
netstat -n | awk '/^tcp/ {++y[$NF]} END {for(w in y) print w, y[w]}'
查看当前等待端口
netstat -a|grep TIME_WAIT
系统禁止ping
echo 1 >/proc/sys/net/ipv4/icmp_echo_ignore_all
系统允许ping
echo 0 >/proc/sys/net/ipv4/icmp_echo_ignore_all
linux抓包
tcpdump -i eth0 host 47.92.93.225 -ttnnvvS -X
扩容硬盘(常州云)
(echo "n"
echo "p"
echo "1"
echo ""
echo ""
echo "p"
echo "w") | fdisk /dev/sdb
vgs
vgextend VolGroup /dev/sdb1
lvdisplay
lvextend -L +80G /dev/VolGroup/lv_root
cat /etc/issue
resize2fs /dev/VolGroup/lv_root
df -h
将内容写入到指定文件
sudo tee /root/test.json <<-'EOF'
我是要写入的内容
EOF
停止防火墙
systemctl stop firewalld.service
启动防火墙
systemctl start firewalld.service
重启防火墙
systemctl restart firewalld.service
重载防火墙
systemctl reload firewalld.service
杀死服务
systemctl kill firewalld.service
服务开机自启动
systemctl enable httpd
服务不开机自启动
systemctl disable httpd
-bash: ./push.sh: /bin/bash^M: bad interpreter: No such file or directory
vim filename,编辑文件,执行“: set ff=unix”,将文件设置为unix格式,然后执行“:wq”,保存
忽略php版本
composer require --ignore-platform-reqs
无论从事什么行业,只要做好两件事就够了,一个是你的专业、一个是你的人品,专业决定了你的存在,人品决定了你的人脉,剩下的就是坚持,用善良專業和真诚赢取更多的信任。