表格
ls | ls -lls -lh(带大小)ls -a(含隐藏文件) | |
cd | cd /homecd ..(返回上一级)cd ~(回到家目录) | |
pwd | pwd | |
cp | cp file.txt /tmp/cp -r dir1 dir2(递归复制目录) | |
mv | mv file.txt newname.txtmv file.txt /tmp/(移动) | |
mkdir | mkdir testdirmkdir -p a/b/c(递归创建多级目录) | |
rm | rm file.txtrm -rf dir/(强制递归删目录,慎用) | |
rmdir | rmdir testdir | |
chmod | chmod 755 script.shchmod +x script.sh(添加执行权限) | |
tar | tar -zcvf test.tar.gz dir/tar -zxvf test.tar.gz(解压) |
表格
cat | cat /etc/hosts | |
tail | tail -f /var/log/messagestail -n 100 log.txt(查看最后 100 行) | |
head | head -n 20 log.txt | |
grep | grep "error" log.txtgrep -i "warn" log.txt(忽略大小写)grep -v "debug" log.txt(排除 debug 行) | |
vim | vim /etc/profilei插入、esc后:wq保存退出、:q!强制退出 | |
sed | sed -i 's/old/new/g' file.txt |
表格
ps | ps aux | ||
kill | kill 1234kill -9 1234(强制杀死) | ||
top | top | ||
uname | uname -runame -a(全部信息) | ||
useradd | useradd testuser | ||
passwd | passwd testuser | ||
find | find / -name "*.log"find /tmp -type f -size +10M(找 /tmp 下大于 10M 的文件) |
表格
df | df -h | |
du | du -sh /var/log/du -h --max-depth=1 /(根目录下各目录大小) | |
lsblk | lsblk | |
fdisk | fdisk -l | |
mount | mount /dev/sdb1 /data | |
umount | umount /data |
表格
ssh | ssh root@192.168.1.100 | |
ping | ping 192.168.1.1 | |
netstat | netstat -tulnp | |
curl | curl http://example.comcurl -O http://xxx/file.zip(下载文件) | |
ifconfigip | ifconfigip addr(新系统推荐) |
表格
rsync | rsync -avz /local/dir/ user@remote:/remote/dir/ | |
scp | scp file.txt root@192.168.1.100:/tmp/ | |
wget | wget http://xxx/file.zip | |
zipunzip | zip -r test.zip dir/unzip test.zip(解压) |
表格
history | history | ||
alias | alias ll='ls -lh' | ||
which | which python | ||
bc |