Some basic Linux commands __linux

Source: Internet
Author: User

Top
======================================
Main parameters
D: Specifies the interval of the update, measured in seconds.
Q: No delayed updates. If the consumer has superuser, the top command executes with the highest precedence.
C: Displays the full path and name of the process.
S: Cumulative mode, which accumulates the CPU time of a completed or missing child stroke.
S: Safe mode.
I: Do not show any idle (Idle) or useless (Zombie) journeys.
N: Shows the number of updates, when completed will exit to
Display parameters:
PID (Process ID): progress indicator number.
User: The username of the process owner.
PR: The priority level of the process.
NI: The priority value of the process.
Virt: The virtual memory value that the process occupies.
RES: The physical memory value that the process occupies.
SHR: The shared memory value that the process uses.
S: The state of the process where s indicates hibernation, R indicates that it is running, Z indicates zombie state, n indicates that process priority is negative.
%CPU: The CPU usage that the process occupies.
%mem: The percentage of physical memory and total memory consumed by the process.
Time+: The total CPU time that was consumed by the process after it was started.
Command: The name of the startup command that the process starts, and if this line does not appear, the process will have a complete command line.
When the top command is in use, you can also use some interactive commands to perform the functions of other parameters. These commands are started by using a shortcut key.
<: Refresh immediately.
P: Sort According to CPU usage size.
T: Sorted by Time, cumulative time.
Q: Exit Top command.
M: Toggle display memory information.
T: Toggles the display of process and CPU state information.
C: Toggle display command name and full command line.
M: Sort based on the size of memory used.
W: Writes the current settings to the ~/.TOPRC file. This is the recommended method for writing the top configuration file.
Another option is Ps-ef | Sort-k7, sort the process by run time, and see which process consumes the most CPU time.


Free
======================================
2. Use
The free command is used to display memory usage, which is used by all users.
2. Format
free [-b-k-m] [-O] [-s delay] [-t] [-v]
3. Main parameters
-b-k-M: Displays memory usage in bytes (KB, MB), respectively.
-S delay: Displays the number of seconds per second to show memory usage.
-T: Displays the memory sum column.
-O: Buffer throttling columns are not displayed.

Uptime
======================================
18:59:15 up min, 2 users, load average:1.23, 1.32, 1.21
Now the time
The time that the system has been powered up to now
Number of users Wired
Last minute, five minutes and 15 minutes of system load
Parameters:-V Displays version information.

Vmstat
======================================
Procs ——— –memory ———-— swap–-–io--–system–--cpu--
R b swpd free buff cache si so bi bo in CS US sy ID WA
0 1 24980 10792 8296 47316 5 19 205 52 1161 698 26 3-1 70
1 Observation of disk activity
Disk activity is mainly understood from the following indicators:
BI: Represents the number of blocks (BLOCKS/S) read from disk per second. The larger the number, the more activity it means to read the disk.
Bo: Represents the number of blocks written to disk per second (BLOCKS/S). The larger the number, the more activity it means to write a disk.
Wa:cpu the percentage of time to wait for disk I/O (pending disk IO). The larger the number, the more serious the file system activity is blocking the CPU, because the CPU is waiting for the slow disk system to provide the data. WA is the ideal for 0. If WA is often greater than 10, the file system may require performance tuning.
2 Observation of CPU activity
Vmstat is more reflective of CPU usage than top:
US: The percentage of time that the user program uses the CPU. The larger the number, the busier the user process is.
SY: The percentage of time the system calls use CPU. Note that NFS is running in the kernel, so the CPU time consumed by the NFS activity is reflected in SY. This number is often very large, you need to pay attention to whether a kernel process, such as NFS task is more onerous. If us and Sy are both large, we need to consider separating some of the user programs from other servers to avoid interacting with each other.
The proportion of ID:CPU idle time.
Wa:cpu the time scale for pending disk IO.

Iostat
======================================
Used to count CPU usage and i/0 of TTY devices, hard drives, and CD-ROMs
Parameters:
-C shows only CPU rows
-D Display Disk line
-k displays disk output in kilobytes
-T include timestamp in output
-X includes extended disk metrics in the output
AVG-CPU:%user%nice%sys%iowait%idle
20.25 0.18 2.61 76.39 0.57
%iowait% CPU idle time while waiting for local I/O
%idle% CPU idle time without waiting for local I/O
Device:tps blk_read/s blk_wrtn/s Blk_read Blk_wrtn
HDA 9.86 284.34 84.48 685407 2036
Total number of transfers per second (TPS), 512-byte block reads per second (BLK_READ/S), 512-byte block writes per second (BLK_WRTN/S), and 512-byte block reads (Blk_read) and writes (BLK_WRTN).

System
======================================
# uname-a # View kernel/operating system/CPU information
# head-n 1/etc/issue # View operating system version
# cat/proc/cpuinfo # View CPU Information
# hostname # View computer name
# LSPCI-TV # list all PCI devices
# LSUSB-TV # list all USB devices
# lsmod # list the loaded kernel modules
# env # View Environment variables

Resources
======================================
# free-m # View memory usage and swap area usage
# df-h # View the usage of each partition
# du-sh # View the size of the specified directory
# grep Memtotal/proc/meminfo # View Total Memory
# grep Memfree/proc/meminfo # View Idle memory
# uptime # View system run time, number of users, load
# cat/proc/loadavg # View System load

Disks and partitions
======================================
# Mount | COLUMN-T # View the partition status of the hook
# fdisk-l # View all partitions
# swapon-s # View all swap partitions
# hdparm-i/dev/hda # View disk parameters (IDE devices only)
# DMESG | grep IDE # View IDE Device detection status at startup

Internet
======================================
# ifconfig # View properties of all network interfaces
# iptables-l # View firewall settings
# route-n # View the routing table
# netstat-lntp # View all listening ports
# netstat-antp # View all connections that have been established
# netstat-s # View Network statistics

User
======================================
# w # View active Users
# ID # view specified user information
# last # View User login log
# cut-d:-f1/etc/passwd # View All users of the system
# cut-d:-f1/etc/group # View all groups of the system
# crontab-l # View scheduled tasks for the current user

Service
======================================
# chkconfig--list # list all system services
# chkconfig--list | grep on # Lists all initiated system services

Program
======================================
# rpm-qa # view all installed software

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.