This is bssn's weblog, which is about Bssn's Internet Life, IT information, webmaters and etc.

About Linux commands - 2

Linux commands Daquan (2)

Name: at
Access: all users

Use: at-V [-q queue] [-f file] [-mldbv] TIME

Note: at allows users to specify TIME this particular moment in the implementation of a program or instruction, TIME's format is HH: MM for which the HH-hour, MM for minutes, even you can also specify am, pm, midnight, noon, teatime (16:00 Raymond is) spoken word.

If you want to designate more than one day in time, you can use MMDDYY or MM / DD / YY format, which is minutes MM, DD is the first few days, YY is the year. In addition, users can also use even like now time interval flexibility to the prescribed time, the time interval may be minutes, hours, days, weeks

In addition, users can also specify today or tomorrow to express today or tomorrow. When the appointed time and press enter after, at will enter a chat mode and asked to enter commands or programs, when you enter the latter press ctrl D to complete all action, as for the implementation of the results will be returned to your account in .

To include:

- V: print version number
- q: the use of the designated queue (Queue) to store, at the information is stored in the so-called queue, the user can also use multiple queue, the queue numbers for a, b, c… z and A, B ,… Z total of 52
- m: even if the program / instruction execution after the completion of no output, but also sent letters to users
- f file: read pre-written order file. Users do not necessarily have to use the model to enter talks, first of all the files into the designated first after the first reading
- l: list all the designated (users can also direct the use of atq instead of at-l)
- d: delete specified (users can also direct the use of atrm instead of at-d)
- v: list all have been completed but not yet removed the designated

Examples:
Three days later the implementation of 17:00 Raymond / bin / ls:
at 5pm 3 days / bin / ls

Three weeks after the implementation of 17:00 Raymond / bin / ls:
at 5pm 2 weeks / bin / ls

The implementation of tomorrow's 17:20 / bin / date:
at 17:20 tomorrow / bin / date

In 1999 the last day of last-minute printed the end of world!
at 23:59 12/31/1999 echo the end of world!

Name: cal

Access: all users

Use: cal [-mjy] [month [year]]

Description:

Show calendar. If there is only one parameter, the representative of the year (1-9999), revealed that the calendar year. Year must all write: "cal 89 will not be displayed in 1989 calendar. The use of two parameters, then the month and year. Parameters indicated that if not this month's calendar.
September 1752 to switch to No. 3 from the date of the new Western calendar, because when most of the countries have adopted the new calendar, 10 days was removed, so the month of the calendar a bit different. Prior to this old calendar for the West.

Kuang soliciting

- m: Monday for a week to the first day of show.
- j: to Julian, that is, with effect from 1 January showed that the number of days.
- y: show calendar this year.

Example:

cal: Show this month's calendar.

[root @ mylinux / root] # date
Tue Aug 15 08:00:18 CST 2000
[root @ mylinux / root] # cal
August 2000
Su Mo Tu We Th Fr Sa
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31

[root @ mylinux / root] #

cal 2001: the Year 2001 show calendar.

[root @ mylinux / root] # cal 2001
2001

January February March
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 4 5 6 1 2 3 1 2 3
7 8 9 10 11 12 13 4 5 6 7 8 9 10 4 5 6 7 8 9 10
14 15 16 17 18 19 20 11 12 13 14 15 16 17 11 12 13 14 15 16 17
21 22 23 24 25 26 27 18 19 20 21 22 23 24 18 19 20 21 22 23 24
28 29 30 31 25 26 27 28 25 26 27 28 29 30 31

April May June
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 4 5 6 7 1 2 3 4 5 1 2
8 9 10 11 12 13 14 6 7 8 9 10 11 12 3 4 5 6 7 8 9
15 16 17 18 19 20 21 13 14 15 16 17 18 19 10 11 12 13 14 15 16
22 23 24 25 26 27 28 20 21 22 23 24 25 26 17 18 19 20 21 22 23
29 30 27 28 29 30 31 24 25 26 27 28 29 30

