Linux Directive Daquan (3)
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 Ordered, the internal Adjustment is 10, the range To -20 (highest priority) to 19 (minimum priority) Piennop-N Adjustment, -Adjustment, --Adjustment = Adjustment, all Adjustment - Help display help information --Version Displaying version information: 1 and execute the LS of the priority: 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 The system is used to determine the parameters assigned by the CPU. 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 diagram, the tree map will be pid (if there is specified) or in init this basic stroke For root (root) If there is a specified user ID, the tree graph shows only the stroke parameters owned by the user: -a Displays the full instructions and parameters of the stroke, if it is replaced by the memory body Will add bracket -c If there is a rebounded trip name, separate 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: Renic Usage Permissions: All users use mode: renice priority [[-p] pid ...] [[-g] PGRP. ..] [[-u] user ...]]] Re-specify the priority of one or more strokes (one or more of the parameters will be determined according to the parameters below), the ID -P PID re-specifies the priority of the stroke of the PID-g PGRP re-specified The priority example of the Tour Group (1 or more) of the travel group (one or more) of the PROCESS Group (one or more) - User re-specifies the priority example example of the stroke owner for the User: The stroke ID is 987 and 32 strokes and strokes The owner is a priority number of Daemon and root plus 1: renice 1 987 -u daemon root -p 32 Note: Every stroke has a unique ID Name: TOP Usage Permissions: All Use How to use: TOP [-] [D delay] [q] [c] [s] [s] [i] [n] [b] description: Instant display of Process Dynamic Accumulation D: Changing the displayed update speed , Or Interactive Command Press SQ: No delayed display speed, if the user has the permissions of the superUser, TOP will perform C: switch display mode with the highest priority, there are two kinds. Mode, one is only the name of the execution file, 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 of the Dead Child Process, is accumulated S: Safety mode, Cancel the conversation command to avoid potential crisis i: No idle (IDLE) or useless (Zombie) stroke N: update number, will exit TOP B: batch file mode after completion, with "N" parameters Used together, can be used to output the results of TOP to the archives: display update ten times after exiting; Top -n 10 users will not use the conversation instruction to the stroke command: top -s will update the update 4 times The result is entered into a file name to top.log: Top -n 2 -b 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. The larger the value of the target -c source.dat> target.dat.z -b, the larger the compression ratio, the range is 9-16, the preset value is 16. Compress -b 12 Source.dat decompresses Source.dat.z into source.dat. If the file already exists, the user presses Y to determine the coverage file, if you use the -DF program, you will automatically cover the file. 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 Usage Permissions: All users use mode: LPD [-l] [#port] LPD is a resident printing machine management program, it will / etc / printcap content to manage local or distal printers. 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. Parameters: -l: Display some unlocated 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 unfinished items in the list of list managers managed by the LPD. Sample Example 1. Show all work in the LP list machine # lpq -plrank Owner Job Files Total Size1st Root 238 (Standard Input) 1428646 BYTES Related Functions LPR, LPC, LPD Name: LPR Usage Permissions: All users use : Lpr [-pprinter] Sends the file or sent by the standard input to the printing machine, the printing machine management process LPD will give this file 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. Parameters: -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 - Remove the Usage / USR / BIN / LPRM [P] [File ...] in the printing machine Will be placed in the printing machine, 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 Removing LPRM -PPrinter 1123 in the printing machine HPprinter to remove LPRM 1011 in the preset press: fdformat Use Permissions: FDFormat [-n ] DEVICE Instructions: Low-order formatting of 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 piece 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. Parameters: -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 Usage Permissions: All users use methods: mformat [-t cylinders] [-h heads] [-S sectors] [-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: DOS archive system is established on a magnetic sheet that has already been low-level formatted. If you open the parameters of the USE_2M when compiling MTools, the partial parameters associated with the 2M format 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 amplify 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.