紫色的风
吹着你跳动的心

Linux VPS常用命令集合

日常命令

cd                                          
ls                                          
lsb_release -a                              
uname -r                                    
uname -a                                    
head -n 1 /etc/issue                        
cat /proc/cpuinfo                           
hostname                                    
lspci -tv                                   
lsusb -tv                                   
lsmod                                       
env                                         
cp                                          
rm                                          


hostname                                    
hostname SunPma                             
vi /etc/hostname                            


apt-get install vim
i                                           
Esc                                         
:wq                                         
:q!                                        


nohup top &                                 
ps -ef                                      
kill -6 8585                                



mv /home/wwwroot/abc.tar.gz /home/backup


rm -rf /var/log/httpd/access





rm -rf /var/log/httpd/access```

进程相关
----

null

ps -ef

ps -ef | grep 程序名称

kill 进程PID
killall 进程名称

kill -9 进程PID
killall -9 进程名称“`

关闭防火墙

// Debian/Ubuntu 关闭防火墙
apt-get remove ufw 
iptables -P INPUT ACCEPT 
iptables -P OUTPUT ACCEPT 
iptables -F 

// CentOS 关闭防火墙
systemctl stop firewalld.service 
systemctl disable firewalld.service 
yum install iptables iptables-services 
iptables -P INPUT ACCEPT 
iptables -P OUTPUT ACCEPT 
iptables -F```

临时文件目录
------

null

cd /home/sunpma

python -m SimpleHTTPServer 8000

python3 -m http.server 8000“`

禁用IPv6

vi /etc/sysctl.d/99-sysctl.conf


net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1


sysctl -p```

放行端口
----

null

iptables -I INPUT -p tcp –dport 8888 -j ACCEPT
iptables-save

apt-get install iptables-persistent
netfilter-persistent save
netfilter-persistent reload

firewall-cmd –zone=public –add-port=8888/tcp –permanent
firewall-cmd –reload

iptables -L“`

卸载阿里云盾监控

wget http:
sh uninstall.sh
wget http:
sh quartz_uninstall.sh


pkill aliyun-service
rm -fr /etc/init.d/agentwatch /usr/sbin/aliyun-service
rm -rf /usr/local/aegis*```

WGET下载命令
--------

null
// 安装wget

apt-get update
apt-get install wget
wget “`

wget https:


wget -O xx.zip https:


wget -P /home/abc https:


wget -O /home/xx.zip https:


wget --limit-rate=500k https:


wget -c https:


wget -b https:


wget --user-agent="Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16" https:


wget -i filelist.txt #我们制作一个filelist.txt文件,然后文档中放置多个文件需要下载。一行一个链接文件


wget -Q5m -i filelist.txt```

TOP命令
-----

null

Tasks: 29 total, 1 running, 28 sleeping, 0 stopped, 0 zombie

Cpu(s): 0.3% us, 1.0% sy, 0.0% ni, 98.7% id, 0.0% wa, 0.0% hi, 0.0% si

——————————– 分割线 ——————————-

Tasks: 29 total # 进程总数
1 running # 正在运行的进程数
28 sleeping # 睡眠的进程数
0 stopped # 停止的进程数
0 zombie # 僵尸进程数
Cpu(s):
0.3% us # 用户空间占用CPU百分比
1.0% sy # 内核空间占用CPU百分比
0.0% ni # 用户进程空间内改变过优先级的进程占用CPU百分比
98.7% id # 空闲CPU百分比
0.0% wa # 等待输入输出的CPU时间百分比
0.0% hi
0.0% si
0.0% wa # wa百分比可以大致的体现出当前的磁盘io请求是否频繁;
# 如果wa的数量比较大,说明等待输入输出的的io比较多。“`

tar.gz解压缩工具

tar -xvf file.tar

tar -xzvf file.tar.gz

tar -xjvf file.tar.bz2

tar -xZvf file.tar.Z

unrar e file.rar

unzip file.zip


tar zcvf test.tar.gz /home/wwwroot


file file.tar.gz```

UNZIP解压缩工具
----------

null

wget http:

tar zxvf unzip552.tar.gz

cd unzip-5.52/

cp unix/Makefile ./

make generic
make install

unzip test.zip

unzip -v test.zip

unzip test.zip tmp/“`

系统信息

arch                   
uname -m               
uname -r               
dmidecode -q           
hdparm -i /dev/hda     
hdparm -tT /dev/sda    
cat /proc/cpuinfo      
cat /proc/interrupts   
cat /proc/meminfo      
cat /proc/swaps        
cat /proc/version      
cat /proc/net/dev      
cat /proc/mounts       
lspci -tv              
lsusb -tv              
date                   
cal 2007               
date 041217002007.00   
clock -w               ```

资源查看
----

null
free -m
df -h
du -sh
grep MemTotal /proc/meminfo
grep MemFree /proc/meminfo
uptime
cat /proc/loadavg “`

磁盘和分区

df -h                  
mount | column -t      
fdisk -l               
swapon -s              
hdparm -i /dev/hda     
dmesg | grep IDE       ```

网络
--

null
ifconfig
iptables -L
route -n
netstat -lntp
netstat -antp
netstat -s

/etc/init.d/networking start
/etc/init.d/networking stop
/etc/init.d/networking restart
/etc/init.d/networking force-reload

apt install ifupdown
ifup ens3 “`

用户

su sunpma                  
w                          
id root                    
last                       
cut -d: -f1 /etc/passwd    
cut -d: -f1 /etc/group     
crontab -l                 
useradd root               
passwd root                
userdel -r root            ```

服务
--

null
chkconfig list
chkconfig list | grep on
rpm -qa “`

文件搜索

null find / -name file1 从 '/' 开始进入根文件系统搜索文件和目录 find / -user user1 搜索属于用户 'user1' 的文件和目录 find /home/user1 -name *.bin 在目录 '/ home/user1' 中搜索带有'.bin' 结尾的文件 find /usr/bin -type f -atime +100 搜索在过去100天内未被使用过的执行文件 find /usr/bin -type f -mtime -10 搜索在10天内被创建或者修改过的文件 find / -name *.rpm -exec chmod 755 '{}' ; 搜索以 '.rpm' 结尾的文件并定义其权限 find / -xdev -name *.rpm 搜索以 '.rpm' 结尾的文件,忽略光驱、捷盘等可移动设备 locate *.ps 寻找以 '.ps' 结尾的文件 - 先运行 'updatedb' 命令 whereis halt 显示一个二进制文件、源码或man的位置 which halt 显示一个二进制文件或可执行文件的完整路径

赞(0)
未经允许不得转载:紫风 » Linux VPS常用命令集合

评论 抢沙发