July August September
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 4 5 6 7 1 2 3 4 1
8 9 10 11 12 13 14 5 6 7 8 9 10 11 2 3 4 5 6 7 8
15 16 17 18 19 20 21 12 13 14 15 16 17 18 9 10 11 12 13 14 15
22 23 24 25 26 27 28 19 20 21 22 23 24 25 16 17 18 19 20 21 22
29 30 31 26 27 28 29 30 31 23 24 25 26 27 28 29
30
October November December
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 4 5 6 1 2 3 1
7 8 9 10 11 12 13 4 5 6 7 8 9 10 2 3 4 5 6 7 8
14 15 16 17 18 19 20 11 12 13 14 15 16 17 9 10 11 12 13 14 15
21 22 23 24 25 26 27 18 19 20 21 22 23 24 16 17 18 19 20 21 22
28 29 30 31 25 26 27 28 29 30 23 24 25 26 27 28 29
30 31

[root @ mylinux / root] #

cal 5 2001: the Year Show in May 2001 calendar.

[root @ mylinux / root] # cal 5 2001
May 2001
Su Mo Tu We Th Fr Sa
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31

[root @ mylinux / root] #

cal-m: Monday to the first day of the week, show that this month's calendar.

[root @ mylinux / root] # cal-m
August 2000
Mo Tu We Th Fr Sa Su
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31

[root @ mylinux / root] #

cal-jy: January 1 to the number of days show that this year's calendar.

[root @ mylinux / root] # cal-jy
2000

January February
Sun Mon Tue Wed Thu Fri Sat Sun Mon Tue Wed Thu Fri Sat
1 32 33 34 35 36
2 3 4 5 6 7 8 37 38 39 40 41 42 43
9 10 11 12 13 14 15 44 45 46 47 48 49 50
16 17 18 19 20 21 22 51 52 53 54 55 56 57
23 24 25 26 27 28 29 58 59 60
30 31
March April
Sun Mon Tue Wed Thu Fri Sat Sun Mon Tue Wed Thu Fri Sat
61 62 63 64 92
65 66 67 68 69 70 71 93 94 95 96 97 98 99
72 73 74 75 76 77 78 100 101 102 103 104 105 106
79 80 81 82 83 84 85 107 108 109 110 111 112 113
86 87 88 89 90 91 114 115 116 117 118 119 120
121
May June
Sun Mon Tue Wed Thu Fri Sat Sun Mon Tue Wed Thu Fri Sat
122 123 124 125 126 127 153 154 155
128 129 130 131 132 133 134 156 157 158 159 160 161 162
135 136 137 138 139 140 141 163 164 165 166 167 168 169
142 143 144 145 146 147 148 170 171 172 173 174 175 176
149 150 151 152 177 178 179 180 181 182

July August
Sun Mon Tue Wed Thu Fri Sat Sun Mon Tue Wed Thu Fri Sat
183 214 215 216 217 218
184 185 186 187 188 189 190 219 220 221 222 223 224 225
191 192 193 194 195 196 197 226 227 228 229 230 231 232
198 199 200 201 202 203 204 233 234 235 236 237 238 239
205 206 207 208 209 210 211 240 241 242 243 244
212 213
September October
Sun Mon Tue Wed Thu Fri Sat Sun Mon Tue Wed Thu Fri Sat
245 246 275 276 277 278 279 280 281
247 248 249 250 251 252 253 282 283 284 285 286 287 288
254 255 256 257 258 259 260 289 290 291 292 293 294 295
261 262 263 264 265 266 267 296 297 298 299 300 301 302
268 269 270 271 272 273 274 303 304 305

November December
Sun Mon Tue Wed Thu Fri Sat Sun Mon Tue Wed Thu Fri Sat
306 307 308 309 336 337
310 311 312 313 314 315 316 338 339 340 341 342 343 344
317 318 319 320 321 322 323 345 346 347 348 349 350 351
324 325 326 327 328 329 330 352 353 354 355 356 357 358
331 332 333 334 335 359 360 361 362 363 364 365
366

