Important order for Linux

xiaoxiao2021-03-06  47

We introduce the Linux command into several parts according to the role in the system. However, there are still some commands that are not well divided, but they learn what they are also more important.

Tar

1. The role tar command is a reliable method of the backup file in the UNIX / Linux system, which can be operated in any environment, and its usage rights are all users.

2. Format TAR [Profile Counseling] file or directory

3. When the main parameters use this command, the primary option must be there, it tells Tar what is going to do, the counsel is an auxiliary use, you can choose.

Main option: -c Create a new file file. If the user wants to back up a directory or some files, select this option.

-r Put the files to be archived to the unlucky of the file file. For example, the user has already made a backup file, and it has found that there is a directory or some files forgot backup. At this time, you can use this option to add a forgotten directory or file to the backup file. -T lists the contents of the file file, see which files have been backed up. -U update file. That is to say, replacing the original backup file with a new file, if you can't find a file in the backup file, append it to the last of the backup file. -X releases files from the archive file.

Auxiliary Options: -b This option is set for the tape drive, followed by a number, used to explain the size of the block, the system preset value is 20 (20 × 512 bytes). -F uses file files or devices, this option is usually necessary. -K Saves already existing files. For example, restore a file, encounter the same file during the restore, and no overlay is performed. -M When the file is restored, the modification time of all files is set to now. -M Create a multi-volume file to store in several disks. -V detailed report information of TAR processing. If there is no such option, TAR does not report file information. -W Each step is required to confirm. -Z uses GZIP to compress / decompress files, and then compress file files after adding this option, but also must use this option to decompress when it is restored.

4. Application Description TAR is an abbreviation for Tape Archive, initially designed to package files onto a tape. If you downloaded the source code of Linux, you may have encountered TAR files. TAR is a file-based command, which is essentially continuously, and sets files connected to the document. Using TAR can pack the entire directory tree, which makes it particularly suitable for backup. Archive files can be restored, or separate files and directories from it. Backups can be saved to file-based devices or tape devices. The file can be redirected when restored so that they reappear into a directory (or system) different from the directory (or system) originally saved. TAR is independent of the file system, which can be used on EXT2, EXT3, JFS, Reiser, and other file systems. It supports various backup media, including floppy disks, optical disc writing, overwritten disc, Jazzip, tape, high-end tape, etc. The files ended in Linux are created with tar. It uses a simple backup, which can be used to put many different files together to form an easy-to-separate file. If you use the Linux source installer, you must use the TAR file. This is a file-based command, which is essentially continuously, and stacked the files connected. The TAR official website is http://www.gnu.org/software/tar/tar.html.

Please note that don't forget that Linux is case sensitive. For example, the tar command should always be performed in lowercase. The command line switch can be a mixture of uppercase, lowercase or case. For example, -T and -T perform different functions. The file or directory name can be mixed using case, and is case sensitive as commands and command line switches.

5. Application Example TAR is a tool for a command line without a graphical interface. Use Konsole to open a terminal window, next is a simple backup command (create a back.tar file in the / temp directory, all content in the / usr directory is included.): $ TAR CVF - / USR> / Temp / back.tar In addition, the TAR command supports the crontab command that the previous third lecture can be set to time-regularly running based on time. For example, back up the / usr directory to the main drive of the / usr directory to the HDA-first IDE interface, and simply add the following statement to the root CRONTAB: $ 00 06 * * * TAR CVF /DEV/HDA1/USRFILES.TAR - / USR

Under normal circumstances, the following directories are required: ◆ / etc includes all core configuration files, including network configuration, system name, firewall rules, users, groups, and other global honesty? ◆ / var containing system daemon (Service) The information used, including DNS configuration, DHCP lease, mail buffer file, HTTP server file, DB2 instance configuration, etc. ◆ / Home contains all the owner's main directory, including personal settings, downloaded files and users do not want to lose other information. ◆ / root root (root) user's home directory. ◆ / OPT is where many non-system files are installed. IBM software is installed here. OpenOffice, JDK, and other software are also installed here by default.

Some directories are uncomfortable: ◆ / Proc should never back up this directory. It is not a real file system, but the virtualization view of the kernel and environment, including files such as / proc / kcore, this file is a virtual view of the entire running memory. Backup These files are only wasting resources. ◆ / DEV contains file representation of the hardware device. If you plan to restore a blank system, you can back up / dev. However, if the plan is reduced to a installed Linux system, the backup / dev is unnecessary.

