LESSON-12 Course Notes

Source: Internet
Author: User

One, w commandfunction:
  • Used to display a list of users who have logged on to the system and to display instructions that the user is executing.  Execute this command to know who is currently logged in to the system, and what program they are executing. The Execute W command alone displays all users, and you can also specify the user name to display information about only one user.
Options:
-
h does not print header information - u ignores user name when displaying current process and CPU time - s uses short output format -F to show where users log in from
Example:
20:39:37 up 136 days, 3:58, 1 user, Load average:0.00, 0.00, 0.00 (Average load) user TTY from [email protect Ed] IDLE jcpu PCPU what root pts/0 222.94.97.122 20:39 1.00s 0.00s 0.00s w
Second, uptime commandfunction: How long the print system has been running and the average load on the system. The information that the uptime command can display is, in turn:now time, the system has run time, the current number of logged on users, the system 1, 5, 15 minutes of the average loadExample: Uptime15:31:30 up 127 days, 1 user, Load average:0.00, 0.00, 0.00average load: The average number of processes running in a queue during a specific time intervalif the current number of active processes per CPU core is not greater than 3, then the performance of the system is good.   If the number of tasks per CPU core is greater than 5, then there is a serious problem with the performance of this machine. If the Linux host is a 1-core CPU, when load Average is 6, it means the machine is fully used. third, top commandfunction: Real-time dynamic view of the overall operation of the system, is a comprehensive multi-party information monitoring system performance and operational information of the utility tool. By default, the CPU is sorted by. Options:
- B in batch mode operation -C Display full command- D screen Refresh interval -I ignore failure process - s Secret mode - s cumulative mode -i set Interval - u Specify user name - p specifies the number of times that the process-N loop is displayed
Top Interactive Commands
h Display Help screen, give some short command summary instructions k terminate a process I ignore idle and zombie process, this is a switching command q exit program R reschedule a process priority s switch to cumulative mode s to change the delay time between two refreshes, which is 5S by default. f Add or remove items from the current display o change the order in which items are displayed L Toggle display of average load and start-up time information m Toggle Display memory Information T Toggle display of process and CPU status information C Toggle Display command name and full command line M sort based on resident memory size P based on CPU usage percent size process sort T Sort by Time process W writes the current setting to the ~,. TOPRC file
Example:
09:44:56 up to
21:23, 1 user, load average:9.59, 4.75, 1.92 tasks:145 Total, 2 running, 143 Sleepi Ng, 0 stopped, 0 zombie Cpu (s): 99.8%us, 0.1%sy, 0.0%ni, 0.2%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st mem:41478 88k Total, 2493092k used, 1654796k free, 158188k buffers swap:5144568k Total, 56k used, 5144512k free, 2013180k C ached
top-09:44:56[current system time] days[System has been running for 16 days] 1 user[users current login] Load average:9.59 4.75 1.92[system load, the average length of the task queue] tasks:145 total[total number of processes] 2 running[of running processes] 143 sleeping[The number of sleep processes] 0 stopped[of stopped processes] 0 zombie[number of freeze processes] CPU (s): 99.8%us[user space occupied CPU percentage] 0.1%sy[Kernel Space consumption CPU percentage] 0.0%ni[CPU Percentage of processes that have changed priority within the user process space] nice-20 0.2%id[Idle CPU percentage] 0.0%wa[% CPU time waiting for input and output] 0.0%hi[] 0.0%st[] mem:4147888k total[Total physical memory] Total physical memory used by 2493092k used[] 1654796k free[Total free Memory] 158188k buffers[as the amount of memory in the kernel cache] swap:5144568k total[swap area Total] Total swap area used by 56k used[] 5144512k free[Total idle swap area] 2013180k cached[Buffered swap area total],   TOP-BN1: Exit after direct run
iv. vmstat Commandrole: Vmstat means to display virtual memory status (Vsan Memor statics), but it can report on the overall operating state of the system, such as process, memory, I/O, etc.Options:
-a display active inside page -F Displays the total number of processes created after startup- m display slab information - n header information only once - s displays event counters and memory status in tabular format - d report disk status -P Displays the specified hard disk partition status -S output information units
Parameters
Event Interval: status information refresh Interval : Number of times the report was displayed
Example:
Vmstat 3 procs-----------Memory-------------Swap-------io------System-------CPU----- r b swpd free buff cache si so bi bo in CS us sy ID WA St 0 0 0 952092 10236 38704 0 0 3 0 0 © 0 0 0 0 0 952084 10236 38704 0 0 0 0 5 7 0 0 0 0 0 0 0 952084 10236 38704 0 0 0 0 5 6 0 0 0 0 0 0 0 952084 10236 38704 0 0 0 0 6 8 0 0 0 0 0 0 0 952084 10236 38704 0 0 0 0 5 6 0 0 0 0 Field Description Proc (process) *r: The number of processes in the running queue, which can also be used to determine if the CPU needs to be increased. (longer than 1) *b: Number of processes waiting for IO memory (RAM) *SWPD: Using virtual memory size, if the value of SWPD is not 0, but Si, so has a long value of 0, does not affect system performance *free: Free physical Memory size *buff: The amount of memory used as a buffer *cache: As the memory size of the cache, if the cache value is large, it indicates that the number of files in the cache, if the files are frequently accessed by the cache, then the disk IO bi will be very small Swap *si: Writes from the swap area to the memory size per second, and the disk is transferred into memory. Swapped in from disk *so: The amount of memory written to the swap area per second, transferred from memory to disk swapped io (now the size of the Linux version block is 1kb) *bi: Number of blocks read per second block received from a block device *bo: Number of blocks written per second block sent to a block device when a random disk reads and writes, the larger the two values, the larger the CPU's IO wait value can be seen . System *in: Number of interrupts per second *cs: Number of context switches per second CPU *us: Percentage of user Process execution time, when the value of us is higher, indicates that the user process consumes more CPU time, but if it is used over a long period of 50%, then the optimizer algorithm should be considered or accelerated *sy: Percentage of kernel system Process execution times (System time) when the value of SY is high, it indicates that the system kernel consumes more CPU resources and needs to check the cause *wa:io wait Time percentage when the value of WA is high, the IO Wait is more serious, possibly due to a large number of random accesses to the disk, or a disk bottleneck *id: Percentage of idle time
File:
/proc/meminfo
/proc/stat
/proc/*/stat
v. PS Commandfunction:
The
PS command in Linux is the abbreviation for process status. The PS command is used to list the processes currently running on the system. The PS command lists a snapshot of the current process, which is the process at the moment the PS command is executed. If you want to display process information dynamically, use the top command
Status:
1. Run R (running or waiting in the running queue) 2. Interrupt S (dormant, blocked, waiting for a condition to form or receive a signal) 3. Non-interruptible D (Received signal does not wake up and cannot be carried out, process waits until interrupt occurs)  /c3>4. Zombie Z (The process has been terminated, but the process descriptor exists until the parent process calls WAIT4 () after the system call is released )5. Stop T (the process stops running after receiving a signal such as Sigstop)< Priority high N priority low L Hyper-thread L lock + run on front
Parameters:
a Show All processes -a show All programs under the same terminal -a show All processes C show the real name of the process - n Reverse Select E to display environment variables F Show the relationship between programs I ignore case R shows the current terminal's process T shows all processes of the current terminal u Specify all processes of the user au display more detailed information -elf Show All process information, display command line aux shows that there are currently many programs in memory AXJF list programs like program tree display
Example:
PS aux USER PID%cpu%MEM VSZ RSS TTY STAT START time COMMAND root 1 0.0 0.0 10348 588? Ss 0:22 init [3] Root 2 0.0 0.0 0 0? s< 1:48 [migration/0] Root 3 0.0 0.0 0 0? SN 0:01 [ksoftirqd/0] Root 4 0.0 0.0 0 0? s< 1:39 [MIGRATION/1] Root 5 0.0 0.0 0 0? SN 0:01 [KSOFTIRQD/1] %cpu:cpu Resource Percentage %MEM: Percent physical memory VSZ: Virtual memory (Kbytes) RSS: Fixed amount of memory TTY: The operating terminal, if unrelated to the terminal, is displayed? , pts/0 programs that connect to the host network
Liu, PstreeVii. free-m/-g VIII, Netstat IX, Ulimit-n 10, SAR   

LESSON-12 Course Notes

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.