[root @ mylinux / root] #

Name: crontab
Access: all users

Use:

crontab [-u user] filecrontab [-u user] (-l |-r |-e)
Description:
crontab is used to allow users at a fixed time or fixed interval with the implementation of the program, in other words, which is similar to the user's time-table. - u user is setting the user specified time-table, this premise is you must have its privileges (for example, is the root) can specify the time-table of others. If we do not use - u user, it is said to set your own time-table.

Meals:

- e: the implementation of a text editor to set time-table, keep the text editor is VI, if you wish to use other text editor, the first set VISUAL environment variable to specify the use of that text editor (for example, setenv VISUAL joe)
- r: Delete the current time-table
- l: list the current time-table

Time-table format is as follows:
f1 f2 f3 f4 f5 program

One is that f1 minutes, f2 that hour, f3 a month that the first few days, f4 that month, f5 that one week in the first few days. program to implement the program said.
When f1 * for every minute that the implementation of all program, f2 * for an hour to the implementation of that program, and the remaining analogy when f1 for ab that from the first minute to a section b minutes this time to implement, f2 for ab that from the first to a section b hours to implement, and the remaining for the analogy when f1 * / n n that every minute of the implementation of a time interval, f2 for * / n n said that each hour once a time interval, and the remaining analogy When f1 for a, b, c,… that section a, b, c,… minutes to perform, f2 for a, b, c,… that section a, b, c… hours to implement, and the remaining analogy

Users can also set up first of all the files stored in file, by the way crontab file to set time-table.
Examples:

Per month per day per hour 0 minutes of the implementation of a / bin / ls:
0 7 * * * / bin / ls

In December, the daily 6:00 am to 12:00, once every 20 minutes / usr / bin / backup:
0 6-12/3 * 12 * / usr / bin / backup

Monday to Friday at 5:00 pm each day send a letter to the alex@domain.name:
0 17 * * 1-5 mail-s "hi" alex@domain.name / dev / null 2> & 1 can be.

Name: date
Access: all users

Use:

date [-u] [-d datestr] [-s datestr] [- utc] [- universal] [- date = datestr] [- set = datestr] [- help] [- version] [ FORMAT] [MMDDhhmm [[CC] YY] [. Ss]]

Description:

date can be used to display or set the system date and time, in the display, the user can set the display to the format, a format set to increase, followed by a number of tags, the tags can be used as follows:

Time:

%: Print%
% n: next line
% t: jump grid
% H: hour (00 23)
% I: hour (01 .. 12)
% k: hours (0 .. 23)
% l: hours (1 .. 12)
% M: minutes (00 59)
% p: the local AM or PM
% r: direct show time (12 hours system, the format hh: mm: ss [AP] M)
% s: from January 1, 1970 00:00:00 UTC so far the number of seconds
% S: second (00 .. 61)
% T: direct show time (24 hour)
% X: the equivalent% H:% M:% S
% Z: Show time zone

Date:
% a: a few weeks (Sun.. Sat)
% A: week (Sunday.. Saturday)
% b: the month (Jan.. Dec)
% B: in (January.. December)
% c: directly show the date and time
% d: (01 .. 31)
% D: direct show date (mm / dd / yy)
% h: with the% b
% j: a year in the first few days (001 .. 366)
% m: month (01 .. 12)
% U: 2001 in the first few weeks (00 .. 53) (Sunday for a week on the first day of the case)
% w: the first few days a week (0 .. 6)
% W: 2001 in the first few weeks (00 .. 53) (Monday for a week on the first day of the case)
% x: direct show date (mm / dd / yy)
% y: the final year of double-digit (00.99)
% Y: full year (0000 .. 9999)

If not begin with a plus sign, then to set the time and the time format for MMDDhhmm [[CC] YY] [. Ss], which MM for the month, DD for the day, hh for hours, mm for minutes, CC for Year two previous figures, YY for two years after the figures, ss seconds for the total:

