Linux instructions (3)

Source: Internet
Author: User

Name: sleep
Permission: All Users

Usage: sleep [-- help] [-- version] number [smhd]

Note: sleep can be used to delay the current action for a period of time.

Parameter description:

-- Help: displays auxiliary messages.
-- Version: displays the version number.
Number: the length of time. It can be followed by s, m, h, or d.
S indicates the second, m indicates the minute, h indicates the hour, and d indicates the number of days.

Example:
Display the current time after 1 minute delay, and then display the time again:
Date; sleep 1 m; date


Name: time
Permission: All Users

Usage: time [options] COMMAND [arguments]

Note: The purpose of the time Command is to measure the time consumed and system resources for executing a specific command. Such as CPU time, memory, input and output. Note that some information cannot be displayed on Linux. This is because the allocation function of some resources in Linux is different from the preset method of the time Command, so that the time command cannot obtain such information.

Count

-O or -- output = FILE
Set the output file. This option will write the time output to the specified file. If the file already exists, the system overwrites its content.
-A or -- append
When used with-o, the results are written to the end of the file without overwriting the original content.
-F FORMAT or -- format = FORMAT
Set the display mode using the FORMAT string. If this option is not set, the system preset format is used. However, you can use the environment variable time to set this format, so that you do not have to set it every time you log on to the system.
Generally, you can use

Indicates the jump bar, or use

Line feed. % Is used as the prefix for each item. If you want to use the percent sign in the string, use it. (People who have learned the C language will probably feel familiar with it)
The time command can display four resources:

Time resources
Memory resources
IO resources
Command info

The details are as follows:


Time Resources
E. The time taken to execute the command. Format: [hour]: minute: second. Note that this number does not represent the actual CPU time.
E. The time taken to execute the command, in seconds. Note that this number does not represent the actual CPU time.
The time spent in the kernel mode during the execution of the S command, in seconds.
The time spent in user mode during the execution of the U command, in seconds.
P indicates the CPU usage during command execution. In fact, this number is the core mode plus the CPU time of the user mode divided by the total time.


Memory Resources
The maximum physical memory occupied during M execution. Unit: KB
T average of the physical memory occupied during execution, in KB
K indicates the average size of the total memory occupied by the execution Program (stack + data + text), in KB.
D. Average size of the self-owned data area (unshared data area) of the Execution program, in KB
The average size of the self-owned (unshared stack) p execution program, in KB
X indicates the average value of shared text between execution programs. The unit is KB.
The size of the Z system memory page, in bytes. This is a constant for the same system.


IO Resources
F The number of major Memory Page errors of the program. A major Memory Page error occurs when a memory page has been replaced by a swap file and allocated to other programs. At this time, the content of this page must be read from the replacement file.
R The number of times this program's secondary Memory Page error occurs. The so-called secondary Memory Page error means that a memory page has been replaced by a replacement file but has not been allocated to other programs. At this time, the content of this page is not damaged and you do not have to read it from the replacement file.
W. Number of times this program is switched to the replacement File
C The number of times this program is forced to be interrupted (such as the allocated CPU time used up)
W the number of times this program is voluntarily interrupted (such as waiting for an I/O to be executed, such as disk READING)
I the number of files entered by this program
O number of files output by this program
R Socket Message received by this program
S the Socket Message sent by this program
K Number of signals received by this program


Command Info
C execution parameters and command names
Exit Status)

 

-P or -- portability
This option automatically sets the display format:
Real % e
User % U
Sys % S
This is intended to be compatible with POSIX specifications.
-V or -- verbose
This option will enumerate all resources used in the program, not only for general English statements, but also for instructions. It is quite useful for people who don't want to take the time to familiarize themselves with the format settings or who are just getting started with this command.

Example:
Use the following command
Time-v ps-aux

