Common commands for linux system information retrieval

Source: Internet
Author: User
Common commands for linux system information retrieval 1. disk information [wang @ localhost desktop] $ du-sh. /mm392K. /mm [wang @ localhost desktop] $ du-ak. /mm376./mm/boot_nontrust.bin4. /mm/bt. sh0./mm/check. md54./mm/rtk8723_bt... common commands for linux system information retrieval 1. disk information [wang @ localhost desktop] $ du-sh. /mm392K. /mm [wang @ localhost desktop] $ du-ak. /mm376. /mm/boot_nontrust.bin4. /mm/bt. sh0. /mm/check. md54. /mm/rtk8723_bt_config4. /mm/startup. x392. /mm [wang @ localhost desktop] $ du-ah. /mm376K. /mm/boot_n Ontrust. bin4.0K. /mm/bt. sh0. /mm/check. md54.0K. /mm/rtk8723_bt_config4.0K. /mm/startup. x392K. /mm [wang @ localhost desktop] $ du-ac. /mm376. /mm/boot_nontrust.bin4. /mm/bt. sh0. /mm/check. md54. /mm/rtk8723_bt_config4. /mm/startup. x392. /mm392 total [wang @ localhost desktop] $ du-m. /mm1. /all mm-a files;-s total data;-h friendly output;-c total;-B-k-m-B byte Kb Mb. Note: it can be used to check whether the SD card is mounted successfully. [Wang @ localhost desktop] $ df-H file system capacity in use available % mount point/dev/mapper/vg_localhost-lv_root 28G 12G 15G 46%/dev/sda1 194 M 14 M 171 M 8%/boottmpfs 502 M 15 M 488 M 3%/dev/shm. host:/139G 35G 105G 25%/mnt/hgfs can be added without-h, which is a habit. 2. command execution time [wang @ localhost desktop] $ time lsa.txt B .txt. orig c. patch mm ~ PC1 shell. sh test1.sh real 0m0. 025 s // user 0m0 from start to end. 001 s // User mode CPU time sys 0m0. 001 s // kernel mode CPU time [wang @ localhost desktop] $ time-o out. o lsbash:-o: command not found real 0m0. 004 s user 0m0. 000 ssys 0m0. 000 s [wang @ localhost desktop] $/usr/bin/time-o out. o ls // use other time functions/usr/bin/timea.txt B .txt. orig c. patch mm ~ Out. o PC1shell. sh test1.sh because the system has two times, one built-in shell command and the other is/usr/bin/time. [Wang @ localhost desktop] $/usr/bin/time-f "Pagesize: % Z bytes" ls>/dev/null Pagesize: 4096 bytes [wang @ localhost desktop] $/usr/bin/time-f "Pagesize: % Z bytes"-o out. o ls>/dev/null 3. user information [wang @ localhost desktop] $ whowang tty1 2013-03-05 (: 0) wang pts/0 2013-03-05 (: 0.0) wang pts/1 2013-03-25 (: 0.0) wang pts/2 2013-03-11 (: 0.0) wang pts/3 2013-03-12 (: 0.0) [wang @ localhost desktop] $ w: 03 up 5 days, 5 users, load average: 0.21, 0.06, 0.02 user tty from login @ idle jcpu pcpu WHATwang tty1: 0 05Mar13 21 days s pam: TPD-passwowang pts/0: 0.0 05Mar13 12 days 0.46 s 50.76 s gnome-terminalwang pts/1: 0.0 Mon17 1.00 s 0.27 s 0.12 s wwang pts/2: 0.0 11Mar13 22: 56 m 0.21 s 0.21 s bashwang pts/3: 0.0 12Mar13 6 days 0.18 s 50.76 s gnome-terminal [wang @ localhost desktop] $ userswang wang w Ang wang [wang @ localhost desktop] $ last // logon session information wang pts/1: 0.0 Mon Mar 25 still logged in wang pts/4: 0.0 Fri Mar 22-(2 + 23: 52 )...... [Wang @ localhost desktop] $ last reboot // obtain restart session information reboot system boot 2.6.29.4-167. fc1 Wed Mar 6 (21 + 19: 31) reboot system boot 2.6.29.4-167. fc1 Sun Jan 27 (60 + 01: 07) reboot system boot 2.6.29.4-167. fc1 Sat Jan 26 (60 + 16: 02) reboot system boot 2.6.29.4-167. fc1 Sat Jan 26 (60 + 16: 06) reboot system boot 2.6.29.4-167. fc1 Thu Jan 10 (76 + 13: 24) reboot system boot 2.6.29.4-167. fc1 Thu Jan 10 (77 + 05: 44) wtmp begins Thu Jan 10 04:31:04 2013 [wang @ localhost desktop] $ last USER // Obtain the logon session information of a single USER wtmp begins Thu Jan 10 04:31:04 2013 [wang @ localhost desktop] $ lastb/ /list information about users that failed to log on to the system. lastb: /var/log/btmp: Permission denied [wang @ localhost desktop] $ su password: [root @ localhost desktop] # lastbwang tty1: 0 Tue Mar 5) btmp begins Tue Mar 5 14:44:04 2013 4. process information [wang @ localhost desktop] $ ps PID TTY TIM E cmd 7128 pts/1 00:00:00 bash 7943 pts/1 00:00:00 bash32625 pts/1 00:00:00 bash32651 pts/1 00:00:00 ps [wang @ localhost desktop] $ ps-fUID PID PPID C STIME TTY TIME CMDwang 7128 3023 0 Mar28 pts/1 00:00:00 bashwang 7943 7942 0 Mar28 pts/1 00:00:00 bashwang 32625 32623 32654 0 00:00:00 pts/1 00:00:00 bashwang 32625 0 pts/1 ps-f [wang @ localhost desktop] $ ps-eo comm, pcpu | head // comm indicates the command name, pupc indicates cp U usage. Other parameters include COMMAND % CPUinit 0.0 kthreadd 0.0 migration/0 0.0 ksoftirqd/0 0.0 watchdog/0 0.0 cpuset 0.0 events/0 0.0work _ on_cpu/0 0.0 khelper 0.0: pcpu cpu usage pid process IDppid parent process IDpmem memory usage comm executable file cmd simple command user startup process nice priority time accumulated cpu time etime process elapsed time tty associated TTY device euid valid user IDstat process status [wang @ localhost desktop] $ ps-eo comm, pcpu -- sort-pcpu | head // sort COMMAND % CPUXorg 0.1 gedit 0.0ata/0 0.0 pulseaudio in descending order by pcpu 0.0 nautilus 0.0 python 0.0 vmtoolsd 0.0gnome-terminal 0.0ibus-daemon 0.0 [wang @ localhost desktop] $ ps-C bash pid tty time cmd 3025 pts/0 00:00:00 bash 3123 pts/0 00:00:00 bash ...... [Wang @ localhost desktop] $ pgrep bash30253123 ...... [Wang @ localhost desktop] $ ps-eo pid, cmd e | tail-n 3 // display the environment variable of the process [wang @ localhost desktop] $ kill process no. [wang @ localhost desktop] $ kill-9 process no. // force kill process [wang @ localhost desktop] $ killall process name [wang @ localhost desktop] $ killall-9 process name [wang @ localhost desktop] $ kill % process no. // kill the background running process [wang @ localhost desktop] $ top // dynamically view cpu usage [wang @ localhost desktop] $ watch-n 1-d 'Ps' // update every 1 second-d will show the differences before and after 5. log information/var/log/boot. log system startup information/var/log/httpd Apache Web server log/var/log/messages release kernel startup information/var/log/auth. log user authentication log/var/log/dmesg system startup log var/log/mail. log email server log var/log/Xorg.0.log X server log var/log/wtmp user logon session record [wang @ localhost desktop] $ logger This is a test [wang @ localhost desktop] $ tail-n-1/var/log/messagestail: unable to open "/var/log/messages" to read data: insufficient permission [wang @ localhost desktop] $ su password: [root @ localhost desktop] # tail-n-1/var/log/messagesMar 29 09:39:47 localhost dhclient: bound to 192.168.126.148 -- renewal in 890 seconds. [root @ localhost desktop] # logger This is a test [root @ localhost desktop] # tail-n-1/var/log/messagesMar 29 09:40:11 localhost wang: this is a test [wang @ localhost desktop] $ cat a.txt | wall // write the message Broadcast message from wang (Fri Mar 29 13:48:43 2013) to the terminal of all currently logged on users ): abcdefg 6. system Information [wang @ localhost desktop] $ hostname // The current system host name localhost. wang [wang @ localhost desktop] $ uname-n // Linux kernel version and hardware framework information localhost. wang [wang @ localhost desktop] $ uname-a // kernel version released Linux localhost. wang BRL. 29.4-167. fc11.i686. PAE #1 SMP Wed May 27 17:28:22 EDT 2009 i686 athlon i386 GNU/Linux [wang @ localhost desktop] $ uname-m // host type i686 [wang @ localhost desktop] $ cat/ proc/cpuinfo // processor information [wang @ localhost desktop] $ cat/proc/meminfo // memory information [wang @ localhost desktop] $ cat/proc/partitions // System partition information 7. file query [wang @ localhost desktop] $ which ls // view the executable file location alias ls = 'ls -- color = Auto'/bin/ls [wang @ localhost desktop] $ whereis ls // view the file location ls: /bin/ls/usr/share/man/man1/ls.1.gz/usr/share/man/man1p/ls.1p.gz-B: only find the binary file-m: find only the file-s in the manual path of the instruction File: find only the source file-u: the file [wang @ localhost desktop] $ locate passwd without instructions // is searched in the database. the database is updated once every day. locate: can not stat () '/var/lib/mlocate. db': No such file or directory is located in the database. the database is updated once every day [wang @ localhost desktop] $ whatis lsls [] (1) -list directory contentsls [] (1 p)-list directory contents [wang @ localhost desktop] $ uptime 13:43:00 up 6 days, 5: 25, 5 users, load average: 0.00, 0.00, 0.00
Related Article

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.