Linux Common Utility Commands

Source: Internet
Author: User

viewing disks

Df-h

View the size of the file folder under the current directory.

Du-sh *

viewing system CPUs

Top then press "1": you can see how many nuclear CPUs there are

Free-m See how much memory there is.

View 2743 thread-occupied handles

/usr/sbin/lsof-p 2743

/usr/sbin/lsof-p 2743 |grep del |wc-l: 2743 process-related modules contain the number of Del characters.

WC is statistic

-L is how many lines-C is containing the number of characters

View the number of threads in the system that occupy the handle. and the corresponding thread number

/usr/sbin/lsof-n|awk ' {print $} ' |sort|uniq-c |sort-nr|more

View detailed information for a thread number.

Ps-aef|grep 24204

File store path without release handle

Log on Cd/proc with root privileges

LS displays a directory of all current process number names

Find the corresponding process to enter

CD FD

Ls

The flash is a file marked as deleted.

Cause there is no release handle: The thread opens the file. Another thread deletes the file. will appear to the problem. Kill the Dour process to free all handles.

grep error stdout.log |more-c view error log

grep ERROR stdout.log.*-C

Get the port that a thread occupies

netstat-anp| grep 13755

Query whether a port is occupied

netstat-a | grep 14444

You can log in root with Isysearch users. (specially added function)

sudo su-root

Login to MySQL

Mysql-u username-p

VI does not support the input of Chinese.

WORKAROUND: In ESC state: Set Encoding=utf-8

But can only be used in the current window.

To be effective, users need to reuse the household directory

Vim. VIMRC

Type set Encoding=utf-8

View Host Uname-a

Reboot reboot the machine.

Look at the pressure tool thread Ps-ef|grep JM

View the number of files under a folder, including those in subfolders.

Ls-lr|grep "^-" |wc-l

View the number of folders under a folder, including those in subfolders.

Ls-lr|grep "^d" |wc-l

The-i option of grep indicates that case is ignored

VI Jump to the last line]

VI jumps to the first line [[

VI jumps to the beginning of $

VI jumps to the end of the line ^

Df-m is shown in M

Df-h is shown in G

Folder Links

Ln-s/home/support/nosql_data Nosql_data #nosql_data指向其他目录

Delete

RM Nosql_data

Show line numbers when viewing files

NL a.txt

Modify folder Owner

Chown–r Username/dir dozen dir to username users

View Disk IO

Vmstat 1 100

Ll-t sorted by latest time

Pass the variables in SSH to the script for addition to the calculation. can have decimals.

a=2

B=4

echo $a, $b |awk-f "," ' {Print $1/$2} '

Pass the result of the script to the variable in SSH (included with ' number)

l10= ' grep ' $TODAY ' $FILE _path_stroe_get|wc-l '

Show host all restrictions

Ulimit-a

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.