We can get the results of executing ps-aux and the system resources we spent. See the following information:
User pid % CPU % MEM VSZ RSS TTY STAT START TIME COMMAND
Root 1 0.0 0.4 1096 472? S Apr19 0: 04 init
Root 2 0.0 0.0 0 0? SW Apr19 0: 00 [kflushd]
Root 3 0.0 0.0 0 0? SW Apr19 0: 00 [kpiod]
......
Root 24269 0.0 1.0 2692 996 pts/3 R p.m. ps-aux

Command being timed: "ps-aux"
User time (seconds): 0.05
System time (seconds): 0.06
Percent of CPU this job got: 68%
Elapsed (wall clock) time (h: mm: ss or m: ss): 0: 00. 16
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 0
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 238
Minor (reclaiming a frame) page faults: 46
Voluntary context switches: 0
Involuntary context switches: 0
Swaps: 0
File system inputs: 0
File system outputs: 0
Socket messages sent: 0
Socket messages received ed: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0


Name: uptime
Permission: All Users
Usage: uptime [-V]
Note: The uptime provides the following user information without other parameters:

Current Time
How long has the system been running?
Number of connected users
System load in the last minute, five minutes, and fifteen minutes
Parameter:-V displays version information.
Example: uptime
The result is:
Am up 5 days, 10 min, 1 users, load average: 0.00, 0.00, 1.99

Name: chfn

Permission: All Users

Usage: shell> chfn

Note: users can change personal information for finger and mail username.

Example:

Shell> chfn
Changing finger information for user
Password: [del]
Name []: Johnney Huang ### provide information for finger
Office []: NCCU
Office Phone []: [del]
Home Phone []: [del]


Name: chsh

Permission: All Users

Usage: shell> chsh

Modify user shell settings

Example:

Shell> chsh
Changing fihanging shell for user1
Password: [del]
New shell [/bin/tcsh]: ### [currently used shell]
[Del]

Shell> chsh-l ### display the/etc/shells file content
/Bin/bash
/Bin/sh
/Bin/ash
/Bin/bsh
/Bin/tcsh
/Bin/csh


"Finger [Return]
Name: finger
Permission: All Users

Usage: finger [options] user [@ address]

Note: finger allows users to query information of other users. The following information is displayed:

Login Name
User Name
Home directory
Shell
Login status
Mail status
. Plan
. Project
. Forward

Among them,. plan,. project and. forward are the materials in the user's Home Directory files, such as. plan,. project, and. forward. If not, no. The finger command is not limited to queries on the same server. You can also search for users on a remote server. You only need to give an address like an e-mail address.
Count

-L
Multi-line display.

-S
Single Row display. This option only displays the logon name, real name, terminal name, idle time, Logon Time, office number, and phone number. If the query user is a remote server user, this option is invalid.

Example: run the following command to query the information of the local administrator:
Finger root

The result is as follows:
Login: root Name: root
Directory:/root Shell:/bin/bash
Never logged in.
No mail.
No Plan.

 

Name: last

Permission: All Users

Usage: shell> last [options]

Description: displays the information of the First Login person in each month after the system is started.

Count

-R omitting the field of hostname
-Num: displays the first num.
Username: displays the login information of username
Tty restricted login messages include terminal codes

Example:

Shell> last-R-2
Johnney pts/1 Mon Aug 14 20:42 still logged in
Johnney pts/0 Mon Aug 14 :59 still logged in

Wtmp begins Tue Aug 1 09:01:10 2000 ###/var/log/wtmp


Shell> last-2 minery
Minery pts/0 140.119.217.115 Mon Aug 14)
Minery pts/0 140.119.217.115 Mon Aug 14)

Wtmp begins Tue Aug 1 09:01:10 2000

 

Name: login

This command won't be enough! Haha, I am not here, too much money to delay everyone's beautiful youth. ^_^


Name: passwd

Permission: All Users

Usage: passwd [-k] [-l] [-u [-f] [-d] [-S] [username]

Description: used to change the user's password.

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.