View process/memory/disk space in Linux

Source: Internet
Author: User

Address: http://blog.163.com/bobile45@126/blog/static/960619922012542475706/

 

1. The ps command is used to view the currently running process.


Grep is search


Example: PS-Ef | grep Java


Displays information about Java cmd processes in all processes.


PS-Aux | grep Java


-Aux: Show All statuses


PS


2. The kill command is used to terminate the process.


Example: Kill-9 [pid]


-9 indicates that the process is forced to stop immediately.


You can use PS to view the process PID and kill to terminate the process.


[Root @ Linux ~] # Ps aux

User PID % CPU % mem vsz RSS tty stat Start Time Command

Root 1 0.0 0.1 1740 540? S jul25 0: 01 init [3]

Root 2 0.0 0.0 0 0? SN jul25 0: 00 [ksoftirqd/0]

Root 3 0.0 0.0 0 0? S <jul25 0: 00 [events/0]

... Omitted in the middle .....

Root 5881 0.0 0.3 5212 1204 pts/0 s Su

Root 5882 0.0 0.3 5396 1524 pts/0 s bash

Root 6142 0.0 0.2 4488 916 pts/0 r + PS aux

?

? User: which user account does the process belong?

? PID: the number of the process.

? % CPU: Percentage of CPU resources used by the process;

? % Mem: Percentage of physical memory occupied by the process;

? Vsz: virtual memory used by the process (Kbytes)

? RSS: the fixed amount of memory occupied by the process (Kbytes)

? TTY: The process operates on that terminal. If it is irrelevant to the terminal, it will display ?, In addition, the tty1-tty6 is the login program on the machine, if the PTS/0 and so on, it indicates the program connected to the host by the network.

? Stat: the current state of the program. The main states are:

O r: The program is currently in operation or can be operated;

O s: The program is currently in sleep state (idle state !), However, it can be awakened by some signals.

O t: The program is currently detecting or stopping;

O z: The program should have been terminated, but its parent program cannot terminate it normally, resulting in the state of zombie (zombie) program.

? Start: the time when the process is triggered;

? Time: the actual CPU usage time of the process.

? Command: What is the actual command of the program?


1. df command;


DF comes from the coreutils software package and comes with it during system installation. We can use this command to view the disk usage and the location where the file system is mounted;


Example:


[Root @ localhost beinan] # DF-lH


Filesystem capacity in use available % mount point


/Dev/hda8 11g 6.0g 4.4g 58%/


/Dev/SHM 236 M 0 236 m 0%/dev/SHM


/Dev/sda1 56G 22g 35g 39%/mnt/sda1


We can see that the system is installed in/dev/hda8; there is also a 56 GB disk partition/dev/sda1 mounted in/mnt/sda1;


For other parameters, see man DF.




Ii. view memory:


Dmidecode | grep-A16 "memory device $"


Free


View memory usage in Linux

View the result in free-M:


# Free-m

Total used free shared buffers cached

Mem: 1010 963 46 0 172 539

-/+ Buffers/cache: 251 758

Swap: 2047 0 2047




3. View top commands


Top-01:06:48 up, 1 user, load average: 0.06, 0.60, 0.48

Tasks: 29 total, 1 running, 28 sleeping, 0 stopped, 0 zombie

CPU (s): 0.3% us, 1.0% Sy, 0.0% Ni, 98.7% ID, 0.0% wa, 0.0% hi, 0.0% Si

Mem: 191272 k total, 173656 K used, 17616 K free, 22052 K Buffers

Swap: 192772 k total, 0 K used, 192772 K free, 123988 K cached


PID user PR Ni virt res shr s % CPU % mem time + command

1379 root 16 0 7976 2456 S 1980 0.7. 03 sshd

14704 root 16 0 2128 980 R 796 0.7. 72 top

1 root 16 0 1992 632 s 544 0.0. 90 init

2 root 34 19 0 0 s 0.0 0.0. 00 ksoftirqd/0

3 root RT 0 0 0 s 0.0 0.0. 00 watchdog/0



Statistical information area

The first five lines are the overall statistics of the system. The first line is the task queue information, which is the same as the execution result of the uptime command. The content is as follows:


01:06:48 current time

Up system running time, format: minute

1 user current Login User count

Load average: 0.06, 0.60, 0.48 system load, that is, the average length of the task queue.

The three values are the average values from 1 minute, 5 minutes, and 15 minutes ago to the present.


Second and Third, information about the process and CPU. When multiple CPUs exist, the content may exceed two rows. The content is as follows:


Tasks: 29 total process count

1. Number of Running Processes of Running

28 sleeping sleep Processes

0 stopped process count

0 zombie botnets

CPU (s): 0.3% us CPU usage

1.0% Sy CPU usage in kernel space

0.0% percentage of CPU used by processes that have changed their priorities in Ni user process space

98.7% ID idle CPU percentage

0.0% wa CPU time percentage waiting for Input and Output

0.0% hi

0.0% Si

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.