In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Key words: process View: ps top Monitoring disk Space: mount, df, du Operation data File sort grep Linux File Compression tool: bzip2 compresse gzip zip 4.1.1 process View ps by default only shows programs that belong to the current user running in the current terminal [root@localhost ~] # ps PID TTY TIME CMD 4026 pts/0 00:00:00 bash 4793 pts/0 00:00:00 ps ps itself provides little information, but it has many parameters Can achieve powerful functions the GNU ps command used in linux supports three different command line parameters: 1, Unix type parameter, preceded by a dash 2, BSD type parameter, no dash 3, GNU long argument There are common parameters of the double dash unix type: ps-e ef A shows all processes-f shows a complete list of formats-l displays a long list ps-ef is the most commonly used and useful example: [root@localhost ~] # ps-ef UID PID PPID C STIME TTY TIME CMD root 1 00 20:35? 00:00:07 init [5] root 2 1 0 20:35? 00:00:00 [migration/0] root 3 10 20: 35? 00:00:00 [ksoftirqd/0] root 4 1 0 20:35? 00:00:00 [watchdog/0] root 5 1 0 20:35? 00:00:00 [migration/1] root 6 1 0 20:35? 00:00:00 [ksoftirqd/1] root 7 1 0 20:35? 00:00:00 [watchdog/1] . UID: user responsible for starting the process PID: process ID PPID: parent process ID C: processor utilization of process duration STIME: system time when the process starts TTY: terminal TIME from which the process starts: cumulative CPU time required to run the process CMD: name of the startup program [root@localhost ~] # ps-el if you want to see more information Can l parameter F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD 4 S 010078 0-518-- 00:00:07 init 1 S 0 210-40-0 migrat? 00:00:00 migration/0 1 S 0 3 1094 19-0 ksofti? 00:00:00 ksoftirqd/0 5 S 0 410-40-0 watchd? 00:00:00 watchdog/0 1 S 051 10-40-0 migrat? 00:00: 00 migration/1 1 S 0 6 10 94 19-0 ksofti? 00:00:00 ksoftirqd/1 5 S 0 7 10-40-0 watchd? 00:00:00 watchdog/1 F: kernel assigned to the process system flag s: state of the process (O = running on the processor S = sleep; R = runnable, waiting to run; Z = dead process, process to terminate but parent process not available T = process stopped) PRI: priority of the process, the higher the number, the lower the priority NI: nice value is used to determine the priority ADDR: the memory address of the process SZ: swap the roughly needed swap space for the process WCHAN: the address of the kernel function where the process sleeps BSD type parameter: has a lot in common with the Unix type parameter The most commonly used parameter is [root@localhost ~] # ps l F UID PID PPID PRI NI VSZ RSS WCHAN STAT TTY TIME COMMAND 4 0 3483 1 17 0 1664-Ss+ tty1 0:00 / sbin/mingetty t 4 0 3484 1 18 0 1664-Ss+ tty2 0:00 / sbin/mingetty t 4 0 3485 1 18 0 1664-Ss+ tty3 0:00 / sbin/mingetty t 4 0 3486 1 19 0 1664-Ss+ tty4 0:00 / sbin/mingetty t 4 0 3487 1 20 1664 448-Ss+ tty5 0: 00 / sbin/mingetty t 40 3488 1 21 0 1664-Ss+ tty6 0:00 / sbin/mingetty t 40 3590 3586 150 18372 10400-Rs+ tty7 0:29 / usr/bin/Xorg: 00 4026 4022 150 4912 1520 wait Ss pts/0 0:00 bash 40 3488 4026 17 04456 844-R + pts/0 0:00 ps l the difference is VSZ: the size of the process in memory RSS in KB: physical memory used by the process and not replaced STAT: a status code consisting of two characters indicating the status of the current process, with the first character having the same value as the S output column of type Unix The second character further defines the state of the process: <: the process is running at high priority N: the process is running at low priority L: the process is locked in memory s: the process is the leader of the session l: the process is multithreaded +: the process is running in the foreground 4.1.2 real-time process monitoring ps can only display information at a specific point in time, while the top command can display process information in real time For example, the process trend of swapping in and out in memory, load value, and so on. [root@localhost] # top top-22:32:40 up 1:57, 2 users, load average: 0.07,0.02,0.00 Tasks: 95 total, 2 running, 93 sleeping, 0 stopped, 0 zombie Cpu (s): 3.1%us, 2.9%sy, 0.0%ni, 93.8%id, 0.0%wa, 0.1%hi, 0.0%si, 0.0%st Mem: 1035064k total, 331236k used, 703828k free, 87928k buffers Swap: 2097144k total, 0k used, 2097144k free 145676k cached PID USER PR NI VIRT RES SHR S% CPU% MEM TIME+ COMMAND 3590 root 150 35356 9.9m 5820 S 7.1 1.00 MEM TIME+ COMMAND 36.91 Xorg 4022 root 150 17m 10m R 4.1 1.70 gnome-terminal 3733 root 150 39848 11m 7664 S 0.3 1.1 0V 1.06 metacity 3828 root 150 16904 4080 3188 S 0.3 0.1.71 gnome-screensav 6867 root 18 02300 1080836 R 0.3 0:00. 14 top 1 root 18 0 2072 660 568 S 0.0 0.10 init 2 root RT-5000 S 0.0 0.00: 00.35 migration/0 3 root 34 19 00 S 0.0 0.00: 00.00 ksoftirqd/0 4 root RT-5000 S 0.0 0.00: 00.00 watchdog/0. The first line: the number of users logged in at the current time when the system is running normally the average load of the system includes three values, which are 1-minute average load, 5-minute average load, and 15-minute average load. The higher the value, the greater the system load. it is common for short-term activity to push up the 1-minute average load, but a high 15-minute average load indicates that the system may be in trouble. The average load value depends on the hardware configuration of the system and the programs running in it. This value has different effects on different systems, but generally speaking, if the average load value is higher than 2, the system tends to be busy. The second line: general process information: how many processes are running, sleeping, stopped, dead (have finished running, but the parent process did not respond) the third line: CPU general information fourth and fifth line: the remaining information of the system memory status is similar to the output of the PS command. By default, top sorts programs according to the value of% CPU However, it is possible to change the program behavior by pressing the interactive command in the top operation b to enable the important data in the table to display in bold z display color l to switch between a single CPU and symmetric Muutiprocessor (SMP) state F to select fields to sort the process m toggle MEM and SWAP information line display k kills a specific process Q to exit the top command dhands to change the update time (default is 3 seconds) u displays a specific user's Process w writes the current settings to the configuration file. 4.1.3 stopping processes-requires root user or process owner Linux to follow the interprocess communication method in Unix. In Linux, various processes use signals to communicate with each other. Process signals are predefined information that processes can identify. Processes can choose to ignore it or respond. Most well-written applications can receive standard Unix process signals and respond to them. Linux process signal: signal name describes 1HUP pending 2INT interrupt 3QUIT stop running 9KILL forced termination 11SEGV segment violation 15TERM condition termination 17STOP forced stop but not terminated 18TSTP stop or pause, but continue to resume execution of kill and killall commands after running 19CONTSTOP or TSTP in the background can send process signals to running processes kill commands send signals to relevant processes according to PID By default, the kill command sends a TERM (15) signal to the process to tell the process to stop running, but the request is likely to be ignored when the process gets out of control. Other signals (name or signal number) can be specified by using the parameter-s when enforcement measures are required. Example: [root@localhost ~] # kill 4302 [root@localhost ~] # kill-s 9 4302 [root@localhost ~] # kill-2 4532 [root@localhost ~] # kill QUIT 4597 killall can stop the process according to the process name, and it also allows the use of wildcards, which is very useful for systems that deal with errors. However, you must be careful when using it, otherwise it can easily cause important system processes to stop accidentally and damage the file system. [root@localhost ~] # killall gnome-terminal
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.