System management commands required for Linux (1)

Source: Internet
Author: User
For Linux systems, whether it is a central processor, memory, disk drive, keyboard, mouse, or user, it is a file. Linux system management commands are the core of its normal operation. After familiarizing yourself with common Linux file processing commands, this section describes the commands for managing systems and users. Df1. the df command is used For Linux systems, whether it is a central processor, memory, disk drive, keyboard, mouse, or user, it is a file. Linux system management commands are the core of its normal operation. After familiarizing yourself with common Linux file processing commands, this section describes the commands for managing systems and users.

Df

1. Role
The df command is used to check disk space usage of the file system. The permission is granted to all users.

2. Format
Df [options]

3. main parameters
-S: the total number of data blocks occupied by each Names parameter.
-A: recursively displays the number of data blocks occupied by each file in a specified directory and its subdirectories. If neither-s nor-a is specified, only the disk blocks occupied by each directory and its subdirectories in Names are displayed.
-K: used to list disk space usage in 1024 bytes.
-X: skipping directories on different file systems is not counted.
-L: calculates the size of all files, and computes hard-linked files multiple times.
-I: displays inode information instead of block usage.
-H: Print out the file system size in an understandable format, such as 136KB, 254 MB, and 21 GB.
-P: Use the POSIX output format.
-T: displays the file system type.

4. description
The df command is widely used to generate statistical data on file systems. it displays information about all file systems in the system, including total capacity, available free space, and current installation points.

When a super-permission user uses the df command, the capacity of a partition exceeds 100%. This is because the Linux system reserves 10% of the space for super users, which is independently controlled by the super users. That is to say, for a super user, the disk capacity he sees will be 110%. This arrangement is advantageous for system management. when the disk capacity is close to 100%, the system administrator can still work normally.

5. application instance
Linux supports many file systems, including JFS, ReiserFS, ext, ext2, ext3, ISO9660, XFS, Minx, vfat, and MSDOS. Run the df-T command to view the disk space and obtain the file system information:

       
        
# Df-T file system type capacity in use % available mount point/dev/hda7reiserfs5.2 G 1.6G 3.7G 30% // dev/hda1vfat2.4G 1.6G 827 M 66%/windows/C/dev/ hda5vfat3.0G 1.7G 1.3G 57%/windows/D/dev/hda9vfat3.0G 2.4G 566 M 82%/windows/E/dev/hda10NTFS 3.2G 573 M 2.6G 18%/windows/F/dev /hda11vfat1.6G 1.5G 23 M 99%/windows/G
       


In addition to the capacity and usage of the disk space, the file system type and mount point of the partition are also displayed at a glance.

Top

1. Role
The top command is used to display the processes in execution. The permission is granted to all users.

2. Format
Top [-] [d delay] [q] [c] [S] [s] [I] [n]

3. main parameters
D: specify the update interval, in seconds.
Q: There are no delayed updates. If a super user exists, the top command is executed in the highest priority order.
C: displays the complete process path and name.
S: the accumulation mode, which accumulates the CPU time of the completed or disappearing sub-itinerary.
S: security mode.
I: No Idle (Idle) or useless (Zombie) itinerary is displayed.
N: displays the number of updates. after the update is completed, the system will exit the top.

4. description
The top command is a major command for Linux system management. it can obtain a lot of information. Here we will describe the information it provides.


Display of top commands

In, the first line indicates the current time, system start time, number of users logged on to the current system, and average load of the project. The second line shows all started processes, currently running, suspended and useless processes. The third line shows the current CPU usage, including the proportion occupied by the system, user usage, and Idle ratio. The fourth line shows the usage of physical memory, including the total available memory, used memory, idle memory, and memory occupied by the buffer. The fifth line shows the swap partition usage, including the total swap partition, used, idle, and cache size. The sixth line displays the largest number of items. the detailed explanations are listed below.
PID (Process ID): Process ID.
USER: the USER name of the process owner.
PR: process priority.
NI: the priority value of the process.
VIRT: virtual memory occupied by the process.
RES: the physical memory occupied by the process.
SHR: the shared memory value used by the process.
S: Process Status. S indicates sleep, R indicates running, Z indicates frozen, and N indicates that the priority of the process is negative.
% CPU: CPU usage occupied by the process.
% MEM: Percentage of physical memory and total memory occupied by the process.
TIME +: The total cpu time occupied by the process after it is started.
Command: The name of the startup Command that the process starts. if this line does not appear, the process has a complete Command line.
Some interactive commands can be used to complete other parameter functions during the use of the top command. These commands are started by using the shortcut key.
<空格> : Refresh immediately.
P: Sort by CPU usage.
T: Sort by time and accumulated time.
Q: exit the top command.
M: Switch to display memory information.
T: Process and CPU status information is displayed during switchover.
C: switch the display command name and the complete command line.
M: Sort by memory size.
W: write the current settings ~ /. Toprc file. This is a recommended method for writing top configuration files.

