查看用户标识和组标识
[amonest@centos-server ~]$ id uid=500(amonest) gid=500(amonest) groups=500(amonest),10(wheel) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
查看当前登录到系统的用户
[amonest@centos-server ~]$ who amonest pts/0 2012-07-13 17:59 (c60601199.xxxx.com)
查看机器在启动日期肯时间
[amonest@centos-server ~]$ who -b system boot 2012-07-13 16:49
查看机器运行时间
[amonest@centos-server ~]$ uptime 18:15:04 up 1:25, 1 user, load average: 0.00, 0.00, 0.00
查看机器运行时间和登录用户
[amonest@centos-server ~]$ w 18:16:10 up 1:27, 1 user, load average: 0.00, 0.00, 0.00 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT amonest pts/0 c60601199.xxxxx. 17:59 0.00s 0.07s 0.00s w
查看系统硬盘空间信息
[amonest@centos-server /etc]$ df -ah Filesystem Size Used Avail Use% Mounted on /dev/sda2 18G 6.3G 11G 39% / proc 0 0 0 - /proc sysfs 0 0 0 - /sys devpts 0 0 0 - /dev/pts tmpfs 499M 0 499M 0% /dev/shm /dev/sda1 485M 31M 429M 7% /boot none 0 0 0 - /proc/sys/fs/binfmt_misc
查看系统进程信息
[amonest@centos-server /etc]$ ps -ef UID PID PPID C STIME TTY TIME CMD root 1 0 0 16:49 ? 00:00:01 /sbin/init root 2 0 0 16:49 ? 00:00:00 [kthreadd] root 3 2 0 16:49 ? 00:00:00 [migration/0] root 4 2 0 16:49 ? 00:00:00 [ksoftirqd/0] root 5 2 0 16:49 ? 00:00:00 [migration/0] root 6 2 0 16:49 ? 00:00:00 [watchdog/0] root 7 2 0 16:49 ? 00:00:00 [events/0]
显示进程树
[amonest@centos-server ~]$ pstree -a init ├─auditd │ └─{auditd} ├─avahi-daemon │ └─avahi-daemon ├─crond ├─rsyslogd -i /var/run/syslogd.pid -c 4 │ ├─{rsyslogd} │ ├─{rsyslogd} │ └─{rsyslogd} ├─sshd │ └─sshd │ └─sshd │ └─bash │ └─pstree -a └─udevd -d ├─udevd -d └─udevd -d
在man page中搜索某个关键词(仅限在命令名称中搜索)
[amonest@centos-server ~]$ man -f avahi avahi-daemon (8) - The Avahi mDNS/DNS-SD daemon avahi-daemon.conf [avahi-daemon] (5) - avahi-daemon configuration file avahi.hosts [avahi] (5) - avahi-daemon static host name file avahi.service [avahi](5) - avahi-daemon static service file
在man page中搜索某个关键词(在命令名称和命令说明中搜索)
[amonest@centos-server ~]$ man -k print arch (1) - print machine hardware name (same as uname -m) base64 (1) - base64 encode/decode data and print to standard output blkid (8) - command-line utility to locate/print block device attributes cat (1) - concatenate files and print on the standard output consoletype (1) - print type of the console connected to standard input date (1) - print or set the system date and time
查询某个包是否已经安装:
[amonest@centos-server ~]$ rpm -qa | grep -i ssh openssh-server-5.3p1-70.el6.x86_64 libssh2-1.2.2-7.el6_1.1.x86_64 openssh-5.3p1-70.el6.x86_64 openssh-askpass-5.3p1-70.el6.x86_64 openssh-clients-5.3p1-70.el6.x86_64
查询某个包的配置文件:
[amonest@centos-server ~]$ rpm -qc openssh-server /etc/pam.d/ssh-keycat /etc/pam.d/sshd /etc/ssh/sshd_config /etc/sysconfig/sshd