Linux 是服务器端最常用的操作系统,掌握常用命令能大大提高工作效率。
文件操作
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| ls -la
cd /path/to/dir
mkdir -p dir1/dir2
rm -rf dir
cp -r source dest
mv old new
cat file head -n 20 file tail -f file
|
权限管理
1 2 3 4 5 6 7 8 9
| chmod 755 file chmod -R 755 dir
chown user:group file
ls -l
|
进程管理
1 2 3 4 5 6 7 8 9 10 11 12
| ps aux | grep nginx
top htop
kill -9 PID
nohup command &
|
磁盘管理
1 2 3 4 5 6 7 8 9
| df -h
du -sh *
mount /dev/sda1 /mnt umount /mnt
|
网络相关
1 2 3 4 5 6 7 8 9 10
| netstat -tlnp ss -tlnp
ping google.com curl -I https://example.com
wget https://example.com/file.zip
|
系统信息
1 2 3 4 5 6 7 8 9 10 11
| cat /etc/os-release
uname -a
free -h
lscpu
|
实用技巧
Ctrl + R:搜索历史命令
Tab:自动补全
!!:执行上一条命令
!$:上一条命令的最后一个参数
Ctrl + C:终止当前命令
Ctrl + Z:暂停当前命令
持续更新中…