unzip

1. The action unzip command is located in the / usr / bin directory, like the Winzip software features in the PKZIP, PKUNZIP, and MSWindows under MS DOS, to save the file to save the hard disk space, when needed The compressed file is unzigned with the unzip command. This command usage rights is all users.

2. Format unzip [-cflptuvz] [- agcjlmnoqsvx] [- p ] [. Zip file] [file] [- d ] [- x ]

3. Main parameters - C: Lockecal lens of the decompressed lens is a slap in the arc. BR> -f: Update an existing file. -L: Displays the files contained in the compressed file. -P: Similar to the -c parameter, the decompressed result is displayed on the screen, but no conversion is performed. -T: Check that the compressed file is correct. -U: Similar to the -f parameter, but in addition to updating existing files, the other files in the compressed file are also in the directory. -V: Execution is to display detailed information. -Z: Only note text is displayed. -A: The necessary character conversion for text files. -B: Do not perform character conversion for text files. -C: The file name in the compressed file is case sensitive. -J: Do not process the original directory path in the compressed file. -L: Change all file names in the compressed file to lowercase. -M: Send the output to more program processing. -N: Do not override the original file when decompressed. -O: You don't have to ask users first, and UNZIP is executed to overwrite the original file. -P : Use ZIP's password option. -Q: Do not display any information when executed. -S: Convert blank characters in the file name to the bottom line character. -V: Reserved file version information for VMS. -X: Decompress the time-back file for the original UID / GID. [.Zip file]: Specify the .zip compressed file. [File]: Specify which files to handle. Zip compressed files. -D : Specify the directory to be stored after the file is decompressed. -X : Specify which files do not handle .zip compressed files. -Z unzip: -z is equal to executing the ZipInfo instruction. In Linux, a tool called ZipInfo is also provided to see more information about the ZIP compressed file. The latest version of Unzip is 5.50. gunzip

1. The role of the Gunzip command is to decompress the file, and the use of rights is all users.

2. Format gunzip [-acfhllnnnnqrtvv] [- s ] [file ...] or gunzip [-acfhllnnnqrtvv] [- s ] [directory]

3. Main parameters - A or --ASCII: Use the ASCII text mode. -C or --stdout or --to-stdout: outputs the decompressed file to the standard output device. -F or -force: Forcibly unwind the compressed file, ignore whether the file name or hard connection exists, and whether the file is a symbolic connection. -H or --help: Online help. -L or --List: Lists related information about the compressed file. -L or --License: Displays version and copyright information. -N or - no-name: When the compressed file contains the original file name and timestamp, it is ignored. -N or --NAME: When the compressed file contains the original file name and timestamp, return it to the unlocked file. -Q or --quiet: Do not display warning information. -R or -recursive: Treatment processing, processing all files and subdirectories in the specified directory. -S or - Suffix Change the compressed word tail string. -T or --test: Test if the compressed file is correct. -V or --verbose: Displays the instruction execution process. -V or -version: Displays version information. 4. Description Gunzip is an extensive decompression program that is used to unwind the file compressed by Gzip, which preset the final extension ".gz". In fact, Gunzip is a hard connection of Gzip, so it can be done separately by Gzip instructions whether it is compressed or decompressed. The latest version of Gunzip is 1.3.3.

Unarj

1. The use of UNARJ decompression format is files in the .arj format, and the use of the right is all users.

2. Format UNARJ [ELTX] [ARJ Compressed File]

3. Main parameters E: Unzip .arj file. L: Displays the files contained in the compressed file. T: Check that the compressed file is correct. X: The original path is retained when decompressed.

4. Note The file with the .arj extension is created by the ARJ utility used for MSDOS and Windows. Because Arj is a shared server that cannot get a source of source code, there is almost no tool that matches its function on the Linux platform. To decompress the .arj file, use the UNARJ utility. Unarj is slower than ARJ, the ability is not as good as Arj, but at least a lot of .arj files can be taken smoothly. UNARJ can only extract files to the current working directory, list file content, or test files. You can download the UNARJ source on the FTP server from the ARJSoftWare site or the required Linux release. In addition, UNARJ is usually part of the basic Linux distribution, so it can be found on the CD-ROM of the main release. If you need to download a list of all Linux release links, the ARJ software URL is http://www.arjsoft.com. The download page is http://www.arjsoft.com/files.htm. Unarj's latest version is 2.65, note that UNARJ option is not starting with minus (-).

