Common Linux commands (1)-Basics

Source: Internet
Author: User

View user IDs and group IDs

 
[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

 

View the users currently logged on to the system

 
[Amonest @ centos-server ~] $WhoAmonest PTS/0 2012-07-13 17:59(C60601199.xxxx.com)

 

View the machine's Ken time on the start date

[Amonest @ centos-server ~] $Who-Bsystem boot2012-07-13 16:49

 

View machine running time

 
[Amonest @ centos-server ~] $Uptime18:15:04Up1:25,1User, load average:0.00,0.00,0.00

 

View machine running time and login user

[Amonest @ centos-server ~] $W18:16:10Up1:27,1User, load average:0.00,0.00,0.00User tty from login @ idle jcpu pcpu whatamonest PTS/0C60601199.xxxxx.17:59 0. 00 s0. 07 s0. 00 sW

 

View system hard disk space information

[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 499 m  0 499 m 0 %/Dev/ SHM /Dev/sda1 485 m 31 m 429 m 7 %/ Bootnone  0   0   0 -/Proc/sys/fs/binfmt_misc

 

View System Process Information

[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 ]

 

Display process tree

[Amonest @ centos-server ~] $ Pstree-Ainit Certificate-auditd │ audio-{auditd} audio-avahi-Daemon │ ─ ── avahi-Daemon ‑crond ‑rsyslogd-I/var/run/syslogd. PID-C4│ ── {Rsyslogd} ── sshd │ ── bash │ ── pstree-A transaction-udevd-D ├ ── udevd-D └ ── udevd-D

 

Search for a keyword in man page (only in command names)

[Amonest @ centos-server ~] $Man-F avahiavahi-Daemon (8)-The avahi mdns/DNS-SD daemonavahi-Daemon. conf [avahi-daemon] (5)-Avahi-Daemon ConfigurationFileAvahi. hosts [avahi] (5)-Avahi-daemon static Host NameFileAvahi. Service [avahi] (5)-Avahi-daemon static ServiceFile

 

Search for a keyword in man page (search for the keyword in command name and command description)

[Amonest @ centos-server ~] $ Man - K printarch ( 1 )-Print machine hardware name (same Uname - M) base64 (  1 )-Base64 encode/ Decode data and print to standard outputblkid (  8 )-Command-line utility Locate / Print block device attributes  Cat ( 1 )- Concatenate files and print on the standard outputconsoletype (  1 )-Print type of the console connected to standard input  Date ( 1 )-Print or set the system Date And Time 

 

Check whether a package has been installed:

[Amonest @ centos-server ~] $ Rpm-Qa |Grep-ISSHOpenSSH-Server-5. 3p1-70. El6.x86 _ 64libssh2-1.2.2-7. El6_1.1. X86_64openssh-5. 3p1-70. El6.x86 _ 64 OpenSSH-Askpass-5. 3p1-70. El6.x86 _ 64 OpenSSH-Clients-5. 3p1-70. El6.x86 _ 64

 

Query the configuration file of a package:

 [amonest @ centos-server ~] $ Rpm-QC openssh- server /etc/PAM. d/ SSH - keycat /etc/PAM. d/ sshd /etc/ SSH / sshd_config /etc/sysconfig/sshd 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.