Linux entry commands to improve work efficiency



DF command

It is used to view the status information of Linux file system and display the capacity, used amount, unused amount, mount point and other information of each partition. For example:

DF – K displays the information of each partition in kilobytes (KB);

DF – a displays all partitions, including those with size 0;

DF – t displays the partition type (ext2 or ext3, etc.).

This command is very convenient to check the partition usage, and it doesn’t need to go to disk management at all. One day, I found that a file copy failed. DF once I saw it, oh, there was no space.

Du command

DF to check the partition capacity, there must be a command to view the file size information. Yes, it is the Du command. Used to view the size of a file or folder. For example:

Du – B / home displays the size of each subfolder under the “/ home” folder in bytes;

Du – KS home displays the total size of the “/ home” folder in kilobytes (KB);

Ls can also get the file size, but LS is not Du so convenient.

Top command

God, I suddenly found that the computer response was very slow. What the hell happened. Then the top command comes. Top is used to view system status information in real time. After running this command, the following information will be displayed on the screen:


CPU states: including user process occupancy ratio, system process occupancy ratio, user’s nice priority process occupancy ratio and idle CPU resource ratio;

Memory status (MEM): including total memory, usage, idle, etc;

Swap status: including the total number of swap partitions, usage, idle capacity, etc;

Status of each process: including process ID, user name, priority, CPU and memory usage, as well as the command line executed when running the process;

After executing the top command, the system will automatically refresh the status information every 5 seconds. If you want to specify the refresh interval, add the “- D” parameter at startup. For example:

Top – D 1 starts top and refreshes every 1 second.

After entering top, press the following buttons to have corresponding functions:

[space] refresh the display information immediately;

【M】 Sort by memory usage;

【N】 Sort by process ID;

【P】 Sort by CPU usage;

【c】 Expand the command line information to display the complete command line;

【?】 Display help information;

【q】 Exit the top program.

Iostat command

Similarly, iostat is also a command to display system information. It counts and outputs CPU usage information and IO information of specific devices or partitions. For example:


Iostat – C only displays CPU usage statistics;

Iostat – d only displays the statistical information of equipment / partition usage;

Iostat -d 2 counts the usage of devices / partitions and refreshes them every 2 seconds;

In the IO statistics displayed, each part is described as follows:

The number of IO transfer requests received by TPS device per second;

Blk_ The number of blocks read in by the read / s device per second;

Blk_ Number of blocks written by wrtn / s device per second;

Blk_ The total number of blocks read in by the read device;

Blk_ The total number of blocks written by the wrtn device;

The meaning of each part of the CPU statistics displayed is the same as that of top.

Today, let’s talk about these four very easy-to-use commands. Other very efficient commands, such as grep, find, locate, readelf and so on, are more powerful. We will introduce them one by one later. If readers have any common and very good commands, they can also leave messages. We will collect them together and experience the efficient work efficiency under Linux.