As you can see, the top command is a powerful tool for monitoring the system, especially for system administrators. However, it consumes a lot of system resources.

5. application instance
The top command can be used to monitor the process of a specified user. by default, the process of all users is monitored. If you want to view the situation of a specified user, press the "U" key in the terminal and enter the user name, the system will switch to the process running interface of the specified user, as shown in.


Use the top command to monitor a specified user

Free

1. Role
The free command is used to display memory usage. The permission is applied to all users.

2. Format
Free [-B |-k |-m] [-o] [-s delay] [-t] [-V]

3. main parameters
-B-k-m: memory usage is displayed in bytes (KB, MB.
-S delay: the number of seconds to display the memory usage.
-T: displays the total memory column.
-O: The buffer adjustment column is not displayed.

4. application instance
The free command is the main command used to view memory usage. Compared with the top command, it is easy to use and only occupies a small amount of system resources. The-S parameter allows you to use the free command to continuously monitor the number of inactive instances. This allows you to use it as a convenient real-time monitor.
# Free-B-s5

With this command, the Slave node continuously reports memory usage (in bytes) and updates every 5 seconds.

Quota

1. Role
The quota command is used to display the disk usage and restrictions, and the super user with the permission is used.

2. Format
Quota [-g] [-u] [-v] [-p] user name group name

3. parameters
-G: displays the disk usage restrictions of the user's group.
-U: displays the user's disk usage restrictions.
-V: displays the distribution of file systems with no space allocated.
-P: display simplified information.

4. application instance
In enterprise applications, the disk quota is very important. common users should learn to understand their own disk usage. To query your disk quota, run the following command (in the following example, the user account is cao133 ):

        
         #quota caojhDisk quotas for user caojh(uid 502): Filesystem blocks quota limit grace files quota limit grace /dev/hda3   58      200000 400000   41   500    1000
        


The preceding shows the caojh account with the ID number 502, and the number of files is set to 500 ~ 1000, hard disk space limit set to mb ~ 400 MB. Once the disk quota is used up, you need to delete some junk files or request an additional quota from the system administrator.

At

1. Role
The at command is used to execute the specified command sequence at the specified time.

2. Format
At [-V] [-q x] [-f file] [-m] time

3. main parameters
-V: Standard error output is displayed.
-Q: Many queue outputs.
-F: reads a job from a file.
-M: After the job is executed, an email is sent to the user.
Time: Set the job execution time. The time format has strict requirements. it consists of the offset of the hour, minute, date, and time. the date format is MM. DD. YY, MM is minute, DD is date, and YY is year. The offset format is time + offset, in the unit of minutes, hours, and days.

4. application instance
# At-f data 15: 30 + 2 days

The preceding command allows the system to execute the job specified in file data at two days later.

Lp

1. Role
Lp is the command for printing files. The permission is granted to all users.

2. Format
Lp [-c] [-d] [-m] [-number] [-title] [-p]

3. main parameters
-C: copy the file before printing it.
-D: print the queue file.
-M: send an email to the user after printing.
-Number: number of printed copies.
-Title: print the title.
-P: set the priority for printing, up to 100.

4. application instance
(1) print multiple files using the lp command
# Lp 2 3 4
Request id is 11 (3 file (s ))

2, 3, and 4 are file names, and "request id is 11 (3 file (s)" indicates that these are 11th print commands, which are printed in sequence.

(2) set the print priority
# Lp-d LaserJet-p 90/etc/aliases

By adding "-p 90", the priority of the print job is set to 90. It will be printed before a print job with a higher priority than 90, including a job without a higher priority. the default priority is 50.

Next we will introduce html "> useradd, groupadd, kill, and other commands.
Related Article

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.