Linux instruction

zhaozj2021-02-16  74

Linux instruction

table of Contents

Name: Cat 3

Name: CD. 3

Name: chmod. 3

Name: chown. 4

Name: CP. 5

Name: CUT 5

Name: find. 6

Name: LESS. 7

Directive Name: Ln. 7

Name: Locate. 8

Name: ls. 9

Name: mv. 10

Name: rm .. 10

Name: RMDIR 10

Name: Split 11

Name: Touch. 11

Name: AT 12

Name: CAL 13

Name: crontab. 16

Name: Date. 17

Name: Sleep. 18

Name: Cat

Use permission: All users

How to use: cat [-abeensttuv] [--help] [--Version] FileName

Description: Connect the file to the basic output (screen or plus> filename to another)

parameter:

-n or --Number is similar to the number of rows numbers -b or --number-nonblank and -n of all outputs, but it encounters two consecutive years for blank lines. The blank line above is changed to the blank line of the line - V or --Show-Nonprinting

example:

CAT-N TextFile1> TextFile2 Plus TextFile1 file content After adding the line number, enter the textfile2. Cat -b textfile1 textfile2 >> TextFile3 adds the file content of TextFile1 and TextFile2 (blank line does not add) to TextFile3

Name: CD

Use permission: All users

How to use: CD [DIRNAME]

Description: Transform work catalog to Dirname. The DiRName representation can be an absolute path or relative path. If the directory name is omitted, transform to the user's Home Directory (that is, the directory where Login is located).

In addition, "~" is also expressed as HOME DIRECTORY, "." Means the current directory, ".." indicates the current directory of the current directory location.

Example: Jump to / usr / bin /:

CD / usr / bin

Jump to your own home Directory:

CD ~

Jump to the upper two layers of the current directory:

Cd ../ ..

Name: chmod

Use permission: All users

How to use: chmod [-cfvr] [--help] [--version] mode file ...

Description: Linux / UNIX file access rights are divided into three levels: file owners, groups, others. Using CHMOD how to control the file is accessed by others.

parameter:

Mode: Permissions Set strings, formats are as follows: [Ugoa ...] [[ - =] [RWXX] ...] [, ...], where u indicates the owner of the file, G represents The owner of the file belongs to the same group (group), o represents the other people, and a means that these are all.

Represents increased permissions, indicates cancellation, = indicates unique setting permissions.

R indicates that readable, W represents written, x represents executable, X represents only when the file is a subdirectory or the file has been set to be executed.

-c: If this file authority does have changed, it will display its change action.

-f: If this file authority cannot be changed, do not display an error message-V: Details show permission change

-R: The same permissions change (ie, by a recursive way to all files) - Help: Display auxiliary description

--Version: Display version

Example: Set the file file1.txt to everyone can read:

CHMOD UGO R File1.txt

Setting the file file1.txt can be read:

CHMOD A R File1.txt

Set the file file1.txt and file2.txt to this file owner, which is written with its own same group, but other people cannot be written:

CHMOD UG W, O-W File1.txt File2.txt

Set the ex1.py to only the file owner can perform:

CHMOD u x ex1.py

Set all the files and subdirectories in the current directory to anyone read:

CHMOD -R A R *

In addition, CHMOD can also use numbers to express permissions such as CHMOD 777 file.

Grammatical: chmod abc file

Where A, B, C are each number, which represents USER, Group, and Other permissions.

R = 4, w = 2, x = 1

To RWX attribute 4 2 1 = 7;

To RW-attribute 4 2 = 6;

To R-X attribute 4 1 = 7.

example:

CHMOD a = rwx file

with

Chmod 777 file is the same

CHMOD UG = RWX, o = X File

with

Chmod 771 File effect

If you use CHMOD 4755 FileName, this program has root permissions

Name: chown

Use permission: root

How to use: chown [-cfhvr] [--help] [--version] user [: group] file ...

Description: Linux / UNIX is multi-person multi-work industry, all of which have owners. Use Chown to change the owners of the file. In general, this instruction only is used by the system administrator (root), and the general user has no permissions to change someone else's file owner, and there is no permission to change the owner of its own files to others. Only the system administrator (root) has such permissions.

Parameters:

User: User IDGroup: New Archive owner's user group (group) -c: If the owner does have changed, it displays its change action.

-f: Do not display error messages if the owner cannot be changed

-h: Only for linking (LINK), not the LINK true pointing file

-v: Details showing owner changes

-R: Make the same owner change as all files in the current directory (that is, changed by one by one)

--help: Display auxiliary instructions

--Version: Display version

Example:

Set the owner of the file file1.txt to the User Group User Jessie:

Chown Jessie: Users file1.txt

Set all the files in the current directory with the owner of the subdirectories Lamport:

Chown -r Lamport: users *

Name: CP

Use permission: All users

Use mode:

CP [options] Source Dest

CP [Options] Source ... Directory

Description: Copy a file to another, or copy several files to another directory.

Parameters: 

-a will copy the file status, permissions and other materials as much as possible.

-r If the Source contains a directory name, the files in the directory are also copied to the destination. -f If the destination already has the same file, it is deleted before the replication is removed.

example:

Copy the file aaa (already existing) and name BBB:

CP AAA BBB

Copy all C language to the finished subdirectory:

cp * .c finished

Name: CUT

Use permission: All users

Usage: cut-cnum1-num2 filename

Description: Shows the text that counts Num1 to Num2 from the beginning.

example:

Shell >> Cat Example

TEST2

this is test1

Shell >> Cut -c0-6 example ## print starts the first 6 words

TEST2

THIS I

Name: find

Usage: find

Instructions for use :

List of files that comply with Expression in the archive system. You can refer to a combination of different information such as the name, category, time, size, permissions, etc., only fully matched.

Find determines the Path and Expression on the following rules, first on the command - (), the previous part is PATH, after which is Expression. If PATH is a empty string, use the current path, if expression is the empty string, use -print as the preset expression 

There are more than two or thirty options that can be used in Expression, which only introduces the most commonly used part.

-mount, -xdev: Only check and specify files under the same archive system, avoid listing files in other archives systems.

-AMIN N: Readed in the past N minutes

-anewer file: Archives read later than files File

-Atime N: Files read in N days in the past

-cmin N: Modified in the past N minutes

-cnewer file: file updated than file file

-ctime N: Archives in the past N days

-empty: Empty Archive - GID N or -Group Name: GID is n or group name is Name

-ipath p: -path p: The path name is compliant with the file, IPath will ignore the case

-Name Name, -iname name: The file name is compliant with the file. INAME will ignore cases

-Size N: The file size is N unit, b represents the block of the 512-bit group, c represents the number of words, and k indicates that kilo Bytes, W is two bit yuan groups. -type C: The file type is C file.

D: Directory

C: Dictionary device file

B: Block device file

P: Total list

F: general file

l: Symbol connection

S: socket

-PID N: Process ID is the file

You can use () to separate the arithmetic, and use the following operations.

EXP1 -AND EXP2

! expr

-Not EXPR

EXP1 -OR EXP2

EXP1, EXP2

example:

List of all extended files in the current directory and its subdirectory is C.

# Find. -name "* .c"

List all the general files in its underlying directory therefrom # find. -Ftype f

List of all files updated in the current directory and its subdirectory # Find. -Ctime -20

Name: Less

Use permission: All users

Use mode:

Less [option] FileName

Description: The role of Less is very similar to more, can be used to browse the text file, the difference is that the LESS allows the user to scroll back to browse the already seen part, and because the Less does not read at the beginning The entire file, so when you encounter a large file, it will be fast than the general instrument editor (such as VI). example:

Directive Name: LN

Use permission: All users

Use mode:

ln [options] Source Dist,

Where the Option is:

[-BDFINSVF] [-S backup-suffix] [-V {numbered, existing, simple}]

[--help] [--version] [-]

Description:

In the Linux / UNIX archive system, there is a so-called link, we can treat it as an alias of the file, and the link can be divided into two types: hard link (hard link) and soft link, hard link It means that a file can have multiple names, while the soft link is to produce a special file, and the content of this file is to another file. Hard links are in the same archive system, while soft links can span different archive systems.

The LN Source Dist is a link (dist) to SOURCE, as for the use of the hard link or soft link, is determined by the parameter.

