Linux system optimization and condition monitoring

Source: Internet
Author: User

1. View System process commands

Top

After entering can press s plus time, specify how long time to refresh

2. View CPU Information

Cat/proc/cpuinfo

3. View memory Information

Cat/proc/meminfo

4. Clean up Memory: active garbage collection

http://blog.csdn.net/mafuli007/article/details/7573521

Sync

Echo 3 >/proc/sys/vm/drop_caches

Echo 1 >/proc/sys/vm/drop_caches

5. View memory consumption only

Free-m

6. View All Processes

Ps-ef

7. Forcing the end of a process

Kill-9 PID

-9 for Semaphore, detailed search process semaphore

8. View Port Usage

NETSTAT–APN or Netstat-aux

9. Check the usage of the network

Install Iftop, similar to the top command

10. Open Swap

For SSD servers, memory is a little bit better to open swap.

Prepare a swap file first: DD If=/dev/zero of=/swapfile bs=1024 count=512k (bs,block size.)

The DD command is specifically used to copy from one file and format it into another file. This command means reading from the "/dev/zero" file to the/swapfile file, the block size is 1024Byte, a total of k blocks, that is, a total of 512M.

Then set up and open the swap file:

Mkswap/swapfile

Swapon/swapfile

And then execute free-m and you'll see

swap:511 0 511

Description already started

Also configure the default open swap on boot

To edit/etc/fstab, add the following line:

/swapfile None swap defaults 0 0

/etc/fstab is where file system information is stored, and the filesystem is automatically read and loaded from the system when it is started. The first three parameters do not indicate:

The physical location of the filesystem to be mounted (that is, the swap file we created in the previous step), the mount point (OK for swap is set to none), file format (swap format)

Linux system optimization and condition monitoring

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.