Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the practical skills in Linux

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "what practical skills are there in Linux". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what practical skills are there in Linux"?

Key points:

① learns to check the various states of linux, including network IO, disk, CPU, memory, etc.

② learns to understand what commands represent and can quickly identify problems in the cluster.

1. Core command

Linux monitors network IO, disk, CPU, memory:

CPU:vmstat, sar-u, top

Disk IO:iostat-xd, sar-d, top

Network IO:iftop-n, ifstat, dstat-nt, sar-n DEV 2 3

Disk capacity: df-h

Memory usage: free-m, top

2. Common commands

(1) memory: number of entries, each size, whether the memory is DDR4 or DDR3, and whether the memory frequency is 2666MT/S or 1600MT/s

Number of entries: dmidecode | grep-A5 'Memory Device' | grep Size | grep-v Installed | wc-l

Size: dmidecode | grep-A5 'Memory Device' | grep Size | grep-v Installed | uniq

Memory type: dmidecode | grep-A16 "Memory Device" | grep 'Type:' | grep-v Unknown | uniq

Memory frequency: dmidecode | grep-A16 "Memory Device" | grep 'Speed' | grep-v Unknown | uniq

(2) hard disk: number of blocks, size

Fdisk-l | grep "Disk / dev/sd"

(3) check what processes occupy the port

Netstat-antp | fgrep

(4) View process resources

Jps-l # get process id

Jmap-heap 21046

(5) number of CPU

Cat / proc/cpuinfo | grep "physical id" | sort | uniq | wc-l

(6) CPU kernels

Cat / proc/cpuinfo | grep "cpu cores" | uniq

(7) CPU dominant frequency

Cat / proc/cpuinfo | grep "model name" | uniq

3. Core command explanation 3.1, ps aux

The ps command is used to view the status of processes on the system

USER PID CPU MEM VSZ RSS TTY STAT START TIME COMMAND

● USER, the user name of the process owner.

● PID, the process number, can uniquely identify the process.

● CPU, the percentage of CPU time and total time spent by the process since it was last refreshed.

● MEM, the percentage of memory used by the process.

● VSZ, the amount of virtual memory used by the process, in K.

● RSS, the total amount of physical memory consumed by the process, in K.

● TTY, the terminal name associated with the process.

● STAT, process status, using (Rmure-run or ready to run; Smure-sleep state; Imure-idle; Zmuri-freeze; Dmurf-uninterrupted sleep; W-process does not reside on pages; T stops or tracks.) These letters denote.

● START, the time when the process starts to run.

● TIME, the total CPU time used by the process.

● COMMAND, the command line being executed.

3.2 、 Top

Top command is a commonly used performance analysis tool under Linux, which can display the resource consumption of each process in the system in real time, similar to the task manager of Windows.

1. The upper part shows the overall system load:

Top line: from left to right is the current system time, the time the system is running, and the average load value of the cpu in the previous 1min, 5min, and 15min.

Tasks line: this line gives the statistical information of the overall process, including the total number of processes in the statistical cycle, the number of running state processes, the number of dormant processes, the number of stopped state processes and the number of dead state processes

Cpu (s) line: overall statistical information of cpu, including cpu time ratio of processes in user mode and processes in system mode, cpu time ratio of processes with nice value greater than 0 in user mode, time ratio of cpu in idle state and wait state, and time ratio of processing hard and soft interrupts

Mem line: this line provides memory statistics, including total physical memory, used memory, free memory, and the amount of memory used as a buffer

Swap line: virtual memory statistics, including total swap space, size of used swap area, size of free swap area, and size of swap space used as cache

2. The second half shows the operation of each process:

PID: process pid

USER: the user who started the process

PR: this column value plus 100is the process priority. If the priority is less than 100, the process is a real-time (real-time) process, otherwise it is an ordinary (normal) process, and the real-time process has a higher priority and easier to obtain cpu scheduling. In the above output, the priority of the java process is 120, which is an ordinary process, the priority of the had process is 2, and the priority RT of the migration process corresponds to 0, which is the highest priority.

NI: the nice priority value of the process. In this column, the nice value of the real-time process is 0, and the nice value of the normal process ranges from-20 to 19.

VIRT: the amount of virtual memory occupied by the process (default unit kB)

RES: the amount of physical memory occupied by the process (default unit kB)

SHR: the amount of shared memory occupied by the process (default unit kB)

S: running status of the process

% CPU:% cpu percentage of processes in the sampling period

% MEM: percentage of memory occupied by processes during the sampling period

Total cpu time used by TIME+: processes

COMMAND: command to pull up the process

1. Don't panic when you encounter problems. According to experience, and then through the command to troubleshoot memory, disk, network, cpu, nothing more than these types of problems, must not be in a hurry to change, so as to complicate simple problems.

2. According to the above orders, set up monitoring and early warning in advance. Monitoring and early warning allows you to find out the performance information of the system in time, such as the disk is almost full and the memory is overloaded, so we can make adjustments in advance.

Thank you for your reading, these are the contents of "what practical skills are there in Linux". After the study of this article, I believe you have a deeper understanding of what practical skills there are in Linux, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report