Whether it is a hard link or soft link, it will not copy a copy of the original file, and will only take a very small amount of disk space.

-f: The file will first delete the file with the DIST: Allow the system administrator hard link to your directory -i: When deleting the file with the DIST, I'm inquiry -N: In progress When the soft link, the Dist is treated as a general file-S: Symbolic link -V: The file name is displayed before the connection - B: Backup of files that will overwrite or deleted during the link - S Suffix: Plus backup files with SUFFIX's word-V Method: Specify the way backup - HELP: Display auxiliary instructions --Version: Display version

Example:

Generate a Symbolic Link: ZZ with the file yy

Ln -s yy zz

Generate a Hard Link: ZZ with the file yy

ln yy xx

Name: Locate

Use permission: All users

How to use: Locate [-q] [-d] [--Database =]

Locate [-r] [--Regexp =]

Locate [-qv] [-o] [--output =]

Locate [-e] [-f] <[- l] [-c]

<[- u] [-u]>

Locate [-VH] [--Version] [--help]

Description:

Locate allows users to quickly search for the specified file in the archive system. Its method is to build a database including all file names and paths in the system, and then only query this database when looking for, without having to go deep into the archive system. In a general distribution, the establishment of the database is placed automatically in the contab. General users use as long as used

# locate your_file_name's model is OK.

parameter:

-u

-U

Establish a database, -U will start by the root directory, and -U can specify the starting location.

-e

Will exclude the range of findings.

-L

If it is 1. Start safe mode. In safe mode, the user will not see the file that is not available. This will slow down because Locate must obtain the permission information of the file in the actual archive system.

-f

Except for a specific archive system, for example, we have not reached the tool in the Proc archive system in the database. -Q

Quiet mode does not display any error messages.

NN

At most displayed output.

-r

Use the regular operation to do the conditions for finding.

-o

Specifies the name of the information inventory.

-d

Specify the path to the database

-H

Display auxiliary message

-V

Show more messages

-V

Display program version message example:

LOCATE chDRV: Looking for all files called ChDRV

Locate -n

100 a

.out: Looking for all files called A.out, but only 100

Locate -u: Establish a database

Name: LS

Use permission: All users

How to use: ls [-ALRTAFR] [name ...]

Description: Displays the contents of the specified working directory (list the files and subdirectories included in the current working directory).

parameter:

