Common Linux commands and linux commands
A linux cainiao, this blog post only records some common commands encountered in normal work for later use...
I. disk management:
1.1Common Methods:Mkdir/usr1/liushaofeng/test
Syntax:Mkdir [-p] [-- help] [-- version] [-m <Directory attribute>] [directory name]
Note:Mkdir can create a directory and set the directory permissions at the same time.
Parameters:
-M <Directory attribute> or -- mode <Directory attribute> sets directory permissions when creating a directory.
-P or -- parents: if the upper-level directory of the directory to be created has not yet been created, the upper-level directory will be created together.
-- Help: displays help.
-- Verbose displays detailed information during execution.
-- Version: displays the version information.
1.2Common Methods:Rm liushaofeng.txt
Syntax:Rm [-dfirv] [-- help] [-- version] [file or directory...]
Note:Run the rm command to delete files or directories. If you want to delete a directory, you must add the "-r" parameter. Otherwise, only files are deleted by default.
Parameters:
-D or -- directory directly Delete the hard connection data of the directory to be deleted to 0 and delete the directory.
-F or -- force forcibly deletes a file or directory.
-I or -- interactive ask the user before deleting an existing file or directory.
-R,-R, or -- recursive processing: all files and subdirectories under the specified directory are processed together.
-V or -- verbose displays the command execution process.
-- Help Online help.
-- Version: displays the version information.
Ii. Backup compression:
2.1Function Description:Decompress the zip file
Syntax:Unzip [-cflptuvz] [-agCjLMnoqsVX] [-P <password> ][.zip file] [file] [-d <directory>] [-x <File>] Or unzip [-Z]
Note:Unzipping is the decompression program for. Zip compressed files.
Parameters:
-C displays the extracted results on the screen and converts the characters properly.
-F: update an existing file.
-L displays the files contained in the compressed file.
The-p parameter is similar to the-c parameter. The decompressed result is displayed on the screen, but no conversion is performed.
-T check whether the compressed file is correct.
The-u parameter is similar to the-f parameter, but in addition to updating existing files, other files in the compressed file are also extracted to the directory.
-V displays detailed information when executing the command.
-Z only displays the remarks of the compressed file.
-A performs necessary character conversion on text files.
-B. Do not convert characters in text files.
-C: The file name in the compressed file is case sensitive.
-J does not process the original directory path of the compressed file.
-L change all file names in the compressed file to lowercase letters.
-M sends the output result to the more program for processing.
-N do not overwrite the original file during decompression.
-O does not need to ask the user first. After unzip is executed, it overwrites the original file.
-P <password> use the zip password option.
-No information is displayed when q is executed.
-S converts the white space characters in the file name to the bottom line characters.
-V retains the file version information of VMS.
-X: saves the original UID/GID of the file at the same time during decompression.
. ZIP file] specifies the. Zip compressed file.
[File] specifies the files in the. Zip compressed file to be processed.
-D <directory> specifies the directory to be stored after the file is decompressed.
-X <File> indicates which files in the. ZIP file are not processed.
-Z unzip-Z is equivalent to executing the zipinfo command.
2.2Common Methods:Tar zxvf eclipse-inst-linux32.tar.gz
Syntax:Tar [-ABcdgGhiklmMoOpPrRsStuUvwWxzZ] [-B <number of blocks>] [-C <destination directory>] [-f <Backup File>] [-F <Script File>] [-K <File>] [-L <media capacity>] [-N <date and time>] [-T <Template File>] [-V <volume Name>] [-X <template File>] [-<device number> <storage density>] [-- after-date = <date and time>] [-- atime-preserve] [-- backuup = <backup mode>] [-- checkpoint] [-- concatenate] [-- confirmation] [-- delete] [-- exclude = <template style>] [-- force-local] [-- group = <group Name>] [-- help] [-- ignore-failed-read] [-- new-volume-script = <Script File>] [-- newer-mtime] [-- no-recursion] [-- null] [-- numeric-owner] [-- owner = <User Name>] [-- posix] [-- erve] [-- preserve-order] [-- preserve-permissions] [-- record -size = <block quantity>] [-- recursive-unlink] [-- remove-files] [-- rsh-command = <execution command>] [-- same-owner] [-- suffix = <backup character string>] [-- totals] [-- use-compress-program = <execution command>] [-- version] [-- volno-file = <No. file>] [file or directory...]
Note:Tar is a tool program used to create and restore backup files. It can be used to unbind files in the backup files.
Parameters:
-A or -- catenate adds A warm attachment to an existing backup file.
-B <number of blocks> or -- blocking-factor = <number of blocks> sets the number of blocks for each record. The size of each block is 12 Bytes.
-B or -- read-full-records reset the block size when reading data.
-C or -- create creates a new backup file.
-C <destination directory> or -- directory = <destination directory> switch to the specified directory.
-D or -- diff or -- compare the differences between backup files and files on the file system.
-F <Backup file> or -- file = <Backup file> specifies the backup file.
-F <Script File> or -- info-script = <Script File> the specified Script file is executed every time the tape is replaced.
-G or -- listed-incremental processes a large number of backups in GNU format.
-G or -- incremental processes a large number of backups in the old GNU format.
-H or -- dereference does not establish a symbolic connection, directly copying the original file pointed to by the connection.
-I or -- ignore-zeros ignores the 0 Byte block in the backup file, that is, EOF.
-K or -- keep-old-files does not overwrite the existing files when unzipping the backup file.
-K <file> or -- starting-file = <file> restores data from the specified file.
-L or -- one-file-system: the file system in which the file or directory is copied must be the same as the file system in which the tar command is executed; otherwise, the file system will not be copied.
-L <media capacity> or-tape-length = <media capacity> sets the storage capacity of each body, in 1024 Bytes.
-M or -- modification-time does not change the file change time when the file is restored.
-M or -- multi-volume adopts the multi-volume mode when creating, restoring the backup file or listing the content.
-N <date format> or -- newer = <date and time> only files updated on a specified date are saved to the backup file.
-O or -- old-archive or -- portability use V7 format when writing data to the backup file.
-O or -- stdout outputs the files restored from the backup file to the standard output device.
-P or -- same-permissions use the original file permission to restore the file.
-P or -- absolute-names file names use absolute names. Do not remove the "/" number before the file name.
-R or -- append: Add a file to the end of an existing backup file.
-R or -- block-number lists the block numbers of each information in the backup file.
The order in which-s or -- same-order files are restored is the same as that in the backup files.
-S or -- sparse if a file contains a large number of consecutive 0 bytes, it is saved as a sparse file.
-T or -- list lists the contents of the backup file.
-T <Template File> or -- files-from = <Template File> specifies the template file, which contains one or more template styles, unlock tar or create a file that meets the set conditions.
-U or -- update only replaces the files updated from the backup files.
-U or -- unlink-first unlink the compressed file Before restoring the file.
-V or -- verbose displays the command execution process.
-V <volume Name> or -- label = <volume Name> creates a backup file using the specified volume name.
-W or -- ask the user when interactive encounters a problem.
-W or -- verify: After writing data to the backup file, make sure the file is correct.
-X or -- extract or -- get restore the file from the backup file.
-X <Template File> or -- exclude-from = <Template File> specifies the template file, which contains one or more template styles, so that ar can exclude files that meet the setting conditions.
-Z or -- gzip or -- ungzip use the gzip command to process backup files.
-Z or -- compress or -- uncompress use the compress command to process backup files.
-<Device No.> <storage density> set the number of the peripheral device used for backup and the data storage density.
-- After-date = <date and time> this parameter has the same effect as the specified "-N" parameter.
-- Atime-preserve does not change the file access time.
-- Backup = <backup mode> or -- backup is performed before the file is removed.
-- Checkpoint lists the directory names when reading backup files.
-- Concatenate this parameter has the same effect as the specified "-A" parameter.
-- Confirmation this parameter has the same effect as the specified "-w" parameter.
-- Delete: deletes a specified file from the backup file.
-- Exclude = <template style> exclude those who meet the template style.
-- Group = <group Name>: Set the group to which the files added to the device file belong to the specified group.
-- Help Online help.
-- Ignore-failed-read ignores Data Reading Errors without interrupting program execution.
-- New-volume-script = <Script File> this parameter has the same effect as the specified "-F" parameter.
-- Newer-mtime only saves the changed files.
-- No-recursion is not recursive, that is, all files and subdirectories in the specified directory are not processed.
-- Null reads the file name from the null device.
-- Numeric-owner replaces the user name and group name with the user ID and group ID.
-- Owner = <User Name> sets the owner of the file added to the backup file as the specified user.
-- Posix writes data to the backup file in POSIX format.
-- Preserve this parameter has the same effect as the specified "-ps" parameter.
-- Preserve-order this parameter has the same effect as the specified "-A" parameter.
-- Preserve-permissions this parameter has the same effect as the specified "-p" parameter.
-- Record-size = <number of blocks> the effect of this parameter is the same as that of the specified "-B" parameter.
-- Before recursive-unlink unlinks a compressed file to restore the directory, unlink all files in the directory.
-- Remove-files: After the file is added to the backup file, delete it.
-- Rsh-command = <execution command> set the command to be executed on the remote host to replace the rsh command.
-- Same-owner tries to restore you with the same file owner.
-- Suffix = <backup character string> back up before removing a file.
-- After the totals backup file is created, the file size is listed.
-- Use-compress-program = <execution command> use the specified command to process the backup file.
-- Version: displays the version information.
-- Volno-file = <No. file> Replace the default volume number with the number in the specified file.
Iii. system settings:
3.1Common Methods:Export JAVA_HOME =/usr/liushaofeng/JDK1.6
Syntax:Export [-fnp] [variable name] = [variable setting value]
Note:When executing a program in shell, shell provides a set of environment variables. Export allows you to add, modify, or delete environment variables for subsequent programs. The effect of export is only true for this login operation.
Parameters:
-F indicates the function name in [variable name.
-N: Delete the specified variable. The variable is not actually deleted, but is not output to the execution environment of subsequent commands.
-P: list all environment variables that the shell assigns to the program.
3.2Function Description:Recalculate the parameter content
Syntax:Eval [parameter]
Note:Eval can read a series of parameters and then execute them according to their own characteristics.
Parameters:Parameters are not limited and separated by semicolons.
3.3Function Description:Set the password.
Syntax:Passwd [-dklS] [-u <-f>] [user name]
Note:The passwd command allows you to change your password, and the system administrator can use it to manage your password. Only Administrators can specify user names. Generally, users can only change their passwords.
Parameters:
-D. Delete the password. This parameter can only be used by system administrators.
-F.
-K can be updated only when the password expires.
-L lock the password.
-S: list the password information. This parameter can only be used by system administrators.
-U unlocks the locked account.
Attachment: linux Command Line Overview
Reprinted please indicate the source: http://www.cnblogs.com/liushaofeng89/p/4862094.html