MTOOLS

1. The action MTools is actually a collection of commands. It is the tool program for the DOS file system. It can simulate a number of DOS commands, which is very convenient to use. Use the right to use is all users. The Linux system provides a set of portable tools called mtools that allow users to read, write files and directories from a standard DOS floppy disk. They are very useful to exchange files between DOS and Linux environments. Mtools is very simple, if you want to copy all the files in the floppy disk to the hard disk, you can do the following command: mcopy a: *. * That is, you only need to add a letter before the corresponding DOS command. " m ", you can complete the corresponding function. In general, there is this software in the general linux release, you can use the following command to check. RPM -QA | GREP MTOOLS

If there is no installation, there is no relationship, you can download it from the Internet (http://mtools.linux.lu/) to install it. The latest Mtools currently available for download is 3.9.9, download link to http://mtools.linux.lu/mtools-3.9.9-3.i386.rpm. Install it after downloading.

2. Included commands MCD directory name: Change the directory under MS DOS. Mcopy Source File Target File: Copy files between MS DOS and UNIX. MDEL file name: Delete files under MS DOS. MDIR directory name: Displays the directory under MS DOS. MFORMAT Drive Number: Create a MS DOS file system on a low-level formatted floppy disk. RNLabel Drive Number: Generates the volume label under MS DOS. MMD directory name: Create a directory under MS DOS. MRD directory name: Delete the directory under MS DOS. MREN Source File Target File: Renown the existing MS DOS file. MTYPE file name: Displays the contents of the MS DOS file.

Note that these commands and corresponding MSDOS commands are very similar. In the mtools command, "/" and "/" can be mixed. Because the file list is the document under the DOS system, the case is not sensitive to case, so "CDE" and "CDE" are the same here.

3. Application example (1) If the flopp is quickly formatted, you can use the command MFORMAT: MFORMAT A:

MTools developed the purpose of development to handle the DOS file system, so you can only use on partitions in the FAT file format. It should be noted that if the FAT16 / 32 partition is mounted with the mount command, you cannot use the mtools instruction to process files on these partitions. This is because once the FAT16 / 32 partition is hung in the Linux file directory, Linux will treat it as part of the file system itself, then if you want to operate, you must use the command set included in Linux itself.

(2) Copy the files htca.c on the DOS disk to the current directory and verify with the LS command.

$ mcopy a: / htca.c $ ls -l htca.c-rw-r- -r- - 1 xxq xxq 27136 Jan 1 01:80 htca.c

MAN

Role

The man command is used to provide online help, using the right to use all users. A manual in a Linux system is stored in the Linux system for users to find on the terminal. Use the man command to view the help information, which is very convenient and practical.

2. Format MAN Command Name MAN [-ACDFHKKTWW] [-M system] [-P string] [-c config_file] [-mpath] [-p Pager] [-S section] Name ... 3. Parameters -C config_file: Specifies the setting file man.conf, the default is /etc/man.conf. -M path: Specifies the search path of the online manual. If you do not specify, use the setting of the environment variable MANPATH; if you do not use MANPath, you will use the settings within /usr/lib/man.conf; if manpath is empty The string is represented using the default value. -P Pager: Specify how Pager.man will use this option to set it, then the environment variable MANPAGER is set, then the environment variable Pager; Man defaults / usr / bin / less-IS. -S section_list man: The searched chapter list (separated by colon), this option overrides the setting of the environment variable mansect. -A man: The default is that after displaying the first manual, you will stop searching, using this option to force the Man to continue to display all Name online manuals. -C: Even with the latest CAT Page, it is also especially meaningful to the online manual, this option is particularly meaningful when the number of rows of the screen changes or is damaged by typographic online manual. -D: Don't really show online manuals, only display the error message. -D: The online manual is displayed at the same time and the inclination message. -H: Display the help message and end the program. -K: Search for all online manuals. Note that this feature response speed may be very slow, if the section is specified, it will help the speed. -M system: Specifies another group of online manuals depending on the SYSTEM name specified. MAN: It is the abbreviation of the Manual. This document can be obtained immediately when you have difficulty in the input command. For example, if you encounter difficulties when using a PS command, you can enter MANPS to get help information, and the man page of the PS is displayed.

Since the man page man page is designed with the Less program (which can easily turn over the screen), you can use all options for LESS in Man Page.

The more important function keys in Less are: [q] Exit; [Enter] a row of underground flooding; [SPACE] 1 page underground; [b] on a page; [/] followed by a string and [enter] To find a string; [n] found the next matching of the last lookup.

4. The reading man page provides a lot of information in a very small space, which briefly introduces some of the contents of most man-pages. There are mainly nine parts: User command, system call, library, device description, file format, game, miscellaneous, system instruction, kernel, and manual page snapshot see Figure 1.

Figure 1 PS Command Man Page Snapshot

The Linux man page layout is shown in Table 1.

5. Application Examples There are some basic, important commands, such as PS, Find, Cat, and LS. Here, an example of a comprehensive application, thereby, it can be seen that the status of the Man is critical in Linux. However, the information displayed by the Man is not a normal text. If you directly redirect these text to a text file, you will find two texts that are highlighted in the man becomes two, and there are countless tabs. Value, making printing, editing become very inconvenient. However, you can get the PS command printing with the following statement. #Man ps | col -b | LPR This command uses two techniques for outputting redirection and pipeline, and the role is to print the help information of the PS command. More MAN files You can view the Linux ManPages Simplified Chinese version home page, which links http://cmpp.linuxforum.net/.

Unencode

1. The role Unencode command can encode a binary table to a text file, and the use of the right is all users.

2. Format uuencode [-hv] [Source File] Target File

3. Main parameters - h: List the instruction usage format (HELP). -V: List of published this information.

4. Application Description UUENCODE instructions can convert binary into ASCII coding that can be sent using email. The UUENCODE encoded data begins with BeGin, with END as the end, and typically the beginning of each line is "M", the intermediate portion is encoded, and the encoded file is larger than the source file.

Uudecode

1. The role uudecode command is used to restore the UUENCODE encoded file. Uudecode will only restore the encoded data between the Begin and the END tag, and the program skips information other than the marker. Its usage rights are all users.

2. Format uuencode [-hv] [file1 ...]

3. Main parameters - h: List the instruction usage format (HELP). -V: List of published this information.

4. Application instance Use the following command to restore several files: uuencode file1.uud file2.uud file3.uud

Do one

1. Send a message in the Linux command Although the Linux desktop application has developed very fast, but the command line still has strong vitality in Linux. If you can confirm that the email server supports 8bit bytes, you can use the following command directly: CAT Mail

CAT (CAT is the abbreviation of the concatenate) command to process several files into a file and save the results of this process to a separate output file, where we use it to merge the message.

Write the name of the email, such as CJKmail, then use the following command: $ uuencode >> CJKmail

This allows the CJKmail file with the VI editor and write the text on the letter, and then send it.

After the other party receives the letter, the letter is copied in CJKmail, saving the THEMAIL.UUE. If the other party is under Windows, you can use WinRAR or WinZip to decompress so that attachments can be seen.

If the other party also uses Linux, you can use undecode command to restore: $ uudencode -o Themail.uue

2. Implement the TAR Split I want to compress a 378MB file into multiple 63MB files (the author's USB is 64MB), using the following command: $ TAR CZVF - DIR | SPLIT -D -B 63M then merge command: $ Cat x *> dir.tgz

The above example is actually completed by three command combinations, i.e. Tar package, split by SPLIT, with CAT merge. "TAR CZVF -DIR" means packaging the DIR directory and outputs it to the standard output (Argv) so that you can use the pipe to output it to the split.

3. Continuous execution of a command to use the watch command, can execute the command repeatedly. If the LS cooperates, the effect of observing changes in a certain file can be achieved. $ Watch ls -l file.name

4. Export a file with the tar command has a TAR format DVD file glvpro6.4_linux.tar because the file is very large (4.7GB), if all decompressed, you can use the following command to export Readme.txt. TAR XVF GLVPRO6.4_LINUX.TAR Readme.txt

Such readme.txt is derived separately.

5. Tar CF --ExClude Home / CJH Home / Cao

There is only two sub-directory backups of CJH and CAO in this home directory.

So far, the 60 commands of Linux must have been introduced. Linux's command line mode is powerful. If you skilled the common command of Linux, you often need to make a complex command to complete the user task. The command in the Linux system is too much, and it is impossible to remember all commands and parameters in MSDOS. The Linux system provides some ways, such as the name of the name can be queried by "Help" and "Man".

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

New Post(0)