在 Ubuntu(以及大多数 Linux 发行版)里,查看系统版本和日常管理常用命令可以分几类来记,下面给你一份实用速查表。
一、查看 Ubuntu 系统版本
1 查看发行版版本(最常用)
lsb_release -a示例输出:
Distributor ID: Ubuntu
Description: Ubuntu 22.04.3 LTS
Release: 22.04
Codename: jammy推荐,信息最清晰。
2 查看系统版本文件
cat /etc/os-release或
cat /etc/lsb-release适合脚本中使用。
3 查看内核版本
uname -a或只看版本:
uname -r示例:
Linux ubuntu 5.15.0-86-generic x86_644 查看系统架构
arch
# 或
uname -m常见结果:
x86_64→ 64 位aarch64→ ARM 64 位
二、系统信息常用命令
CPU 信息
lscpu内存信息
free -h磁盘空间
df -h目录占用空间
du -sh *系统运行时间 & 负载
uptime三、软件包管理(APT)
更新软件源
sudo apt update升级已安装软件
sudo apt upgrade安装软件
sudo apt install nginx卸载软件
sudo apt remove nginx搜索软件
apt search docker四、进程与服务管理
查看进程
ps aux
top
htop # 需安装查看端口占用
sudo netstat -tunlp
# 或
sudo ss -tunlpsystemd 服务管理
systemctl status nginx
systemctl start nginx
systemctl stop nginx
systemctl restart nginx
systemctl enable nginx五、用户与权限
当前用户
whoami切换用户
su - username提权执行
sudo command修改文件权限
chmod 644 file
chmod +x script.sh修改文件所有者
chown user:group file六、网络相关
IP 地址
ip a测试网络
ping google.comDNS 解析
nslookup google.com
dig google.com下载文件
wget url
curl -O url七、日志查看
系统日志
journalctl -xe查看某服务日志
journalctl -u nginx实时查看日志
tail -f /var/log/syslog八、文件与目录操作(基础但高频)
ls -lah
cd /path
pwd
mkdir dir
rm -rf file_or_dir
cp src dst
mv old new✅ 总结:最常用 10 条命令
lsb_release -a
uname -a
df -h
free -h
ip a
sudo apt update && sudo apt upgrade
systemctl status xxx
journalctl -u xxx
top
tail -f /var/log/syslog 版权属于: 三三世界-百宝箱
本文链接: http://www.33f.net/index.php/setup/ubuntu_command.html
本文最后更新于2026年10月28日 ,已超过25天没有更新,若内容或图片失效,请留言反馈。
本文允许转载,但请在转载时请以超链接或其它形式标明文章出处
@Doug Shume it's ok for me , you can post here.
zh.us.to 有效
kms.03k.org 有效
kms.chinancce.com
kms.shuax.com 有效
kms.dwhd.org 有效
kms.luody.info 有效
kms.digiboy.ir 有效
kms.lotro.cc 有效
www.zgbs.cc 有效
cy2617.jios.org 有效
@ 权限问题,试试sudo 再加命令。
你好提示Permission denied 怎么办啊