Common CentOS syntax commands

Source: Internet
Author: User
I. Disk Management: 1.1 common methods: mkdir/usr1/liushaofeng/test syntax: mkdir [-p] [-- help] [-- version] [-m & lt; directory properties & gt;] [directory name] Supplementary Note: mkdir can create a directory and set the directory permissions at the same time. Parameter:-m & lt; directory attribute

I. Disk Management:

1.1Common methods:Mkdir/usr1/liushaofeng/test

Syntax:Mkdir [-p] [-- help] [-- version] [-m <目录属性> ] [Directory name]
Note:Mkdir can create a directory and set the directory permissions at the same time.
Parameters:
-M <目录属性> Or -- mode <目录属性> Set 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 <密码> [[.Zip file] [file] [-d <目录> ] [-X <文件> ] 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 <密码> 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 <目录> Specifies the directory to be stored after the file is decompressed.
-X <文件> Specifies which files in the. zip compressed 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 <区块数目> ] [-C <目的目录> ] [-F <备份文件> ] [-F ] [-K <文件> ] [-L <媒体容量> ] [-N <日期时间> ] [-T <范本文件> ] [-V <卷册名称> ] [-X <范本文件> ] [- <设备编号> <存储密度> ] [-- After-date = <日期时间> ] [-- Atime-preserve] [-- backuup = <备份方式> ] [-- Checkpoint] [-- concatenate] [-- confirmation] [-- delete] [-- exclude = <范本样式> ] [-- Force-local] [-- group = <群组名称> ] [-- Help] [-- ignore-failed-read] [-- new-volume-script = ] [-- Newer-mtime] [-- no-recursion] [-- null] [-- numeric-owner] [-- owner = <用户名称> ] [-- Posix] [-- erve] [-- preserve-order] [-- preserve-permissions] [-- record-size = <区块数目> ] [-- Recursive-unlink] [-- remove-files] [-- rsh-command = <执行指令> ] [-- Same-owner] [-- suffix = <备份字尾字符串> ] [-- Totals] [-- use-compress-program = <执行指令> ] [-- Version] [-- volno-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 <区块数目> Or -- blocking-factor = <区块数目> Set 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 <目的目录> Or -- directory = <目的目录> Switch to the specified directory.
-D or -- diff or -- compare the differences between backup files and files on the file system.
-F <备份文件> Or -- file = <备份文件> Specifies the backup file.
-F Or -- info-script = Each time the tape is changed, the specified Script file is executed.
-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 <文件> Or -- starting-file = <文件> Restores a file 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 <媒体容量> Or-tape-length = <媒体容量> Set the storage capacity of each body, measured 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 <日期格式> Or -- newer = <日期时间> 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 <范本文件> Or -- files-from = <范本文件> Specifies the template file, which contains one or more template styles, allowing tar to unbind 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 <卷册名称> Or -- label = <卷册名称> Create 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 <范本文件> Or -- exclude-from = <范本文件> 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.
- <设备编号> <存储密度> Sets the number of the peripheral device used for backup and the data storage density.
-- After-date = <日期时间> The effect of this parameter is the same as that of the specified "-N" parameter.
-- Atime-preserve does not change the file access time.
-- Backup = <备份方式> Or -- backup to back up the file before removing it.
-- 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 = <范本样式> Exclude those who meet the template style.
-- Group = <群组名称> Set the group of files added to the device file to the specified group.
-- Help online help.
-- Ignore-failed-read ignores data reading errors without interrupting program execution.
-- New-volume-script = The effect of this parameter is the same as that of 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 = <用户名称> Set the owner of the file added to the backup file to 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 = <区块数目> 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 = <执行指令> 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 = <备份字尾字符串> Back up the file before removing it.
-- After the totals backup file is created, the file size is listed.
-- Use-compress-program = <执行指令> Use the specified command to process the backup file.
-- Version: displays the version information.
-- Volno-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.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.