Linux Operations Common commands

Source: Internet
Author: User

Delete a 0-byte file

Find-type f-size 0-exec rm-rf {} \;

View process

Arrange by memory from large to small

PS-E-o "%c:%p:%z:%a" | Sort-k5-nr

Rank from large to small by CPU utilization

PS-E-o "%c:%p:%z:%a" | Sort-nr

Print out the URL in the cache

Grep-r-a jpg/data/cache/* | Strings | grep "http:" | Awk-f ' http: ' {print ' http: ' $ ';} '

View the number of concurrent requests for HTTP and their TCP connection status

Netstat-n | awk '/^tcp/{++$[$NF]}end{for (A in S) print A,s[a]} '

Sed-i '/root/s/no/yes/'/etc/ssh/sshd_configsed the root line in this article, match the root line and replace No with Yes

How to kill the MySQL process

PS aux | grep MySQL | Grep-v grep | awk ' {print $} ' | Xargs kill-9

Killall-term mysqld

Kill-9 ' Cat/usr/local/apache2/logs/httpd.pid '

Take IP Address

Ifconfig eth0 | grep "InetAddr:" | awk ' {print $} ' | Cut-c 6

Ifconfig | grep ' InetAddr: ' | Grep-v ' 127.0.0.1 ' | Cut-d:-f2 | awk ' {print '} '

Number of network Connections

Netstat-an | Grep-e "^ (TCP)" | Cut-c 68-| Sort | uniq-c | Sort-n

Observation of abnormal processes

Top-id 1

Check the total number of open files

lsof | Wc-l

Kill 80-Port related processes

Lsof-i: 80 | Grep-v "PID" | awk ' {print ' kill-9 ', ' $ ' | Sh

Clear Zombie Process

Ps-eal | awk ' {if ($2== "Z") {print $4}} ' | Kill-9

Number of Statistics URL occurrences

awk ' begin{fs= '/'}{arr[$3]++}end{for (i in arr) print arr[i],i} ' list | Sort-r

Linux Operations Common commands

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.