-a Displays all files and directories (LS demonstrates the file name or directory name "." will not be listed as hidden files.

-L In addition to the file name, the file type, authority, owner, and file size is also detailed.

-r Displays the file in the opposite order (originally in the order of English)

-t lists the priorities of the file according to the establishment time

-A, but not listed "." (Current directory) and ".." (parent directory)

-F adds a symbol after listed by the file name; for example, the executable is added "*", the directory is added "/"

-R If there is a file in the directory, the following files are also listed.

example:

List all the names in the current working directory, the beginning of the beginning, and the more advances are reached:

Ls -ltr S *

List all directories and file details below / bin directory:

Ls -lr / bin

List all files and directories under the current working directory; directory is added later, "/", can perform files after adding "*":

LS -AF

Name: more

Use permission: All users

How to use: more [-dlfpcsu] [-num] [ / pattern] [ linenum] [filenames ..]

Description: Similar to CAT, it will make the user's page-by-page reading at a page, and the most basic instruction is displayed in the next page of the blank key (Space). Press the B button to go back (Back) One page shows, and also has the function of searching strings (similar to VI), in use, press H.

Parameters: -num number displayed

-d Tips, display [Press Space to Continue, Q to Quit.] below the screen, if the user presses the wrong button, [Press H for instructions.] is displayed instead of beep.

-l cancels the function of meeting special character ^ l (paper feed characters)

When calculating the number of lines, the number of rows after the actual line (some single lines will be expanded to two or more lines)

-p does not display each page in a rolling manner, but first cleared the screen and then display the content.

-C is similar to -p, different is to display content and then clear other old materials.

-S When you encounter a blank line with two consecutive lines, it is changed to the blank line of a line.

-u does not display the lower quotation marks (different depending on the termage specified by the environment variable TERM)

/ Seally the string (Pattern) before each file is displayed, then start displaying from the string NUM from the Nth Num row

Filenames can display the file file, can be multiple numbers

example:

More -s testfile Displays the file content of TestFile, if there is a row, the blank line is displayed in a row of blank lines.

More 20 Testfile starts the contents of Testfile from the 20th line.

Name: MV

Use permission: All users

Use mode:

MV [Options] Source Dest

MV [Options] Source ... Directory

Description: Move a file to another, or move several files to another.

Parameters: -i If the destination already has the same name file, first ask if the old file is overwritten.

example:

Rename the file AAA as BBB:

MV AAA BBB

Move all C language programs to the finished subdirectory:

mv -i * .c

Name: RM

Use permission: All users

How to use: rm [options] name ...

Description: Delete files and directories.

parameter:

-i before the deletion, please ask for confirmation one by one.

-f even if the original file property is set to read, it is also directly deleted without one by one.

-r Detects the directory and below.

example:

Delete all C language program files; ask one by one before deleting confirmation:

Rm -i * .c

Delete all files in the Finished subdirectory and subdirectory:

RM -R finished

Name: RMDir

Use permissions: All users with appropriate permissions in current directory

How to use: rmdir [-p] DIRNAME

Description: Delete empty directories.

Parameters: -P is that when the subdirector is deleted, it will also be deleted by the way.

example:

Delete the subdirectory named AAA in the working directory:

RMDir AAA

In the BBB directory in the working directory, delete the subdirectory called TEST. If the Test is deleted, the BBB directory is empty, then BBB is also deleted. RMDIR -P BBB / TEST

Name: split

Use permission: All users

How to use: split [option] [INPUT [prefix]]

Description:

Split a file into several files. From the INPUT division output into a fixed-size file, its file name is prefixaa, prefixab ...; prefix preset value `x. If there is no input file or `-, you will be read from the standard input.

parameter:

-b, --Bytes = Size

The size value is the size of each output file, and the unit is BYTE.

-C, --Line-bytes = size

In each output, the maximum number of BYTEs in a single line.

-L, --Lines = Number

The Number value is the size of the column size of each output.

-Number is the same as -l number.

--verbose is printed before each output file is opened, and the quoted information is printed to the standard error output.

--Help Displays the auxiliary information and then leave.

--Version lists the published items and then leave.

Size can join the unit: b represents 512, K represents 1k, M represents 1 meg.

example:

Postgressql Large Data Library Backup and Recycling:

Because Postgres allows the form to have a largest capacity of your system file, it is possible to have problems with table dump to a single file, and Split is used to divide. % PG_Dump DBNAME | SPLIT -B

1M

- filename.dump.

Reload

% CreatedB DBName

% cat filename.dump. * | PGSQL DBNAME

Name: Touch

Use permission: All users

Use mode:

Touch [-ACFM]

[-r reference-file] [--file = reason "File]

[-t mmddhhmm [[cc] yy] [. ss]]

[-d Time] [--DATE = TIME] [--Time = {Atime, Access, Use, Mtime, Modify}]

[--NO-CREATE] [--help] [--version]

File1 [file2 ...]

Description:

Touch command changes the time record of the file. LS -L can display the time record of the file.

parameter:

a Changing the read time record of the file.

m change the modification time record of the file.

C If the purpose file does not exist, it will not establish a new file. Like -No-Create.

F is not used, is to retain to compatibility with other UNIX systems.

r Use the reference file time record, like the effect of thefile.

D Setting time and date, you can use a variety of different formats.

T Time Record of the file is set, the format is the same as the DATE instruction.

--NO-CREATE does not establish a new file.

--Help lists the instruction format.

--Version lists this message.

example:

The simplest way of use, change the file when you record the time. If the file does not exist, a new file will be established.

Touch file

TOUCH file1 file2

Change the time record of File to

5

month

At 18:3:39, 2,000 years. Time format can refer to the Date directive, at least you need to enter MMDDHHMM, which is the time of months and minutes.

Touch -c -t 05061803 file

Touch -c -t 050618032000 file

Change the File time record into ReferenceFile.

Touch -R ReferenceFile File

Change the time record of File to

5

month

At 18:3:39, 2,000 years. Time can be used in AM, PM or 24-hour format, and other formats can be used in other formats such as 6 May 2000.

Touch -d "6:03 pm" file

Touch -d "

05/06/2000

"File"

Touch -d "6:03 PM

05/06/2000

"File"

Name: AT

Use permission: All users

How to use: At -V [-q queue] [-f file] [-mldbv] Time

Description:

AT allows the user to specify a certain number or instruction at Time, Time's format is HH: mm in the HH of HH, MM is minutes, or you can also specify AM, PM, Midnight, Noon, Teatime. It is 4 pm. If you want to specify the time in more than a day, you can use mmddyy or mm / dd / yy format, where mm is minute, DD is the day, yy refers to the year. In addition, the user can even use the NOW time interval to elastic designation time, where the interval can be Minutes, Hours, Days, Weeks; additionally, the user can specify Today or Tomorrow to represent today or tomorrow. When the time is specified and press Enter, the AT will enter the conversation mode and ask for input instructions or programs. When you press CTRL D, press Ctrl D to complete all the actions, as for the result of the execution, will be sent back to your account . Parameters:

-V: Print Publication No.

-q: Use the specified column (queue) to store, the data of the AT is stored in the so-called queue, and the user can use multiple queue at the same time, and the number of Queue is A, B, C ... Z, and A 52 in total, B, ... Z

-m: If there is no output result after the program / instruction is executed, it is also necessary to send a letter to the user.

-f file: Read the pre-written command file. Users do not have to use the conversation mode to enter, first write all the specified first to the file again, once again

-l: List all specified (users can also use ATQ directly without AT -L)

-d: Delete design (can also use ATRM directly without AT -D)

-v: list all specified that has been completed but has not been deleted

Example:

5 pm after three days of execution / bin / ls:

AT 5PM 3 days / bin / ls

5 pm after three weeks of performed / bin / ls:

AT 5PM 2 Weeks / Bin / LS

Tomorrow's 17:20 execution / bin / date:

At 17:20 Tomorrow / BIN / DATE

The last day of 1999 printing the end of world!

AT 23:59

12/31/1999

Echo the end of world!

Name: CAL

Use permission: All users

How to use: CAL [-MJY] [MONTH [YEAR]]

Description:

Display calendar. If there is only one parameter, it represents the year (1-9999), showing the annual calendar. It must be written in the year: `` Cal 89 / will not show the calendar of 1989. Use two parameters, indicating the month and year. If there is no parameter, this month's calendar is displayed. September 3rd on September 1752, the Western calendar, because most countries used a new calendar, 10 days of removal, so the monthly calendar of the month is somewhat different. It was before this.

parameter:

-M: Displayed on weekdays for weekly first day.

-J: Show with Caesa,

January 1

The number of days is displayed.

-y: Show this year calendar.

example:

CAL: Shows the monthly calendar of this month.

[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: Shows the annual calendar of AD.

[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 14 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 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 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 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 13 14 16 17 9 10 11 12 13 14 15

21 22 23 24 25 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: Shows AD in May 2001.

[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: The first day of week is the week, showing this month. [root @ mylinux / root] # Cal -m

August 2000

Mo Tu We TH fr 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

The number of days shows 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 134 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 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 29 29 297 298 299 300 301 302268 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

Use permission: All users

Use mode:

Crontab [-U user] filecrontab [-u user] {-l | -r | -e}

Description:

Crontab is used to use the user at a fixed time or a fixed interval execution, in other words, that is, the like's schedule. -u user refers to the schedule that sets the specified user. This premise is that you have to have its permissions (such as root) to specify the schedule of others. If you don't use -u user, it means to set your own schedule.

Parameters:

-e: Perform a text editor to set a time program, the contents of the text editor is VI. If you want to use the other text editor, please set the Visual environment variable to specify the use of that text editor (for example SetENV Visual Joe)

-r: Delete the current schedule

-L: List the current schedule

The format of the schedule is as follows:

fly

1 f

2 f

3 f

4 f

5 program

Where F1 is a minute, F2 represents hours, and F3 represents the first few days in one month, and F4 represents the month, F5 represents the first few days in the week. Program represents the program to be executed. When F1 is *, it is indicated that the program is executed every minute, and the F2 is *, it is executed per hour, and the remaining classes are pushed.

When F1 is A-B, it is performed from step a minutes to the second minute. When F2 is A-B, it is to be executed from paragraphs A to B.

When F1 is * / n, each time interval is executed once, F2 is * / N to execute once a time interval per n, and the remaining classes push

When F1 is A, B, C, ... is shown in paragraph A, B, C, ... minutes to perform, F2 is A, B, C, ... indicated first, b, c ... Hourly to be executed, the rest

Users can also store all settings first in the file file, and set the time schedule in the way in the CRONTAB FILE.

Example:

Perform an hour per hour per hour / bin / ls:

0 7 * * * / bin / ls

In December, 6:00 pm every day, per 20 minutes, per 20 minutes, / usr / bin / backup:

0 6-12 / 3 * 12 * / usr / bin / backup

On Monday to Friday, send a letter to alex@domain.name on Monday to Friday.

0 17 * * 1-5 Mail -s "hi" alex@domain.name

Every month, daily midnight 0:20, 2:20, 4:20 .... Executive Echo "Haha" 20 0-23 / 2 * * * echo "Haha"

Note:

After executing the time you specified, the system will send you a letter to you, show the program executed, if you don't want to receive such a letter, please add> / dev after each line of empty / NULL 2> & 1.

Name: Date

Use permission: All users

Use mode:

Date [-u] [-d datestr] [-s datestr] [--UTC] [--Universal] [--date = datestr] [--SET = DATESTR] [--help] [--version] [ FORMAT] [MMDDHMM [[CC] YY] [. Ss]]

Description:

Date can be used to display or set the date and time of the system. In the display, the user can set the format that wants to display, the format is set to a plurality of plus numbers, where the available tag list is as follows:

Time:

%: Print%

% N: Next line

% T: jumping

% H: Hours (00....

% I: Hours (01..12)

% K: Hours (0..23)

% L: Hours (1..12)

% M: Minutes (00..59)

% P: Display Local AM or PM% R: Direct Display Time (12 hours, format HH: mm: ss [ap] M)

% s: from

1970

Year

1 day 00:00:00 UTC to the number of seconds

% S: second (@ 10)

% T: Direct display time (24-hour system)

% X: equivalent to% h:% m:% s

% Z: Show time zone

Date:

% A: Sun..sat

% A: Sunday..SATURDAY

% B: Month (JAN..DEC)% B: Month (January "% C: Direct display date and time% d: Day (01..31)% D: Direct display date (mm / dd / yy )% h: same% b% J: The first few days in the year (001..366)% M: Month (01..12)% u: the first few weeks (00..53) The first day of sunday is the first day of the week)% w: The first few days (0..6)% w: the first few weeks of one year (00..5..53) (in Monday's first The situation of the day)% x: Direct display (mm / dd / yy)% y: year's last two digits (00.99)% y: intact year (0000..9999)

If it does not start with the plus sign, it means to set the time, and the time format is MMDDHHMM [[CC] yy] [. SS], where mm is month, DD is the day, HH is hour, MM is minutes, CC is The first two digits of the year, YY is two digits after the year, SS is the number of seconds:

-d DateStr: Displays the time set in DateStr (non-system time)

--help: Display auxiliary message

-s datestr: Set the time set to the time set in DateStr

-u: Show current Greenwich Time

--Version: Display version number

Example:

During the display time, then display the current date: DATE % T% N% D

Display month and day: DATE % B% D

Display date and set time (12:34:56): Date --Date 12:34:56

Note:

When you don't want to have meaningless 0 (for example

1999/03/07

), You can insert-symbols in the mark, for example, Date % - H:% - M:% - S will drop the meaningless 0 in seconds, like the original 08:09:04 will change 8: 9: 4. In addition, only the permissions (such as ROOT) can set the system time. When you change the system time with the root identity, please write the system time in CMOS in CLOCK -W so that the system time will continue to hold the latest correct value when it is rebooted next time.

Name: SLEEP

Use permission: All users

How to use: Sleep [--help] [--version] Number [SMHD]

Description: Sleep can be used to delay the current action for a while

Parameter Description :

--help: Display auxiliary message

--Version: Display version number

Number: The length of time, the back can be connected to S, M, H or D in seconds, m for minute, H is hour, D is the number of days

Example:

Displays the current time after 1 minute, then display time again: Date; SLEEP

1M

Date

Name: Time

Use permission: All users

How to use: Time [Options] Command [Arguments] Description: The purpose of the TIME instruction is to measure the time and system resources of the measurement time and system resources required for specific instructions. For example, CPU time, memory, input and the like, and the like. Special attention is required is that some information can not be displayed on Linux. This is because the allocation of some resources on Linux is not the same as the TIME instruction, so that the TIME instruction cannot be obtained. Set the result output file to the meter -o or --output = file setting. This option writes the output of the Time to the specified file. If the file already exists, the system will override its content. -A or --Append cooperation -o use, will write the result to the end of the file without overwriting the original content. -f format or - format = format Sets the display mode with the Format string. When this option is not set, you will use the system preset format. However, you can use the environment variable time to set this format, so you don't have to set it once every login system. In general setting, you can use / t to indicate the jump, or use / n to refer to the wrap. Each material uses% as a preamble. If you want to use a percentage symbol in the string, use it. (The people who have learned C language will feel very familiar) Time instructions can be displayed. There are four major items, respectively: Time Resources Memory Resources IO Resources Command Info Detailed content is as follows: Time Resources E Execute the time spending the instruction, The format is: [Hour]: minute: second. Note that this number does not represent the actual CPU time. e Execute the time spending the instruction, the unit is second. Note that this number does not represent the actual CPU time. The time spent on the core mode during the execution of the S command is seconds. U The time spent in the user mode during execution, the unit is second. P Execute the occupation ratio of the CPU when the command is executed. In fact, this number is the core mode plus the CPU time of the user mode divided by total time. The maximum value of the entity memory occupied by Memory Resources m. The unit is the average value of the entity memory occupied by KB T execution, and the unit is the total amount of memory occupied by the KB K executive program (STACK DATA TEXT), and the unit is self-information of the KB D execution program. The average size of the unshared data isa, the unit is the average size of the unshared stack of the KB P executable, and the unit is the average of the shared text. The unit is a KB Z system. The size of the memory page is byte. This is the number of major memory pages of this program for the same system. The so-called main memory page error is that a memory page has been replaced into the SWAP file and has been assigned to other programs. At this point, the content of this page must be read again from the replacement. R The number of times the secondary memory page of this program is incorrect. The so-called secondary memory page error is that although the memory page has been replaced into the replacement file, it is not allocated to other programs.

At this point, the content of this page is not broken, and it is not necessary to read it from the replacement. W This program is forced to interrupt (like allocated CPU time depletion). Voluntary interruption (like a number of files entered by the number of I / O execution, like a disk reading, etc.), the number of files outputted by this program R R RO of this program R This program has received Socket Message S The SOCKET Message K received by this program (Signal) The number of parameters when Command INFO C is executed, and the EXIT STATUS) -p or --portAbility will be automatically Setting the display format becomes: Real% e user% u sys% s The purpose is to be compatible with the POSIX specifications. -v or --verbose This option lists the resources used in all programs, not only in general English statements, but also instructions. People who don't want to spend time to set or just start to contact this instruction is quite useful. Example: Use the following instructions Time -V PS -AUX we can get the results of PS -AUX and system resources taken. As 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: 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 Output: 0 SOCKET Messages Rece: 0 Signals Delivered: 0 page size (bytes): 4096 EXIT STATUS: 0 Name: Uptime Usage Permissions: All users use: uptime [ -V] UPTIME provides the user's information below, no other parameters: the current time system is running to the current time connected to the number of users recently one minute, five minutes and fifteen systems load parameters: -V Displays version information.

Example: Uptime It is: 10:41 AM UP 5 Days, 10 min, 1 Uses, Load Average: 0.00, 0.00, 1.99 Name: CHFN Usage Permissions: All User Usage: Shell >> CHFN Description: Provide users to change individuals Information for Finger and Mail UserName Example: Shell >> CHFN Changing Finger Information For User Password: [DEL] Name []: Johnney Huang ### provides information when providing finger Office []: NCCU Office Phone []: [DEL ] Home phone []: [DEL] Name: ChSH Use Permissions: All User Usage: Shell >> Chsh Description: Change the user shell setting example: shell >> Chsh Changing Fihanging Shell for User1 Password: [DEL] New shell [/ bin / tcsh]: ### [is currently used by Shell] [DEL] shell >> Chsh -l ### 展示 / etc / shells file content / bin / bash / bin / sh / bin / ash / bin / BSH / BIN / TCSH / BIN / CSH "Finger [Back] Name: Finger Usage Permissions: All users User: Finger [Options] User [@address] Description: Finger allows users to query some other user information The information will be listed: Login Name User Name Home Directory Shell Login Status Mail Status .plan .project .forward Among them. PLAN, .Project and .Forward is the user in his Home Directory. P.PLAN, .PROJECT . Information in the file and other files. If there is no. Finger directive is not limited to the inquiry on the same server, you can also find the user on a remote server. Just give an image is e-mail address. The address can be displayed. Multi-line display. -S single line display. This option is only displayed Showing the name, real name, terminal name, idle time, login time, office number and phone number. This option is invalid if the user is the user of the remote server.

Example: The following instructions can be queried by this manager: Finger root results are as follows: login: root name: root directory: / root shell: / bin / bash never logged in. No mail. No plan. Name: Last Usage Permissions : All users use the way: shell >> Last [options] Description: The display system is booted from the beginning of the monthly message, the mega-R 省 Hostname field-Num display before NUM UserName display UserName login Message TTY Login message Contains Terminal Code 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 be done! Oh, I am not here, I'm here, I have a beautiful youth ^ _ ^ Name: passwd usage rights: All users use methods: passwd [-k] [-l] [-u [-f]] [-D] [ -S] [username] Description: Use to change the user's password parameter: -k -l -u -f -d Close the user's password authentication function, the user will not need to enter a password when logging in, only ROOT privileges The user can use. -S Displays the specified user's password authentication type, only the user who has root privileges can be used. [Username] Specify an account name. Name: WHO Use Weilline: All users can use Mode: WHO - [husfv] [user] Description: There are those users in the display system being on, the data displayed contains the user ID, the terminal used, from there, online time, time, CPU Use amount, action, etc. Turning: -H: Do not display the title column - U: Do not display the user's action / work-S: Use the short format to display -f: Do not display the user's online location -V: display program version

Name: / etc / aliases Use Permissions: System Manager Usage: Please use the newaliases update Database Description: Sendmail uses an action that is converted by the file in / etc / aliases. When sendmail receives a letter to XXX, it will be given to another by the content of the AliaSS file. This feature creates a user who is only valid in the letters system. For example, Mailing List uses this feature. In MailingList, we may create a mailingList called Redlinux@link.ecpi.edu, but actually doesn't have a user named RedLinux. The actual AliaSS file is to receive the Mailing List processing of the Mailing List processing. / etc / aliases is a file file, Sendmail requires a binary format /etc/aliases.db. NEWALIASES's functional is to convert / etc / aliases into a repository that SENDMAIL can understand. Example: # Newaliases The following command will do the same thing, # sendmail -bi related commands: mail, mailq, newaliases, sendmail "mail" Mail [return] Name: Mail Use Permissions: All users use: mail [-iinv] [ S Subject] [-c cc-addr] [-b bcc-addr] User1 [user 2 ...] Description: Mail is not only a directive, Mail is still an email program, but people who use Mail to read the letter should be very Less! For system managers, Mail is very useful, because managers can write into script with mail, regularly send some memorandum reminder systems. Parameters: i ignore TTY interrupt signals. (Interrupt) I forced interaction Mode. (Interactive) V lists the message, such as the location of the send letter, state, etc. (Verbose) N does not read the mail.rc setting file. SMail title. C CC mail address. B BCC email address. Example: Get the letter to one or more email addresses, because the user must enter the contents of the title and the contents of the title. And the user2 does not have a host position, which will give the user2 user of the mail server. Mail User1 @ Email.address mail user1@email.address user2 Sending the content of mail.txt to user2 at the same time CC to USER1. If this line instruction is set to cronjob, you can send a memo to the system. Mail -s Title -C User1 user2

When sendmail receives a letter to XXX, it will be given to another by the content of the AliaSS file. This feature creates a user who is only valid in the letters system. For example, Mailing List uses this feature. In MailingList, we may create a mailingList called Redlinux@link.ecpi.edu, but actually doesn't have a user named RedLinux. The actual AliaSS file is to receive the Mailing List processing of the Mailing List processing. / etc / aliases is a file file, Sendmail requires a binary format /etc/aliases.db. NEWALIASES's functional is to convert / etc / aliases into a repository that SENDMAIL can understand. Parameters: No parameters. Example: # Newaliase The following command will do the same thing, # sendmail -bi related commands: mail, mailq, newaliases, sendmail Name: Talk User Permissions: All users use mode: Talk Person [TTYNAME] Description: Pair with other users Talking about: Person: Prepare the user account, if the user is on other machines, you can enter Person@machine.name TTYNAME: If the user has more than two TTY connectors, you can choose the right TTY newsletter example. 1: Talk to the user Rolland on the machine now, then Rolland only one connection: Talk Rollaend Next is the RollaEnd response, if rollaend is accepted, Rollaend Enter the `Talk Jzlee` To talk, please press Ctrl C example. 2: Talk to the user RollaEnd on Linuxfab.cx, use PTS / 2 to talk: Talk RollaEnd@linuxfab.cx PTS / 2 is the next is the RollaEnd response, if ROLLAEND accepts, Rollaend Enter the `Talk Jzlee @ Jzlee.home`, you can start talking, press CTRL C Note: If the word of the screen appears abnormal character, try to update the screen screen in Ctrl L. Name: WALL Use Permissions: All users use mode: Wall [message] Use instructions: Wall transmits the message to each MESG to set the User's online user.

When using the terminal interface as a standard income, the message needs to be added with EOF (usually using Ctrl D)  Example: Communication "Hi" gives each user: Wall Hi Name: Write Use Permissions: All Use How to use: Write user [TTYNAME] Description: Communication to other users: user: Prepare the user account TTYNAME: If the user has more than two TTY connectors, you can choose the right Tty Tombye example. 1: The message is given to Rolland. At this time, Rolland has only one connection: Write Rollaend is then hitting the message, and press Ctrl C example. 2: Communication to Rollaend, Rollaend has PTS / 2, PTS / 3: Write RollaEnd PTS / 2 Next is to hit the message, please press CTRL C Note: If the other party sets Mesg n, at this time, the interpretation will not pass to the other party name: KILL use permission : All users use methods: kill [-s signal | -p] [-a] pid ... kill -l [signal] Description: KILL sends a specific signal (Signal) to the stroke ID PID stroke according to this Signals do specific actions, if no specified, the preset is a signal to send the termination (TERM): which is available in HUP (1), KILL (9), Term (15), Represented, cut off, end; detailed signals can be printed with kill -l -p: PID, do not send signal -L (Signal): list all available signal name: PID 323 stroke Cut off (kill): Kill -9 323 Running the PID 456 Running (Restart): Kill-Hup 456 Name: NICE Usage Permissions: All Users User Way: Nice [-n Adjustment] [-adjustment] [- -adjustment = adjustment] [--help] [--Version] [Command [arg ...]]] Description: Execute a program with a changed priority, if not specified, the current schedule is printed Order, the internal Adjustment is 10, the range is -20 (highest priority) to 19 (minimum preferred preface) Putting  -n adjustment, -adjustment, -adjustment = adjustment, all Adjustment - HELP display restrictions --Version display Version Information Example: Put the priority of the LS 1 and execute: Nice -n 1 LS adds the priority sequence of the LS and executes: NICE LS adds the priority of the LS 10 and performs Note: Priority is a job system The parameters used to determine the CPU allocation, Linux uses the "Round-Robin" to do the CPU schedule, the higher the priority, the more CPUs that may be obtained.

Name: PS Usage Permissions: All users use mode: PS [options] [--help] Description: Show the dynamic parameters of the moment: PS [Options] Dynamic parameters: PS is very large, only a few common parameters are listed here and Ondering Introduction Meaning-A List All Tour-W Display Widening You can display more information -au Show more detailed information -AUX Display all stroke Au (x) output format containing other users: user pid% CPU% MEM VSZ RSS TTY Stat Start Time Command User: PID% PID: PID% CPU: User CPU Usage% MEM: Occupied Memory Use VSZ: Occupable Virtual Memory Size RSS: The Memory Size TTY: The secondary device number of the terminal: D: Uninterrupted stationary (Pipe □ 缜 B performs I / O action) R: is being executed S: Static state T: Pause to execute Z: No, it is temporarily unable to eliminate W: Not enough memory page can be assigned <: high-priority stroke N: low priority stroke L: There is a memory paging assignment and lock in memory (instant system or Ai / o) Start: Time Time Time: Execute Time Command: Examples of Directive: Ps Pid Tty Time CMD 2791 TTYP0 00:00:00 TCSH 3092 TTYP0 00:00:00 PS% PS -A PID Tty Time cmd 1? 00:00:03 init 2? 00:00:00 Kflushd 3? 00:00:00 kpiod 4? 00:00:00 kswapd 5? 00:00:00 MDRECoveryd .......% PS -AUX User PID% CPU% MEM VSZ RSS TTY Stat Start Time Command Root 1 0.0 0.7 1096 472? s Sep10

0:03 init [3] root 2 0.0 0.0 0 0?

SW SEP10

0:00 [kflushd] root 3 0.0 0.0 0 0?

SW SEP10

0:00 [KPIOD] root 4 0.0 0.0 0 0?

SW SEP10

0:00 [kswapd] ........ Name: PStree Use Permissions: All users use methods: pstree [-a] [-c] [-h | -hpid] [-l] [-n] [-P] [-U] [-g | -u] [PID | User] PStree -V Description: Display all the strokes in a tree map, the tree map will be pid (if you have specified) or in init This basic stroke is root (root) If you have a specified user ID, the tree map only shows the stroke parameters owned by the user: -a Displays the full instructions and parameters of the stroke, if it is replaced by the memory The stroke will add parentheses -c if there is a rebounded stroke name, separately list (preset value is added in front * Example: PStree Init - - AMD | -APMD | -ATD | -HTTPD- --10 * [httpd]% PStree -P init (1) - - AMD (447) | -APMD (105) | -ATD (339)% PStree -c Init - - AMD | -APMD | -ATD | -httpd - - httpd | | -httpd | | -httpd .... Name: renice Use Permissions: All users use mode: renice priority [[-p] pid ...] [[-g ] PGRP ...] [[-U] user ...] Description: Re-specify the priority of one or more strokes (one or more of the parameters will be determined)  -P PID re-specify the ID of the ID of the PID, the priority -G PGRP re-specifies the ID of the PROCESS Group (one or more), the priority of the PGRP (one or more), the priority - User re-specifies the stroke owner is User Priority Example of Itinerary: The stroke ID is 987 and 32 stroke and the priority number of the stroke owner for Daemon and root plus 1: renice 1 987 -u daemon root -p 32 Note: Each stroke (Process) There is a unique ID  Name: Top Usage Permissions: All users use mode: TOP [-] [D delay] [q] [c] [s] [s] [i] [n] [b ] Description: Instant display of Process Dynamic Pickup D: Changing the update speed of the display, or Interactive Command Press SQ: No delayed display speed, if the user has the permissions of Superuser, TOP will perform C: Switch display mode with the highest priority, there are two modes, one is Only the name of the execution file is displayed, the other is to display the full path and the name S: cumulative mode, the CPU Time of the DEAD CHILD Process, the CPU Time, which is completed, or disappeared, will convers a conversation instruction Cancel, avoid potential crisis i: No idle (IDLE) or useless (Zombie) stroke N: update, will exit Top B: batch file mode after completion, with "N" parameters, you can Used to output the results of TOP to the archive: Show update ten times and exits after ten times; Top -n 10 users will not use the conversation instruction to the stroke command: Top -s will update the update to display the quaduper results Enter the name In the file for top.log: Top -n 2 -b

Send a message to the program that is executing, the preset message is Term (interrupt), and the more common information is three ways to write, and 0 messages: -9, -sigkill, -Kill, you can use -l or -l already listed available messages. General parameters: -f fast mode / unfinished -i interactive mode / each action will be confirmed - V Detailed output / list of selected programs Information - W Smart Warning message / has not completed -N no action / display program code parameters : The rules for selecting the program can be, the terminal code, the user name, the program code, the command name. -T Terminal Code (TTY or PTY) -U User Name -P Program Code (PID) -c Command Name You can use the signal: The name, signal code, and function are listed below.

Name (code) function / Description ALRM 14 Leaves HUP 1 Leaving INT 2 Leaving KILL 9 Leaving PIPE 13 Leaving PROW PROW TERM 15 Leaving USR1 Leaving USR2 Leaving VTALRM Leaving STKFLT Leaving / Only I386, M68K, ARM and PPC hardware unused leaves / only for I386, M68K, ARM, and PPC hardware TSTP stop / generating behavior TTIN stop / generating behavior Ttou stop / generate behavior of behavior stoP stop / forcing shutdown Conta from the new start / if the stop state is started from the new, otherwise ignore the PWR ignore / ignore Winch in some systems ignore CHLD ignore ABRT 6 core FPE 8 core ILL 4 core Quit 3 core SEGV 11 core Trap 5 core SYS core / perhaps Undepended EMT core / perhaps unplanned BUS core / core failure XCPU core / core failure XFSZ core / core failure example: Stop all programs Skill -kill -V PTS / * on the PTY device to stop three users User1, User2, user3 skill -stop user1 user2 user3 other related commands: kill name: EXPR Usage Permissions: All users ### string length shell >> expr length "this is a test" 14 ### Digital commercial shell> > EXPR 14% 9 5 ### From location Crapen Strings shell >> Expr Substr "this is a test" 3 5 is is ### Digital String Only The First Character Shell >> Expr Index "Testforthegame" E 2 ### String Real Reproduce Shell >> EXPR Quote THISATESTFORMELA THISATSTFORMELA Name: TR ### 1. More than one side, do all uppercase files under the directory to lowercase file name? There seems to be many ways, "TR" is one of them One: #! / Bin / sh dir = "/ tmp / TestDir"; files = `Find $ dir -type f`; For i in $ files do dir_name = `DIRNAME $ I`; Ori_FileName =` BaseName $ I` NEW_FILENAME = `Echo $ Ori_FileName | TR [: Upper:] [: Lower:]`> / dev / null; #echo $ new_filename MV $ DIR_NAME / $ Ori_FileName $ DIR_NAME / $ New_FileName Done ### 2. 自 自己 试 ... ... LowerCase to Uppercase Tr Abcdef ... [DEL] Abcde ... [DEL] TR AZ AZ TR [: Lower: ] [: Upper:] shell >> echo "this is a test" | TR AZ AZ> WWW shell >> Cat WWW this is a test ### 3. Remove unwanted string shell >> Tr -d this # ## Remove the Test this Man Man Test E ### 4. Replace Strings Shell >> Tr -s "Test" this test th TE directive:

CLEAR use: Clear the screen. How to use: Enter clear on Console. Name: Reset, Tset How to Use: Tset [-iqqrs] [-] [-e ch] [-i ch] [-k ch] [-m mapping] [Terminal] Instructions: Reset actually and tset is a command It uses its use of setting the status of the terminal. In general, this command will automatically determine the current terminal of the current terminal from the environment variable, command column, or other configuration. If the specified type is?, This program will ask the user to enter the terms of the terminal. Since this program sets back the terminal back to the original state, in addition to the use of login, when the system terminal enters some strange states because the program is not properly executed, you can also use it to reset the terminal O, for example Be careful to enter the binary file with the CAT directive to the terminal, often there is a terminal that does not respond to the keyboard input, or responds to some strange characters. You can reply to the original state with RESET. Option Description: -p The terminal category is displayed on the screen, but does not make the set action. This command can be used to achieve the category of the current terminal. -e ch Associates the ERASE unit into a CH -I CH to set the interrupt character into ch -K CH will delete the character of the row to set a CH -I to do the set action. If there is no option -Q, ERASE , The current value of the interrupt and deletion of the character will still be sent to the screen. -Q Do not display ERASE, interrupt, and delete the value of the character to the screen. -r Prints the terminal machine class on the screen. -s Send the typed string of the command to the TERM to the terminal, usually in .login or .profile example: Let the user enter a terminal model and set the terminal to the type. Preset status. # RESET? Set the ERASE CET to set the concol-h # reset -e ^ b Display the string of settings on the screen # reset -s Erase IS Control-B (^ b). Kill IS Control-u (^ U). Interrupt is control-c (^ c). Term = xterm; Name: compress usage rights: All users use methods: compress [-dfvcv] [-b maxbits] [file ...] Description: compress is a Pretty ancient UNIX file compression instructions, the compressed file will add a .z extended file name to distinguish an uncompressed file, and the compressed file can be decompressed in uncompress. To press the plurality of files into a compressed file, you must first turn the archive Tar and then compress. Since Gzip can generate more ideal compression ratios, the general people have changed more Gzip to archive compression tools. Parameters: c Output Results to standard output devices (General referred to screen) F Forced writing files, if the destination already exists, it will be overwritten (force) the message executed by the program on the screen (Verbose) B The upper limit of the number of common strings is set, and the value can be set to 9 to 16 BITS with bit yuan. Since the value is, the more common strings that can be used, the larger the compression ratio, so the preset value 16 bits (bits) D will extract the compressed file to extract the V-list information example: Source.dat compression Source.dat.z, if Source.dat.z already exists, the content is covered by the compressed file. Compress -f Source.dat compresses Source.dat into source.dat.z, and prints the compression ratio. -v and -f can use compress -vf source.dat to output the compressed data. Dat.z can change the compressed file name.

Compress -c Source.dat> The larger the value of target.dat.z-b, the larger the compression ratio, the range is 9-16, and the preset value is 16.

Compress -b 12 Source.dat

Unfolding Source.dat.z into Source.dat. If the file already exists, the user presses Y to determine the coverage file, and the file will be automatically covered if the -df program is used. Since the system will automatically join .Z is an extended file name, Source.dat will automatically be treated as Source.dat.z.

Compress -d source.dat compress -d source.dat.z

Name: LPD

Use permission: All users

How to use: LPD [-l] [#port]

LPD is a resident printing machine management, which manages local or distal printers based on / etc / printcap content. Each printer defined in / etc / printcap must have a corresponding directory in / var / lpd. In the directory, a copy of the CF starts in a directory indicates a printing work waiting to be sent to the appropriate device. This file is usually generated by the LPR.

LPR and LPD constitute a system that can work offline. When you use LPR, the printing machine does not need to be available immediately, and no existence. LPD automatically monitors the status of the printing machine. When the press is online, the file will be sent immediately. This has to wait for the previous work to complete the previous job.

parameter:

-l: Display some of the unlocked messages on the standard output. #port: In general, LPD uses GetServByName to get the appropriate TCP / IP Port, you can use this parameter to force LPD to use the specified port.

Example: This program is usually performed at the beginning of the system from the program in /etc/rc.d.

Name LPQ - Displays unfinished work usage in the list machine LPQ [L] [P] [user]

Description

LPQ displays items that are not completed in the list of lists managed by the LPD.

Example Example 1. Display all work in the LP list machine

# lpq -pljPrank Owner Job Files Total Size1st Root 238 (Standard Input) 1428646 Bytes

Related functions LPR, LPC, LPD

Name: LPR Use Permissions: All users use methods: lpr [-pprinter] Send files or distributed by standard input to the printing machine, the printing machine management LPD will be later This file is given to the appropriate program or device processing. The LPR can be used to process the material to be sent to the local or distal host. parameter:

-pprinter: Send the data to the specified printer Printer, the preset value is LP. Example: Send www.c and kkk.c to the printer LP. lpr-plp www.c kkk.c

Name: LPRM - Removes a work by the printing machine to rewind usage / usr / bin / lprm [p] [file ...] Description Minding machine has been placed in the printing machine Among them, this command can be used to cancel the work of the printing machine. Since each printer has a separate storage, you can use the -P command to set the printed machine you want to function. If there is no setting, the system preset press will be used. This command checks if the user has enough permissions to delete the specified file. In general, only the owner of the file or the system administrator has this permission. Example removal of No. 1123 in the printing machine HPPrinter

Lprm -Phpprinter 1123

Working No. 1011 is removed from the preset printing machine

LPRM 1011

Name: fdformat

Use Permissions: All users use methods: fdformat [-n] Device Instructions: Low-order formatting for the specified soft disc device. When using this instruction to format the floppy disk, it is best to specify the following device: / dev / fd0d360 disk machine A:, the magnetic piece is 360KB disk / DEV / FD0H1440 disk machine A:, the magnetic sheet is 1.4 MB Disk / DEV / FD1H1200 disk B:, magnetic disk is 1.2MB disk If used is a device like / dev / fd0, if the disk inside is not a standard capacity, formatting may fail. In this case, the user can specify the necessary parameters first with the setFDPRM instruction. parameter:

-N Close the confirmation function. This option closes the formatted confirmation step. Example: fdformat-N / DEV / FD0H1440 format the magnetic disk of the disk into a 1.4MB magnetic sheet. And the confirmation step is omitted.

Name: MFORMAT Use Permissions: All users

Use mode:

MFORMAT [-T cylinders] [-h heads] [-l volume_label] [-f] [-i fsver-sion] [-S SIZECODE] [-2 Sectors_ON_TRACK_0] [-M Software_sector_size] [-A ] [-X] [-C] [-H Hidden_sectors] [-r root_sector] [-b boot_sector] [-0 rate_on_track_0] [-A RATE_ON_THER_TRACKS] [-1] [-k] Drive: Have a low order Formatted magnetic sheets establish a DOS archive system. If you compile MTOOLS, use USE_

2M

Parameter open, partial

2M

The format related parameters will work. Otherwise these parameters (like S, 2, 1, m) do not act. Parameters: Synlider Number -H Head (HEAD) - Sternium Magnetic Area - L Tag -f The magnetic disc is formatted into FAT32 format, but this parameter is still in the experiment. -I Sets the version number in the FAT32. This is of course still in the experiment. -S magnetic area size code, calculated the number of magnetic regions of the sector = 2 ^ (size code 7) -C magnetne (Cluster). If the given number causes the number of magnets that exceed the FAT table, MFORMAT will automatically enhance the number of magnetic regions. -s -M mouncing magnetic area size. This number is the magnetic area size returned by the system. Usually the same as the actual size. -A If this parameter is added, MFormat generates a set of ATARI systems to this soft disc. -X Format the flop to XDF format. Before use, you must use the XDFCOPY instruction to make a low-order formatting action. -C Generates a disk image file (Disk Image) that can be installed with MS-DOS archive system. Of course, this parameter is meaningless to an entity disk machine. -H hidden the number of magnetic regions. This is usually suitable for the split area of ​​the formatting the hard drive because there is a segmentation table in front of a divided area. This parameter is not tested, it can not be used. -n disk serial number -R root directory size, unit is the number of magnetic regions. This parameter is only valid for FAT12 and FAT16. -B uses the specified file or the power-on magnetic area of ​​the device as the boot magnetic area of ​​this flap or division area. Of course, the hardware parameters are faded. -k Try to maintain the original boot magnetic area. -0 Data transfer rate -2 use other data transmission rate -2 other than the 0-track data transmission rate

2M

Format-1

2M

Format example: mformat A: This will formulate A: (already / dev / fd0) with a preset value. Name: MKDOSFS Usage Permissions: All users use methods: mkdosfs [-c | -l filename] [-f number_of_fats] [-f fat_size] [-i volume_id] [-M message_file] [-n volume_name] [-R root_dir_entry ] [-S Sector_Per_Cluster] [-V] device [block_count]

Description: Establish a DOS archive system. Device means that you want to establish a device code for a DOS archive system. Like / dev / hda1, etc. Block_count is the number of blocks you want to configure. If block_count is not specified, the system automatically calculates the number of blocks that meet the size of the device. parameter:

-c Create a file system before checking there is a bad track. -l reads bad track records from the determined file. -f Specifies the number of FAT, File Allocation Table. The preset value is 2. At present, Linux's FAT archive system does not support more than 2 FAT tables. Usually this doesn't need to be changed. -F Specifies the size of the FAT table, usually 12 or 16 positions. The 12-bit group is usually used for the disks, and the 16-bit component group is used for the general hard disk division area, that is, the so-called FAT16 format. This value typically systematically selects the appropriate value itself. Using FAT16 on the disk usually does not take effect, it is also possible to use FAT12 on the hard disk. -i Specifies the Volume ID. Generally, a four-bit tuple number, like 2e

203A

47. If you don't give your system you will be generated. -m When the user tries to boot with this magnetic or divided zone, the system will give the user a warning message to the user when there is no working system. This parameter is used to change this message. You can use the file to edit it, then specify this parameter, or use -m - so the system will ask you to enter this text directly. It is important to note that the strings in the file should not exceed 418 words, including the expanded jumper symbol (Tab) and the wrap symbol (the wrap symbol counts two characters under DOS!) -Not Specifies the Volume Name, Disk label. Like the Format directive under the DOS, you will not give it. There is no preset value. -r Specifies the maximum number of files under the root directory. The so-called number of files here includes the directory. The preset value is 112 or 224 on the floppy disc, 512 on the hard disk. Nothing, don't change this number. -S Magnetic area of ​​each magnetic busner. Must be two times. But unless you know what you are doing, this value should not be gave. -V provides additional message example: MKDOSFS-N TESTER / DEV / FD0 Format the disk in the A slot into a DOS format, and set the label to Tester Linux common network command (reproduced) Blue forest http: // Www.lslnet.com

The main advantage of the computer network is to achieve resource and information sharing, and the user can access information remotely. Linux provides a set of powerful network commands to serve users, which help users log in to remote computers, transfer files and execute remote commands. This chapter describes the following commonly used orders:

FTP Transfer File Telnet logs in to the remote computer R - Use a variety of remote command NetStat to view the network status NSLookup query domain name and IP address Corresponding finger Query a user's information PING Query a machine Whether to use the ftp command to remotely The file transfer ftp command is a user interface for a standard file transfer protocol. FTP is a simple and efficient way to transfer files between computers on the TCP / IP network. It allows users to transfer ASCII files and binary files. During the FTP session, the user can connect to another computer using the FTP client. Since then, the user can move up and down in the directory, list the directory content, copy the file from the remote machine to the local machine, transfer the file from the local machine to the remote system. It should be noted that if the user does not have access permissions of that file, you cannot obtain a file from the remote system or transfer files to the remote system. In order to use FTP to transfer files, the user must know the legal username and password on the remote computer. The combination of this username / password is used to confirm the FTP session and to determine what kind of access can be made to the user to transfer. In addition, users clearly need to know the name or IP address of the computer that performs FTP sessions. The FTP command function is to transfer the file between the local machine and the remote machine. The general format of this command is as follows: $ FTP Host Name / IP where "hostname / IP" is the host name or IP address of the remote machine to be connected. In the command line, the host name belongs to the option. If the host name is specified, the FTP will try to connect with the remote machine's FTP service; if no hostname is specified, the FTP will give a prompt, waiting for the user to enter command: $ ftp ftp> At this point, enter the OPEN command to add the host name or IP address after the FTP> prompt, and will try to connect the specified host. Regardless of which method is used, if the connection is successful, you need to log in to the remote machine. If you have an account on the remote machine, you can use this account through FTP and provide a password. The read and write permission on the user account on the remote machine determines what files can be downloaded on the remote machine and put the upload file in which directory. If there is no dedicated login account for a remote machine, many FTP sites have a special account that can be used. This account is named Anonymous (also known as anonymous FTP). When using this account, you request an Email address as a password. If the remote system provides an anonymous FTP service, users can log in to special, for public use. Generally provide two directory: PUB directory and incoming directory. The PUB directory contains all files that the site is available for public, and the file is stored on the site. Once the user logs in to the remote site, the "FTP>" prompt will be obtained. Now you can use the command provided by the FTP, you can use the HELP command to get the list of commands available, or you can specify the specific command name after the HELP command, and you can get the description of this command. The most commonly used commands are: LS lists the current directory CD of the remote machine CD Change the working directory LCD on the remote machine Change the working directory ASCII Settings File Transfer Method for ASCII Mode Binary Settings File Transfer Method for Binary Mode CLOSE Termination Current FTP Session Every time, each time the data is transmitted in the data buffer, it shows a ## Get (MGET) from the remote machine to the local machine PUT (MPUT) from the local machine transfer specified file to the remote machine OPEN connection remote FTP site QUIT break Enter the connection with the remote machine and exit FTP? Display Local Help Information! Go to the SHELL to make a brief introduction of the FTP common command. Start the FTP session Open command to open a session with the remote host. The general format of this command is that Open Host Name / IP If you want to connect with more than one site during the FTP session, you usually use only the FTP command without parameters.

If you just want to connect with a computer during the session, specify the remote host name or IP address as the parameter of the FTP command on the command line. Termination FTP session close, disconnect, quit, and bye commands are used to terminate sessions with remote machines. The close and disronnect commands turn off the connection with the remote machine, but users stay in the FTP program of the local computer. The quit and bye commands are turned off the user with the remote machine, and then exit the FTP program on the user machine. Changing the Directory "CD [Directory] command to change the directory on the remote machine during the FTP session, the LCD command changes the local directory, and the user can specify the location of the field file. The remote directory list ls command lists the contents of the remote directory, just like using an LS command in interactive shell. The general format of the LS command is: LS [Contributory] [Local File] If the directory is specified as a parameter, then LS lists the contents of the directory. If the name of a local file is given, then this directory list is placed in this file you specified on the local machine. Gets the file GET and MGET commands from the remote system to get files from the remote machine. The general format of the GET command is: Get file name You can also give a local file name, this file name is the file name that this file is created on your local machine. If you don't give a local file name, then use the remote file original name. Mget Commands Get multiple remote files at a time. The general format of the MGET command is: the MGET file name list uses a file name list separated by spaces or band-through to specify the file to be acquired, and each file of it requires the user to confirm whether to transmit. Send a file PUT and MPUT command to the remote system to send files to the remote machine. The general format of the put command is: the PUT file name mput command sends multiple local files at a time, the general format of the mPut command is: the MPUT file name list uses a file name list separated by spaces or band-through-bands to specify the files to send. Each file of it requires the user to confirm whether to send. Change file transfer mode By default, FTP Press the ASCII mode to transfer files, and users can specify other modes. The function of the ASCII and the brinary command is to set the transmission mode. Transferring files with ASCII mode is very good, but in order to avoid damage to binary files, users can transfer files in binary mode. Checking the transfer status to transmit large files, it is very useful to find that the FTP provides feedback information about the transmission situation. After the Hash command enables FTP to print a # character on the screen after the data in the data buffer is transferred each time. This command can be used when sending and receiving files. The local command in the ftp When you use FTP, the character "!" is used to transfer a command to the command shell on the machine. If the user is in the FTP session, it is useful if shell is doing something. For example, the user wants to create a directory to save the received file. If you enter! Mkdir new_dir, Linux creates a directory called New_DIR in the current local directory. The typical conversation process of downloading binary data files from remote machine Grunthos is as follows: $ ftp grunthos connection to grunthos 220 GRUNTHOS FTP Server Name (GRUNTHOS: PC): anonymous33l

Guest login ok, send your complete e-mail address as password Password:. 230 Guest 1ogin ok, access restrictions apply Remote system type is UNIX ftp> cd pub 250 CWD command successful ftp> ls 200 PORT command successful l50 opening.... ASCII Mode Data Connection for / Bin / 1S. Total Ll4 Rog1 Rog2 226 Transfer Comp1te. FTP> Binary 200 Type Set Toi.

FTP> Hash Hash Mark Printing on (1024 BYTES / HASH MARK). FTP> Get Rog1 200 Port Command SuccessFu1. 150 Opening Binary Mode Data Connection for Rogl (L4684 Bytes). # # # # # # # # # # # # # # # # 226 Transfer Complete. 14684 BYtes Received in 0.0473 SECS (3e 02 kbytes / sec) ftp> quit

22L

Goodbye. Access the remote computer user using the Telnet command to remotely log in with the Telnet command. This command allows users to communicate between remote computers using the Telnet protocol, and users can log in to remote computers over the network, just like logging in to the local machine. To log in to the remote computer via Telnet, you must know the legal username and password on the remote machine. Although some systems do login functionality for remote users, it is necessary to limit the operation permission of the guests for security considerations. Therefore, it is very small in this case. When the remote user is allowed to log in, the system usually places these users in a restricted shell to prevent the system to be damaged by malicious or accidentally. Users can also log in to their own computers using Telnet, check email, editing files, and runners, just like locally logging in. However, the user can only use the terminal-based environment rather than the X Wndows environment, Telnet only provides terminal simulation to ordinary terminals without supporting X WDOW graphics environments. The general form of the telnet command is: Telnet hostname / IP where "hostname / IP" is the host name or IP address to which you want to connect. If this command is executed, you will get the login: prompt from the remote machine. The process of logging in using the telnet command is as follows: $ TELNET Host Name / IP Start Telnet session. Once the Telnet is successfully connected to the remote system, the login information is displayed and the user name and password will be losed. If the user name and password are entered correct, you can successfully log in and work on the remote system. After the Telnet prompt, you can enter a lot of commands to control the Telnet session, which has a detailed description of these commands in the Telnet online help manual. Below is a Telnet session on a Linux computer: $ Telnet Server. Somewhere. Com true. Com. Somewhere. Com. Escape character is / '?] /'. "Turbolinux Release 4. 0 (colgate KERNEL

2.0.18

ON AN I486 Login: Bubba Password: Last Login: Mon Nov L5 20:50:43 for localhost Linux 2. 0.6. (POSIX). Server: ~ $ server: ~ $ logout connection closed by Fore forward Host $ User ended session Once, be sure to use the logout command to exit the remote system. The Telnet reports the remote session is turned off and returns to the shell prompt of the user's local machine. In addition to FTP and Telnet, the R-Series commands can also use the R-series command to access the remote computer and exchange files on the network. Special attention is required to use the R-series command, because if the user is not careful, it will cause serious security vulnerabilities. After the user issues a R-series command, the remote system checks the file named /etc/hosts.equiv to see if the user's host is listed in this file. If it does not find the host's host, check the name of the same name on the remote machine on the remote machine. Rhosts' files see if the host is included. If the user's host includes any of these two files, the user performs the R-series command without providing a password. Although users do not need to type in the remote machine each time, it may be very convenient, but it may also bring serious security issues. We recommend that users carefully consider the security issues implied by R-commands before establishing /etc/hosts.equiv and.rhosts files. The rlogin command rlogin is an abbreviation for "Remote Login". This command is very similar to the telnet command, allowing the user to launch interactive command sessions on remote systems. The general format of Rlogin is: rlogin [-8ekldx] [-e char] [-k real] [- l username] HOST generally most common format is: rlogin host This command is: -8 This option is always Allow 8-bit input data channels. This option allows you to send formatted ANSI characters and other special codes. If this option is not used, the parity bit will be removed unless the termination of the far end and the starter character is not or or otherwise. -E stops regarding any characters as a escape character. When you are working with the -8 option, it provides a complete transparent connection. -K Close all Kerberos confirmation. This option is only used when connecting to a host connection using the Kerberos confirmation protocol. -L allows the Rlogin session to run in the Litout mode. For more information, please consult the TTY online help. -d opens Socket debugging of TCP sockets that communicates with the remote host. For more information, please refer to the online help of SetsockOpt. -e is an Rlogin session setting escape character, the default escape character is "~", the user can specify a text character or an eight-input number in the form of // nnn. -K request rlogin's Kerberos license for remote hosts in the specified area, rather than obtaining Kerberos licenses for remote hosts within a remote host area determined by KRB_REALMOFHOST (3). -x Open DES encryption for all data transmitted through the Rlogin session. This will affect the response time and the CPU utilization, but can improve security. The RSH command RSH is an abbreviation for "Remote Shell". This command launches a shell on the specified remote host and executes the command specified in the RSH command line. If the user does not give the command to be executed, RSH uses the rlogin command to log in to the remote machine.

转载请注明原文地址:https://www.9cbs.com/read-16081.html

New Post(0)