Linux operation and Maintenance

Source: Internet
Author: User

Read Catalogue

    • 1. View the System kernel version
    • 2. View System Information
    • 3. View disk space usage
    • 4. View Memory
    • 5. View the number of CPU cores
    • 6. View System Load
    • 7. View the process
    • 8. View Port occupancy
Back to Top1. View the system kernel version
$cat/etc/6.2 (Santiago) Kernel \ r   on an \m

Displays the system name (Red Hat Enterprise) and the kernel version (Release 6.2)

The file/etc/issue is a text file which contains a message or system identification to be printed before the login prompt .

Back to top of 2. viewing system Information
Uname-3.19.  0-25-generic #26~14.04.  £ ºi686 i686 i686 gnu/linux       

Uname-a: Displays the system name, the node name, the operating system's release number, the operating system version, the machine ID number of the running system

Back to top of 3. View disk space usage
$DF-hlfilesystem            Size  used Avail use% mounted on/dev/xvda1            100G  5.0G   90G   6%/1%/dev/shm     

Parameters:

    • -H: Easy to read
    • -A: List of all file systems

View file, directory size

Du                 #列出本目录下, the size of the directory (the default count unit is k)du-h filename     #以更易读的方式显示所查文件/ directory size du-dirname # To view the total size of a directory dirname    

sudo du-h--max-depth=1

Back to top of 4. View Memory

A. Free command

Free-m       total used free            shared    buffers     cachedmem:                 3072  26241913     

Line 2nd:

Total Memory: 3072 "Note the unit is m, you can use the parameter-hm more prominent"
Used number of memory used: 2459
Free Memory Number: 612
GKFX is currently obsolete. No, always 0.
Buffers:buffer Cache Memory: 207
Cached:page Cache Memory: 2803

Relationship: total = used + Free

Line 3rd:
The meaning of -/+ Buffers/cache :
-buffers/cache Memory: 447 (equals 1th row of used-buffers-cached)
+buffers/cache Memory: 2624 (equals 1th line of Free + buffers + cached)
Note: The amount of memory here is a little bit out of size after calculating it with the above formula (you don't know what the reason is).

Summary:-buffers/cache reflects the memory that is actually eaten by the program , and +buffers/cache reflects the total amount of memory that can be appropriated .

Back to top of 5. To view the number of CPU cores
# total number of cores =Number of physical CPUs × number of cores per physical CPU # Total Logical CPUs =Number of physical CPUs x number of cores per physical CPU X number of hyper-threads # View the number of physical CPUscat/proc/cpuinfo| grep  "physical Id "| sort| uniq| WC-l# See the number of cores in each physical CPU (that is, the number of nuclei) cat/proc/cpuinfo| grep  "CPU cores "| uniq# View the number of logical CPUs cat/proc /cpuinfo| grep  "processor "| wc-l             
Back to top of 6. View System Load
::min,  0.05  
    • Current Time 15:41:09
    • Time the system has been running 42min
    • Current users online 2 user
    • Average load: 0.54, 0.40, 0.20, last 1 minutes, 5 minutes, 15 minutes system load

What is the system load?
The average system load is defined as the number of average processes running in a queue during a specific time interval . If a process meets the following criteria, it will be in the run queue:

    • It is not waiting for the results of the I/O operation
    • It does not actively enter the waiting state (that is, "Wait" is not called)
    • Not stopped (ex: waiting to be terminated)

In general, the current number of active processes per CPU core is not greater than 3, the system performance is good! Of course, it is said that each CPU core, that is, if the host is a quad-core CPU, then as long as the uptime the last output of a string of characters less than 12 means that the system load is not very serious. Of course, if you reach 20, it means that the current system load is very serious and it is very slow to open the execution web script

Back to top of 7. View process

Kills all processes that contain a worker

'{print $}Kill-9  
Back to top of 8. View Port occupancy
Netstat-anp

Or

Netstat-nltup

Parameters

    • -A (All) displays all options and does not show listen related by default
    • -T (TCP) displays only TCP-related options
    • -U (UDP) displays only UDP-related options
    • -N refuses to display aliases, showing all numbers converted to numbers.
    • -l list only service status in Listen (listening)
    • -P Displays the program name that establishes the associated link
    • -R display routing information, routing table
    • -e display extended information, such as UID, etc.
    • -S statistics according to each protocol
    • -C executes the netstat command every other fixed time.
    • Hint: The status of listen and listening can only be seen with-a or-l

Linux operation and Maintenance

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.