Free for Linux Command System Management

Source: Internet
Author: User
Tags disk usage

The following describes the 60 required Linux commands that must be mastered by new users. If you have mastered these commands, your technology will be greatly improved, we hope that the technology will be greatly improved after reading this article.

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: The memory usage is displayed in KB and MB respectively.
-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
After using this command, the memory continuously reports the memory usage in bytes. The memory is updated 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 ):
# Quota cao.pdf
Disk quotas for user caoloud (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) Use the lp command to print multiple files
# 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.
Click "60 required Linux commands (9)" below to continue viewing.

The following describes the 60 required Linux commands that must be mastered by new users. If you have mastered these commands, your technology will be greatly improved, we hope that the technology will be greatly improved after reading this article.

The following is an article titled 60 required Linux commands 8.

Useradd
1. Role
The useradd command is used to create a user account and create a user's starting directory. The permission is a Super User.
2. Format
Useradd [-d home] [-s shell] [-c comment] [-m [-k template] [-f inactive] [-e expire] [-p passwd] [-r] name
3. Main Parameters
-C: add the remarks text. The remarks text is saved in the remarks column of passwd.
-D: Specify the start directory when the user logs on.
-D: Change the default value.
-E: Specifies the validity period of the Account, which is permanently valid by default.
-F: specifies the number of days after the password expires.
-G: Specifies the group to which the user belongs.
-G: Specify the additional group to which the user belongs.
-M: automatically creates a user's logon directory.
-M: do not automatically create a user's logon directory.
-N: cancel the creation of a group named by the user name.
-R: Create a system account.
-S: Specifies the shell used after the user logs on.
-U: Specifies the user ID.
4. Description
Useradd can be used to create a user account. It is the same as the adduser command. After the account is created, use passwd to set the account password. The account created using the useradd command is actually saved in the/etc/passwd text file.
5. Application Instance
Create a new user account and set the ID:
# Useradd caow.u 544
It should be noted that when setting the ID value, try to be greater than 500 to avoid conflict. After Linux is installed, some special users are created. Generally, the value between 0 and 499 is left to system accounts such as bin and mail.
Groupadd
1. Role
The groupadd command is used to add a new group to the system.
2. Format
Groupadd [-g gid] [-o] [-r] [-f] groupname
3. Main Parameters
-G gid: Specifies the group ID.
-O: The group ID is allowed. It does not need to be unique.
-R: ID of the group to be added, which is lower than the 499 SYSTEM account.
-F: When you join an existing group, the development program exits.
4. Application Instance
Create a new group and set the group ID to the system:
# Groupadd-g 344 cquota
In this case, a group IDGID is generated in the/etc/passwd file. The project is 344.
Kill
1. Role
The kill command is used to stop a process.
2. Format
Kill [-s signal |-p] [-a] pid...
Kill-l [signal]
3. Parameters
-S: Specifies the sent signal.
-P: analog transmission signal.
-L: Name List of the specified signal.
Pid: ID of the process to be aborted.
Signal: indicates the Signal.
4. Description
Process is a very important concept in Linux. Linux is a multi-task operating system that often runs multiple processes at the same time. We don't care about how these processes are allocated, or how the kernel manages the allocation of time slices. We care about how to control these processes so that they can serve users well.
Linux
The operating system includes three different types of processes, each of which has its own characteristics and attributes. An interactive process is a process started by a Shell. Interactive processes can run either on the foreground or on the background.
The batch processing process is a process sequence that is not associated with the terminal. Processes started when the Linux system is started and run in the background. For example, httpd is famous
The monitoring process of the Apache server.
The kill command works by sending a system operation signal to the Linux kernel.
And the process ID of a program, and then the system kernel can operate on the process specified by the process ID. For example, in the top command, we can see that the system runs many processes and sometimes needs to use kill.
Stop some processes to improve system resources. When explaining the installation and login commands, I mentioned that the role of multiple virtual consoles in the system is to switch to other virtual consoles when a program error causes a system deadlock.
This program. In this case, the command is kill, because kill can be directly called by most internal Shell commands.
5. Application Instance
1) Forcibly stop a process that is often killed.) process with the process ID 324:
# Kill-9 324
2) Remove the deadlock in Linux
In Linux
A program crashes and is in a deadlock state. In this case, you do not need to restart the computer. You only need to stop (or close) the problematic program. When
When kill is on the X-Window interface, the main program (except the crashed program) is generally started normally. Open a terminal and stop the problematic program there. For example, if
The Mozilla browser program is locked. You can use the kill command to abort all programs containing the javasolla browser. First, use the top command to investigate the PID of the program. However
Then run the kill command to stop the program:
# Kill-SIGKILL XXX
XXX indicates the process ID of the program with the Mozolla browser.
3) use commands to recycle memory
We know that memory is very important to the system. memory recovery can improve system resources. The kill command can be used to abort programs that are out of track or do not have the corresponding programs for a long time. For example, if you use the top command to find a useless (Zombie) process, you can use the following command:
# Kill-9 XXX
XXX is a useless process ID.
Run the following command:
# Free
The available memory capacity is increased.
4) killall command
In Linux, A killall command is also provided to directly use the process name instead of the process ID number. For example:
# Killall-HUP inetd

We hope the above Linux commands will help you.

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.