Linux Command 3: linux Command

Source: Internet
Author: User

Linux Command 3: linux Command

1. The vmstat command monitors system resources.
[Root @ localhost ~] # Vmstat [Refresh Interval refresh times]

For example: [root @ localhost proc] # vmstat 1 3


2. kernel detection information during dmesg startup

[Root @ localhost ~] # Dmesg

[Root @ localhost ~] # Dmesg | grep CPU

3. Run the free command to check the memory usage.
[Root @ localhost ~] # Free [-B |-k |-m |-g]
Option:
-B is displayed in bytes.
-K: displayed in KB. The default value is KB.
-M: displayed in MB
-G: displayed in GB

Differences between caching and caching
◆ In simple terms, cache is used to accelerate data reading from the hard disk, while buffer is used to accelerate data writing to the hard disk.


4. View CPU Information
[Root @ localhost ~] # Cat/proc/cpuinfo

The proc directory is the memory Mount directory. That is to say, once the power is down, the information stored in this directory will be lost. The/proc/cpuinfo File Stores detailed cpu information, which is detected every time it is started. After detection, the information is written to this file. Once the file is powered off, it will be released.


5. uptime command
[Root @ localhost ~] # Uptime
# Display the system startup time and average load, that is, the first line of the top command. The w command can also see this data.

For example:

[Root @ localhost xiaofeng] # uptime
11:21:48 up, 1 user, load average: 0.00, 0.01, 0.05

6. View System and kernel information
[Root @ localhost ~] # Uname [Option]
Option:
-A: view all related information of the system;
-R: view the kernel version;
-S: view the kernel name.

7. determine the number of digits of the current system
[Root @ localhost ~] # File/bin/ls

For example:

[Root @ localhost xiaofeng] # file/bin/ls
/Bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, buildID [sha1] = 3d705971a4c4544545cb78fd890d27bf792af6d4, stripped

8. query the current Linux system release version.
[Root @ localhost ~] # Lsb_release-

Determine whether the release version is Centos, RedHat, or wubantu.

9. List the files opened or used by the Process
[Root @ localhost ~] # Lsof [Options]
# List information about files called or opened by a process
Option:
-C string: only list files opened by processes starting with a string.
-U User name: only list files opened by a user's Process
-P pid: list files opened by a PID process.

For example:

[Root @ localhost xiaofeng] # ps aux
User pid % CPU % MEM VSZ RSS TTY STAT START TIME COMMAND
Root 1 0.0 0.6 128092 6720? Ss/usr/lib/systemd -- switc
Root 2 0.0 0.0 0 0? S [kthreadd]
Root 3 0.0 0.0 0 0? S [ksoftirqd/0]
Root 5 0.0 0.0 0 0? S <06:33 0: 00 [kworker/0: 0 H]
Root 7 0.0 0.0 0 0? S [migration/0]

Apache 4713 0.0 0.3 224004 3084? S/usr/sbin/httpd-DFOREGROUND

[Root @ localhost xiaofeng] # lsof-p 4713
Command pid user fd type device size/OFF NODE NAME
Httpd 4713 apache cwd DIR 4096 2/
Httpd 4713 apache rtd DIR 4096 2/
Httpd 4713 apache txt REG 507032 556493/usr/sbin/httpd
Httpd 4713 apache mem REG 37352 545169/usr/lib64/libnss_sss.so.2

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.