Vi. Linux/UNIX operating command accumulation [kill, netstat, df, du], netstatdu

Source: Internet
Author: User
Tags disk usage

Vi. Linux/UNIX operating command accumulation [kill, netstat, df, du], netstatdu
In Linux/UNIX, users often use the text interface to set the system or operating system. The author is constantly in touch with this command during his work, therefore, this article has been specially developed, prepared, and started. This article mainly records some of the operating commands you encounter in Linux/UNIX at ordinary times, record and sort them out, one can deepen your impression, and the other can be recorded and shared. We hope that you will give instructions and explanations on inappropriate or ambiguous aspects so that you can learn and improve them together.
[For more information, see http://blog.csdn.net/mahoking]
023 kill command: View and kill Processes

View the ps command used by the process. This example demonstrates the ps-aux command.

-A shows all the programs under the current terminal, including those of other users.

-U displays the program status in user-based format.

-X displays all programs, which are not distinguished by terminals.

A commonly used combination is to use the grep command in the pipeline to filter and find specific processes, and then perform operations on specific processes.

Format:Ps aux | grep program_filter_word

Example:Ps-ef | grep tomcat

Note:Search for tomcat Process Task information.

1 Command Format

Kill [option] format ps [option] PID

2. command functions

The kill command is used to stop a process.

3 common examples

Example 01

Command: kill-9 326

Input:

[Root @ localhostroot] # kill-9 326

Note:

Forcibly stop (often kill) a process with the process ID 326.

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

 

024 netstat command: displays various network-related information

1 Command Format

Netstat [option] format: netstat [option]

2. command functions

The netstat command is used to display various network-related information, such as network connection, route table, Interface Statistics, masquerade connection, and Multicast member (Multicast Memberships.

3 common examples

Example 01

Command: netstat-

Input:

[Root @ localhostroot] # netstat-

Note:

-A (all) shows all options. By default, LISTEN is not displayed.

-N: aliases are not displayed. All digits can be converted to digits.

Extension:

-T (tcp) only displays tcp-related options.

-U (udp) only displays udp-related options.

-I only lists the service statuses that have been listened to by Listen.

 

Example 02

Command: netstat-an | grep 8080

Input:

[Root @ localhostroot] # netstat-an | grep 8080

Note:

Filter and query port 8080.

-A (all) shows all options. By default, LISTEN is not displayed.

-N: aliases are not displayed. All digits can be converted to digits.

 

025 df command: Check disk space occupied by the File System

1 Command Format

Df [option] format df [option]

2. command functions

Displays the available space of the specified disk file. If no file name is specified, the available space of all mounted file systems will be displayed. By default, the disk space is displayed in 1KB. Unless the environment variable POSIXLY_CORRECT is specified, the disk space is displayed in 512 bytes.

3 common examples

Example 01

Command: df

Input:

[Root @ localhostroot] # df

Note:

Displays the disk usage.


Example 02

Command: df-T

Input:

[Root @ localhostroot] # df-T

Note:

Lists the types of file systems.

-T file system type.

Extension:

-H displays the current disk space and usage more easily.

The-H Parameter on the-h root is the same, but in the root mode, 1000 instead of 1024 is used for capacity conversion.

-K indicates the disk usage in units.

-L displays the disk space usage of the local partition. If the nfs server has a remote server disk, add-l to df and the system displays the results after filtering the nsf drive.

 

026 du command: view space used by files and directories

1 Command Format

Du [option] File Format: du [option] File OR Dir

2. command functions

Displays the disk space used by each file and directory.

3 common examples

Example 01

Command: du

Input:

[Root @ localhostroot] # du

Note:

Displays the disk usage.


Example 02

Command: du test. log

Input:

[Root @ localhostroot] # du test. log

Note:

Displays the space occupied by the specified file.


Example 03

Command: du testDir

Input:

[Root @ localhostroot] # du testDir

Note:

Displays the space occupied by the specified directory.


Example 04

Command: du-s testDir

Input:

[Root @ localhostroot] # du-s testDir

Note:

Displays the total space occupied by files in a specified directory.

[For more information, see http://blog.csdn.net/mahoking]

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.