- d datestr: Show datestr in the set time (non-system time)
- Help: show support message
- s datestr: the system set datestr time in the set time
- u: shows the current GMT
- Version: show the version number

Examples:
Show time Tiaoxing, and then shows the current date:
date % T% n% D

Showing the month and the number of days:
date % B% d

Show dates and set the time (12:34:56):
date-date 12:34:56

Note:

When you do not want to appear frivolous 0:00 (for instance, 1999/03/07), you can insert tags - symbols, for instance, date %-H:%-M:%-S will in no time Fenmiao The significance of 0 to remove, like the original 08:09:04 become 8:9:4. In addition, only obtained permission (for example, root) system can be set time.

When you change the identity of the root system of time, please remember to clock-w time to bring the system into the CMOS, so the next time to reboot the system up to date will continue the correct value.

Name: sleep
Access: all users

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

Note: sleep can be used to delay action for some time now

Parameters:

- Help: show support message
- Version: show the version number
number: the length of time, can transfer behind s, m, h, or d
S for the second one, m for minutes, h for hours, d as the number of days

Examples:
Shows the current time delay after one minute, again after the show:
date; sleep 1m; date

Name: time
Access: all users

Use: time [options] COMMAND [arguments]

Note: time for the instructions, measurement is required for the implementation of specific instructions consumption of time and system resources, and other information. For example, the CPU time, memory, input and output, and so on. It is important to note that some information on Linux does not show up. This is because some of the resources on Linux distribution functions and instructions by the time the default mode is not the same as that in time directive unable to obtain such information.

Of the

- o or-output = FILE
The results set the output file. This option will write the output of time specified in the file. If the file already exists, the system will override its contents.
- a or-append
With - o use the results to write the end of the file, and not override the original content.
- f FORMAT or-format = FORMAT
FORMAT string to set display. When this option has not been set, the system will use the default format. But you can use environment variables time to set this format, so each time you log on the system need not be set once.
General settings, you can use
t
Said Tiaolan, or use
n
For that trip. Each of information to use as a precursor percent. If the string used in the percentage of symbols used. (C language of the people would probably think that is very familiar with)
time of resources can command the following four areas, namely:

Time resources
Memory resources
IO resources
Command info

Detailed as follows:

Time Resources
E implementation of directives by the time it takes, the format is: [hour]: minute: second. Please note that this figure does not represent the actual CPU time.
e implementation of directives by the time it takes, is the second unit. Please note that this figure does not represent the actual CPU time.
S instruction execution at the core model (kernel mode) by the time it takes, is the second unit.
U instruction execution when the user mode (user mode) by the time it takes, is the second unit.
P implementation of the directive when the CPU occupancy ratio. In fact, this figure is the core mode with a user mode of CPU time divided by the total time.

Memory Resources
M enforcement entities occupied by the memory of Max. Unit is KB
t occupied by the implementation of physical memory, on average, units are KB
K enforcement procedures occupied by the total amount of memory (stack data text), the average size of the unit is KB
D procedures for the implementation of the District's own data (unshared data area), the average size of the unit is KB
p procedures for the implementation of its own stack (unshared stack), the average size of the unit is KB
X procedures for the implementation of sharing content (shared text), on average, units are KB
Z system memory page size, the unit is byte. On the same system, this is a constant

IO Resources
F this process the main memory in the wrong page number. The so-called main memory error page is already a memory page file replacement to the replacement (swap file), and has been assigned to other procedures. At this point the content of the page from the replacement file must be read out.
R this process of secondary memory error page number. The so-called secondary memory error page is a memory page Although replacement to the replacement file, but not yet allocated to other programs. At this point the content of the page has not been destroyed, not from the replacement file read out
W this process was traded to the replacement of the number of stalls
c This program was forced to interrupt (such as the allocation of CPU time to run out) the number of
w voluntary interruption of this process (such as waiting for an I / O finished, such as disk read, etc.) the number of
I entered this process a few files
O by the output of this process a few files
r this process received by the Socket Message
s this process by sending the Socket Message
k this process signals received by the (Signal) number

