openSUSE:速查表 13.1
(重定向自 )
openSUSE 速查表
YaST 管理工具
使用 Qt GUI 运行 YaST
# yast –-qt
使用 Gtk GUI 运行 YaST
# yast --gtk
以文本模式运行 YaST
# yast --ncurses
列出可用的 YaST 模块
# yast -l
使用模块
# yast <modulename>
ZYpp 包管理
列出仓库
# zypper lr
添加仓库
# zypper ar -f <URL> <alias>
刷新仓库
# zypper ref
更新已安装的软件包
# zypper up
执行发行版升级
# zypper dup
软件包信息
# zypper if <package name>
软件包搜索
# zypper se <package, pattern or dependancy name>
哪个软件包拥有某个文件
# zypper se --provides <file path>
列出软件包中的文件
$ rpm -ql <package name>
Network
查看网络接口
$ ip a $ iwconfig
显示路由
$ ip ru; ip route show table all
显示开放的 TCP/UDP 端口
# ss -anptu
显示所有开放的端口
# ss -anp
测试主机可用性
$ ping hostname
更改主机名
# hostnamectl set-hostname machine.network.name
服务
列出所有服务
# systemctl list-units --type service
服务状态
# systemctl status <service name>
启动/停止/重启服务
# systemctl start <service name> # systemctl stop <service name> # systemctl restart <service name>
显示覆盖的配置文件
# systemd-delta
分析启动时间
# systemd-analyze blame # systemd-analyze plot >filename.svg
显示日志信息
# journalctl -u <service name> # journalctl -f (follow the output of the journal, similar to 'old' tail -f /var/log/messages) # journalctl -b (only show messages since last boot)
管理时间和日期
# timedatectl
CPU 与内存信息
查看 CPU 详细信息
$ lscpu $ less /proc/cpuinfo $ uname -a
显示正在运行的进程
$ ps -ef $ pstree $ top -c
显示内存使用情况
$ less /proc/meminfo $ free
启用/禁用交换空间
$ swapon -a $ swapoff -a
显示所有打开的文件和目录
# lsof | less # lsof | grep -i filename
文件系统
列出磁盘和分区
# fdisk -l # fdisk -l /dev/<h/s>d<a/z>
列出已挂载的文件系统
$ lsblk $ findmnt $ less /proc/self/mountinfo
挂载分区
# mount -t <type> <device> <mount point>
挂载 CD/DVD ISO 镜像
# mount -t iso9660 -o loop dvd-image.iso <mount point>
卸载文件系统
# umount /dev/<device> # umount /<mount point>
Inode 和磁盘空间使用情况组合,或按字段类型输出
# df --o -h # df --output=target,fstype,pcent
文件或目录占用的空间
# du -h
显示占用超过 10M 空间的所有目录
# du -h -t10M
帐户
创建用户账户
# useradd <name>
-u UID
-g GID
-d 主目录
-c 用户全名
-s 默认 shell
删除用户账户
# userdel <name>
更改用户密码
# passwd <name>
修改用户帐户
# usermod <options> <name>
构建服务
分支和检出软件包
$ osc bco <source project> <source package>
提交软件包更改
$ osc commit -m "<comment>"
提交更改的软件包
$ osc sr
文件系统布局
- /bin – 包含用户和管理员都使用的有用命令。
- /boot – 此目录包含引导加载程序和 Linux 内核。
- /dev – 包含所有设备的特殊设备文件。
- /etc – 此目录包含系统的特定于主机的配置文件。
- /home – Linux 是一个多用户环境,因此每个用户也分配了一个特定的目录,只有他们和系统管理员可以访问该目录。
- /lib* – 包含系统程序所需的共享库。
- /mnt – 通用挂载点。
- /opt – 包含不属于 openSUSE 的第三方软件。
- /proc – 伪文件系统,包含与进程和内核配置相关的文件
- /root – root 用户的家目录。
- /run – 系统在运行过程中创建的文件,这些文件不会在重启后保留。
- /sbin – 包含对系统运行至关重要的二进制文件。
- /srv – 包含此系统提供的站点特定数据。
- /sys – 伪文件系统,包含与内核配置和系统状态相关的文件
- /tmp – 目录用于保存临时文件。
- /usr – 目录包含所有用户共享的系统文件和目录。
- /var – 包含系统在运行过程中写入数据的文件。