Linux 系统中有许多常用命令,每个命令都有其特定的功能。以下是一些最常用的 Linux 命令及其主要功能:
ls
-l:详细列表(权限、所有者、大小等)-a:显示隐藏文件-h:人类可读的文件大小(如 KB、MB)cd
cd /home 进入 /home 目录cd .. 返回上一级目录pwd
mkdir
mkdir new_folderrmdir
rm
-r:递归删除(用于删除目录)-f:强制删除(不提示)cp
cp file1.txt /backup/mv
mv old.txt new.txt(重命名)mv file1 /tmp/(移动)touch
cat
cat file.txtless / more
head
head -n 5 file.logtail
tail -f /var/log/syslog(实时跟踪日志)find
find / -name "*.conf"grep
grep "error" /var/log/sysloguname
-a:显示所有信息(内核版本、主机名等)df
-h(人类可读格式)du
du -sh /homefree
-h(人类可读格式)top / htop
ps
aux(显示所有进程)kill
kill -9 PID(强制终止)systemctl
systemctl start nginxsystemctl enable nginxjournalctl
journalctl -u nginxping
ping google.comifconfig / ip
ip anetstat / ss
netstat -tulnpcurl / wget
curl -O http://example.com/file.zipssh
ssh user@192.168.1.100scp
scp file.txt user@remote:/path/tar
tar -cvf archive.tar files/(打包)tar -xvf archive.tar(解压)gzip / gunzip
.gz 文件zip / unzip
.zip 文件chmod
chmod 755 script.shchown
chown user:group file.txthistory
alias
alias ll='ls -la'crontab
crontab -ewhich
which pythonman
man ls这些命令涵盖了 Linux 日常管理、文件操作、网络配置、进程管理等核心功能,掌握它们可以高效地进行系统管理和故障排查。