Command Info
C implementation of the parameters and command name
x command of the end of the code (Exit Status)

- p or-portability
This option will automatically be set to display format:
real% e
user% U
sys% S
The goal is to specifications and POSIX compatibility.
- v or-verbose
This option will be used in all the programs send the list of resources, not only as ordinary English words, note. Do not want to spend the time to familiarize themselves with formatting or just beginning contact with the people of this directive very useful.

Example:
Use the following instructions
time-v ps-aux

We will be the implementation of ps-aux spent and the results of the system resources. If the information listed below:
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 12:16 0:00 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: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0

Name: uptime
Access: all users use: uptime [-V]
Note: uptime provide users with the following information, no other parameters:

Of the time booting the system after the operation to the present time the number of users connected to the last one minute, five minutes and 15 minutes of the system load parameters:-V show version information.
Example: uptime
The result:
10:41 am up 5 days, 10 min, 1 users, load average: 0.00, 0.00, 1.99

Name: chfn

Access: all users

Usage: shell>> chfn

Description: provide users with personal information changes, for the finger and mail username

Example:

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

Name: chsh

Access: all users

Usage: shell>> chsh

Description: changes users shell set

Example:

shell>> chsh
Changing fihanging shell for user1
Password: [del]
New shell [/ bin / tcsh]: # # # [is the use of the shell]
[del]

shell>> chsh-l # # # show / etc / shells contents of the file
/ bin / bash
/ bin / sh
/ bin / ash
/ bin / bsh
/ bin / tcsh
/ bin / csh

"Finger [back]
Name: finger
Access: all users

Use: finger [options] user [@ address]

Note: finger allows users to query a number of other user information. The information will be listed are:

Login Name
User Name
Home directory
Shell
Login status
mail status
. plan
. project
. forward

One. Plan,. Project and. Forward is in his users in the Home Directory. Plan,. Project and. Forward, such as file information. If not there will be no. finger command is not limited to the same query on the server, can also find a certain remote users on the server. As long as such as to a general E-mail address of the address.
Of the

- l
Multi-line display.

- s
Single show. This option is only display a sign in name, real name, terminal name, idle time, login time, office number and telephone number. If the query of the users are remote server users, this option is invalid.

Example: the following command can query the local administrator of information:
finger root

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

Name: last

Access: all users

Use: shell>> last [options]

Description: Since the start-up display system from the beginning of each month sign in the message

Of the

- R omitted hostname field
display before the num-num -
username display username login message
tty limit sign in the message contained the code terminals

Example:

shell>> last-R -2
johnney pts / 1 Mon Aug 14 20:42 still logged in
johnney pts / 0 Mon Aug 14 19: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 18:37 - 18:40 (00:03)
minery pts / 0 140.119.217.115 Mon Aug 14 17:22 - 17:24 (00:02)

wtmp begins Tue Aug 1 09:01:10 2000

Name: login

This command will not dry out on! Oh, I do not here more we delay a beautiful pen and ink for the youth _ ^ ^

Name: passwd

Access: all users

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

Description: to change the user's password

Parameters:
- k

- l

- u

- f

- d off the user's password for authentication feature, users will be able to log in without a password, only users with root authority be used.

- S shows that users specify the type of authentication password, only users with root authority be used.

[username] designated account name.

Name: who
Right to use the line: all users can use

Use: who - [husfV] [user]

Description: display system in which the user is above that the information contains the user ID, the use of the terminals, even from the other side of the line, on-line time, the sluggish time, CPU usage, movements and so on.

To include:

- h: Do not show title bar
- u: Do not show the user's Action / work
- s: the use of the short format to
- f: Do not show the user's position on the line
- V: show version "

Related Log

Leave a Reply