Linux常用命令(一)- 基礎

來源:互聯網
上載者:User

查看使用者標識和組標識

[amonest@centos-server ~]$ iduid=500(amonest) gid=500(amonest) groups=500(amonest),10(wheel) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

 

查看當前登入到系統的使用者

[amonest@centos-server ~]$ whoamonest pts/0 2012-07-13 17:59 (c60601199.xxxx.com)

 

查看機器在啟動日期肯時間

[amonest@centos-server ~]$ who -bsystem boot 2012-07-13 16:49

 

查看機器已耗用時間

[amonest@centos-server ~]$ uptime18:15:04 up 1:25, 1 user, load average: 0.00, 0.00, 0.00

 

查看機器已耗用時間和登入使用者

[amonest@centos-server ~]$ w18:16:10 up 1:27, 1 user, load average: 0.00, 0.00, 0.00USER TTY FROM LOGIN@ IDLE JCPU PCPU WHATamonest pts/0 c60601199.xxxxx. 17:59 0.00s 0.07s 0.00s w

 

查看系統硬碟空間資訊

[amonest@centos-server /etc]$ df -ahFilesystem Size Used Avail Use% Mounted on/dev/sda2 18G 6.3G 11G 39% /proc 0 0 0 - /procsysfs 0 0 0 - /sysdevpts 0 0 0 - /dev/ptstmpfs 499M 0 499M 0% /dev/shm/dev/sda1 485M 31M 429M 7% /bootnone 0 0 0 - /proc/sys/fs/binfmt_misc

 

查看系統進程資訊

[amonest@centos-server /etc]$ ps -efUID PID PPID C STIME TTY TIME CMDroot 1 0 0 16:49 ? 00:00:01 /sbin/initroot 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 -ainit├─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 avahiavahi-daemon (8) - The Avahi mDNS/DNS-SD daemonavahi-daemon.conf [avahi-daemon] (5) - avahi-daemon configuration fileavahi.hosts [avahi] (5) - avahi-daemon static host name fileavahi.service [avahi](5) - avahi-daemon static service file

 

在man page中搜尋某個關鍵詞(在命令名稱和命令說明中搜尋)

[amonest@centos-server ~]$ man -k printarch (1) - print machine hardware name (same as uname -m)base64 (1) - base64 encode/decode data and print to standard outputblkid (8) - command-line utility to locate/print block device attributescat (1) - concatenate files and print on the standard outputconsoletype (1) - print type of the console connected to standard inputdate (1) - print or set the system date and time

 

查詢某個包是否已經安裝:

[amonest@centos-server ~]$ rpm -qa | grep -i sshopenssh-server-5.3p1-70.el6.x86_64libssh2-1.2.2-7.el6_1.1.x86_64openssh-5.3p1-70.el6.x86_64openssh-askpass-5.3p1-70.el6.x86_64openssh-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
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.