Learn basic Linux commands - The text directory management commands (two)

A rookie to learn programming techniques, record and share knowledge to everyone, hope you can enjoy.

Today to write an article on the basis of learning Linux commands - Bowen working directory commands, but also a lot of practice, summed up for everyone to learn together!

When using the following commands, you can use the aliascommand to view the Properties command you want to use.

file命令

Check the type of file;

touch命令

Used to create a blank file or set of files of time;

  • -d "YYYYMMDD HH:mm:SS 文件名": Time to modify the file
  • touch test: Create a directory of a test
  • touch *: Modification time is the current system time (all files in the current directory)
    Here Insert Picture Description

mkdir命令

Used to create a blank directory, mkdir command may be combined -pparameters recursively create the file directory having nested superposed relationship, mkdir is make directoryabbreviation;

  • -p: Cycle to create the directory
  • mkdir /a1: Create a new file a1
  • mkdir /a2: Create a new file a2
  • mkdir -p /a3/a4: Create a file cycle a3, a4
    Here Insert Picture Description

rmdir命令

To delete the directory (deleted directory is empty directory, that directory without any files), use the same mkdircommand the same, rmdiris the remove directoyabbreviation;

The following figure deleted directory is not empty, it prompts to remove failed!
Here Insert Picture Description

cp命令

For copying a file or directory cp [选项] 源文件 目标文件, cpit is the copyabbreviation;

  • -r: Copy the directory, if the directory exists tips
  • -v: Displays detailed information copied
  • -fOr --force: forcibly copy files or directories, regardless of whether the destination file or directory already exists
  • -iOr --interactive: before overwriting existing files or directories to ask the user
  • -uOr --update: when the source file date than the destination file, or when the name of the corresponding destination file does not exist, just copy the files
  • -pOr --perserve: keep the source file or directory attributes
    Here Insert Picture Description
    using the aliascommand to view the properties of the command, the following figure default attributes are cp -i, how to retain cpcommand of the original intent of it?
    Here Insert Picture Description
    use\ Cp commandCan retain command of intent, below is using the cpcommand to copy the files to a home folder, the file name is still a;
    Here Insert Picture Description

rm命令

Used to delete a file or directory, you need to add the rm command "-r"can only be parameters, or deleted can not afford, rmis removean abbreviation;

  • -rOr -R: all parameters listed in directories and subdirectories are recursively deleted
  • -fOr --force: forcibly remove files or directories, ignore non-existent file or directory
  • -iOr --interactive: Before deleting existing files or directories to ask the user
    Here Insert Picture Description
    on the new icon of a file tt1, force removal

prompt:rm -rf/*命令: Remember to be careful, this command is to delete all the files in the root directory of the Internet has been popular circle the word: delete from library to run away, do with caution! If you use this command, produces all the consequences and the author has nothing to do! ! !

mv命令

For cutting file or rename the file mv [选项] 源文件 [目标路径] [目标文件], mvit is the moveabbreviation;

  • -f: Whether the target file exists, not prompted to overwrite the target file or directory
    Here Insert Picture Description
    will fff file in the root directory of the move to the home folder
    Here Insert Picture Description
    for files to be renamed folder test1

End of the article resource sharing
on Linux learning resources are uploaded to a network disk, if required, can open the download Oh!
Links: https://pan.baidu.com/s/1BB5xbQU7jEI3sRKtkIWfqA
extraction code: 8gut

Published 12 original articles · won praise 65 · views 5558

Guess you like

Origin blog.csdn.net/qq_44723773/article/details/105156417