bash shell command (c)

Here Insert Picture Description
PID: Process ID program, TTY: running Terminal TIME CMD: CPU time the process has used
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
UID: user-initiated process.
PID: Process process ID.
PPID: parent process ID
C: CPU utilization process life cycle.
STIME: system time when the process started
TTY: system time when the process starts
TIME: Cumulative CPU time required for the running process.
CMD: name of the program to start.
Those columns after the -l parameter extra.
 F: kernel allocated to the process mark.
 S: state of the process (O representing the running; S represents sleep; R & lt representative may run, awaiting operation; the Z representative of rigid, but the process has ended the parent process does not exist; T represents a stop).
(The lower the number the greater the representatives of priority) the priority of processes:  PRI.
 NI: humility value is used to determine the priority of participation.
 ADDR: memory address of the process.
 SZ: If the process is swapped out, the size of the space required for the exchange substantially.
 WCHAN: address of the kernel function of the process is sleeping.
Here Insert Picture Description
Here Insert Picture Description
 VSZ: size of the process in memory, in kilobytes (KB) units.
 RSS: Process physical memory is not swapped out when occupied.
 STAT: represents the current state of the process of two-character status code.
Here Insert Picture Description
Here Insert Picture Description
-Forest parameters: displays hierarchical information process, and draw the icon to track the child and the parent with ASCII characters.
ps command is used to collect information on processes running on the system.
Weaknesses: It can display information on a particular point of time. If you want to observe trends that memory processes frequently be swapped out with the ps command is not convenient.

Real-time monitoring process

top command: display real-time process information. In general, if the system load exceeds the value of 2, indicating that the system is busy.
 PID: ID process.
 USER: process belongs to the Lord's name.
 PR: process priority.
 NI: humility value process.
 VIRT: total amount of virtual memory occupied by the process.
 RES: the total amount of physical memory occupied by the process.
 SHR: Total amount of memory and other processes sharing.
 S: state of the process (D representative may interrupt the sleep state, R represents the operating state, S for sleep state, T representative of the tracking state or the stopped state, Z for rigid state).
% CPU: the proportion of CPU time used by the process.
% MEM: Percentage of the memory used by the process of accounting for the available memory.
 TIME +: the total amount of CPU time since the process started so far.
 COMMAND: process corresponding to the command-line name, which is the name of the program started.

end process

Linux follows the Unix method for interprocess communication.
In between Linux, the process of signal communication. Signal process is a pre-defined message, the process can identify and decide to ignore it or respond. How to deal with the process signal is determined by the developer programmatically. Most well-written programs can receive and process the standard Unix process signals.
Here Insert Picture Description
PID can only kill command with the process.
Here Insert Picture Description

TERM signal is the process might stop running. -s parameter specifies the support of other signals. (Signal name or signal value) Here Insert Picture Description
to check the kill command is valid, you can re-run the ps or top command to see if the issue process has stopped.

killall command support through the process name and a wildcard, in the system due to overload useful and becomes very slow.
Here Insert Picture Description
Here Insert Picture Description

Monitoring Disk Space

Mount storage media:
Linux file system will incorporate all of the disks under a virtual directory. Before using the new storage media, it needs to be put under virtual directory. This work is called the mount (mounting).
Most Linux distributions will automatically mount certain types of removable storage media. Removable storage media means that can be easily removed from the PC media, such as CD-ROM, floppy disk and U disk.
Manually mount and unmount removable storage media. By default, mount command outputs a list of currently mounted on the system unit.
Mount $
Mount command provides the following four pieces of information:
 media device file name
 media to mount to the virtual directory mount point
 file system type
 mounted access state media

mount -t vfat / dev / sdb1 / media / disk
manually U disk / dev / sdb1 mount / media / disk, the latter two parameters define the location of the storage device file and the device mount point in the virtual directory s position.
Here Insert Picture Description
Here Insert Picture Description
-o parameter allows you to add some extra options separated by commas in the file system is mounted.
 ro: mount as read-only.
 rw: Mount read-write form.
 user: allows ordinary users to mount file systems.
 check = none: integrity check is not performed when mounting a file system.
 loop: mount a file.
umount command
to remove a mobile device when available, can not be removed from the system directly from the Linux system, and should be uninstalled.
Here Insert Picture Description
umount [directory | device]

Use the command df

View all mounted disk usage. df command displays data for each of the mounted file system.
Here Insert Picture Description
Command output is as follows:
device file locations  device;
 number of blocks of 1024 byte size to accommodate;
 number has been used for 1024-byte block size;
 how many 1024-byte block is available;
 used proportion of space occupied;
 device on which to mount the mount point.
Here Insert Picture Description
$ df -h with M, G bytes instead display more readable.
Here Insert Picture Description

Use the du command

du command displays a particular directory (default is the current directory) disk usage. This method can be used to quickly determine a directory on the file system is not oversized.
By default, du command displays the current directory of all the files, directories and subdirectories disk usage, it will indicate the unit of disk blocks of each file or directory taking up much storage space.
Each line of output value left is the number of disk blocks occupied by each file or directory.
 -c: Displays the total size of all the files listed.
 -h: size of the user read by the format of the output, i.e. with alternative kilobytes K, with M megabytes Alternatively, a guitar G alternative word
section.
 -s: Displays the total output of each parameter.

Sort sort command data

By default, sort order will be executed numeric characters as a standard character sort.
$ sort -n file name ** - n parameters will be identified as the digital numbers rather than character **, andSort by value.
-m, three-character month name recognition, monthly sort.
Here Insert Picture Description

Data search: grep command

g r e p number according to Culture Matter name in lose Enter or Finger set of Culture Matter in check Find package Contain Animals Match Finger set mold formula of word symbol of Row g r e p of lose Out on Yes package Contain The Animals Match mold formula of Row lose Out Do not Animals Match That mold formula of Row v grep to find the data file name contains characters that match the specified pattern in the input or the file specified in the line. grep output line is to include a matching pattern. Output line does not match the pattern, can be added -v parameter. grep -v data file name
if you want to display the line number where the matching pattern, you can add the -n option.
If you only knew how many rows containing the matching mode available -c parameter.
To specify a plurality of matching patterns, can be used to specify the parameters of each mode -e.
Here Insert Picture Description
This example of an output all the rows containing character or characters of f t.
Here Insert Picture Description
Regular Expressionsin square brackets indicate grep shouldsearch for include t or f characterto match. If you do not have a regular expression,
grep will search for matching text strings of tf

gzip on Linux is the most popular compression tool.
gzip command compresses your files specified on the command line. You can also specify multiple file names on the command line even with wildcards to
time bulk compressed files.
Here Insert Picture Description

Data archiving: tar command

tar function [options] object1 object2
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
list the contents of a tar file test.tar (but not extract file).
Here Insert Picture Description
Extract content from the tar file in test.tar. If the tar file is created from a directory structure that the entire directory structure is recreated in the current directory.
tar command is a convenient way to create an archive of the entire directory structure.
Here Insert Picture Description

summary

ps and top command determination system state and consumes resources.
mount command to mount the virtual directory structure manually physical storage device, umount command to remove the device
sort order sort
grep to quickly retrieve the data file where the
tar archive the entire directory tools into a single file for easy data migration.

Published 22 original articles · won praise 13 · views 40000 +

Guess you like

Origin blog.csdn.net/qq_44710568/article/details/105012435