Linux Learning notes more bash shell commands

Source: Internet
Author: User
Tags disk usage

A monitoring procedure

1.ps

Output a lot of information about all programs running on the system

Running the PS command will also open a process

By default, the PS command displays only the processes that are part of the current user running under the current console.

UNIX-style parameters (single dash)

-E Show All processes

-F displays output in full format

-H Displays the process in a hierarchical format (tree, used to display the parent process)

PPID: Process number of the parent process

TTY: Terminal equipment at process start-up

C: CPU utilization in the process life cycle

S: The state of the process (0 is running; s is dormant; R is operational; Z is rigid, that is, the process has ended, the parent process is unresponsive or no longer exists; T stop)

PRI: The priority of the process (the larger the number represents the lower the priority)

NI: Humility, to participate in decision-making priorities

The hierarchical tree display of the PS command (-h) is useful when locating out-of-control processes or tracking which userid or terminal these processes belong to.

BSD-style parameters (no dashes)

STAT: A two-character status code representing the current process state

GNU parameter (double dash)

2. Real-time monitoring process

Top

The PS command can only display information at a specific point in time

Top is used to observe trends in the process of frequent swapping out of memory

The first line shows the current time, the operating time of the system, the number of users logged in, the average load on the system (last 1 minutes, 5 minutes, 15 minutes).

The most recent 1-minute load is very common, but if the average load of 15 minutes is high, there may be a problem with the system.

In general, if the load value of the system exceeds 2, the system is busy.

The second line shows the process information for the profile

The next line shows the CPU information. Top divides CPU utilization into several types of output based on the owner (user or system) of the process and the state of the process (running, idle, or waiting).

The latter two lines describe the state of the system memory

PR: Priority of the process

VIRT: Total amount of virtual memory consumed by the process

RES: Total amount of physical memory consumed by the process

SHR: Total amount of memory shared by processes and other processes

3. End Process

The KILL command accepts 9 signal values or signal names to end the process, and the process needs to specify a PID

Killall support to end a process with a process name rather than a process number

II Monitoring disk space

1.mount

Mount Storage Media

Before using the new storage media, you need to put it in the virtual directory.

Linux regards the device as a special file called a device file

The-o parameter allows you to add some additional comma-delimited options when mounting the file system. (Loop mounts a file, not a device)

The mount command can use the-o parameter to attach an. iso file directly to a Linux virtual directory.

Mount-t Iso9660-o Loop Mepis-kde4-live-dvd_32.iso mnt

Umount

Uninstalling the device

Umount support for specifying which devices to uninstall via device files or mount points

If any program is using a file on the device, the system will not allow it to be uninstalled.

If the command line prompt is still in the file system structure of the mounted device, you cannot uninstall the device file

The lsof command can obtain process information for using a device file, stop the process, and then uninstall the device file

Df

Used to view the usage of all mounted disks

The Linux system has a process in the background that processes files or uses files. The output value of the DF command shows the current value that is considered by the Linux system. It is possible that a running process on the system has created or deleted a file, but the file has not been released, and this value is not counted as idle space.

Du (A quick way to determine if a directory on your system has a large file size)

Used to display disk usage for a specific directory (by default, the current directory)

Three-process data files

1.sort

Sort commands

-n the number is recognized as a number, not a character

-M sort by month

-K Postion1[,postion2] sort starting from Position1, if Postion2 is specified, ends at postion2 location

-t specifies a character to distinguish the key position

Pipe Command (|) redirects the output of the previous command to the latter command (see post-learning notes)

2.grep

Search data

grep looks in the input or in the file you specify to find the line that contains the characters that match the specified pattern

The output of grep is a row that contains a matching pattern

grep can also reverse-search (outputs rows that do not match the pattern)

Support for regular expressions

3 compressing data

Bzip2

Gzip

Zip

4 Archive data

Tar

(Detailed parameters in the later parameter details of the comprehensive table)

Linux Learning notes more bash shell commands

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.