Powerful 10 shell commands

Source: Internet
Author: User
1. View apache concurrent requests and their TCP connection status netstat-n | awk '/^ tcp/{++ S [$ NF]} END {for (ainS) printa, S [a]} '2, displays the 10 processes that consume the most memory/CPU psaux | sort-nk + 4 | tail3, find the 10 most commonly used commands and the number of times sed-e's/|/\ n/G '~ /. Bash_hi 1, view the apache concurrent requests and their TCP connection status
Netstat-n | awk '/^ tcp/{++ S [$ NF]} END {for (a in S) print a, S [a]}'
2. displays the 10 processes that consume the most memory/CPU resources.
Ps aux | sort-nk + 4 | tail
3. Find the 10 most commonly used commands and the number of times of use.
Sed-e's/|/\ n/G '~ /. Bash_history | cut-d ''-f 1 | sort | uniq-c | sort-nr | head
4. lsof command
Displays the files currently opened by the abc process.
Lsof-p 2622
Display what programs are running on port 22
Lsof-I: 22
5. Check whether the network card has a physical connection.
/Sbin/mii-tool
6. view the server serial number
Dmidecode | grep "Serial Number"
7. Check the number of physical CPUs
Cat/proc/cpuinfo | grep "physical id" | sort | uniq | wc-l
View the number of logical CPUs in each physical CPU
Cat/proc/cpuinfo | grep "siblings"

8. view the number of logical CPUs
Cat/proc/cpuinfo | grep "processor"

9. Increase the value of ip_conntrack_max.
Vim/etc/sysctl. conf
Net. ipv4.ip _ conntrack_max = 393216
Net. ipv4.netfilter. ip_conntrack_max = 393216
Reduce ip_conntrack timeout time
Vim/etc/sysctl. conf
Net. ipv4.netfilter. ip_conntrack_tcp_timeout_established = 300
Net. ipv4.netfilter. ip_conntrack_tcp_timeout_time_wait = 120
Net. ipv4.netfilter. ip_conntrack_tcp_timeout_close_wait = 60
Net. ipv4.netfilter. ip_conntrack_tcp_timeout_fin_wait = 120

10. Release the server memory.
To free pagecache, use:
Echo 1>/proc/sys/vm/drop_caches
To free dentries and inodes, use:
Echo 2>/proc/sys/vm/drop_caches
To free pagecache, dentries and inodes, use:
Echo 3>/proc/sys/vm/drop_caches

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.