Resume catalogue mkdir.
MkDir can create one or more directories.
mkdir ducument Piciture # #建立2个目录
mkdir ~/piciture/temp # #在主目录下建立名为temp的目录
MKDIR provides the-p option for the complete creation of a subdirectory structure
Mkdir-p ~/tempx/job # #当目录中不存在tempx目录时, the system tries to create it and then creates the job directory.
Resume an empty file touch.
You need to follow the file name as a parameter after touch
Touch Hello # #创建名为hello的空文件
Another use of the Touchu command is to update the date and time the file was created
Move and rename: MV
MV Hello bin/# #把hello文件移动到bin目录下
MV Piciture/bin/# #把picture目录移动到bin目录下
The MV command does not have any information during execution, which may seem a bit serious, in order to prevent users from removing important content, MV provides the-I option for discovering such situations
mv-i Hello test/# #mv: whether to overwrite Test/hello. During the move, you are prompted to move the files to the test directory. Reply Y is ok
The MV does not have the concept of renaming. The MV moving in the same directory is the renaming of the file.
CD ~/picture # #进入到picture目录
mv./hello./hello~ # #在同一个目录里, move the hello file to hello~, which is the renaming of the Hello file
Copy files and directories: CP
CP Command and MV Command exception, CP overwrites the file with the same name in the target directory by default. You can use the-I option to prompt for this situation. No more demonstrations here.
-
Delete files and directories: RmDir and RM
RmDir for deleting directories. This command is simple, just follow the directory name you want to delete as a parameter. Note RmDir can only delete empty folders
$sudo mkdir remove # #创建一个名为remove的文件夹
$sudo rmdir remove & nbsp; # #删除这个目录 the
RM command to delete one or more files at a time.
$sudo RM test/*.php # #删除test目录下所有的php文件
RM and MV commands do not have any prompts during the removal process. Files deleted through RM will disappear forever from the system and will not be placed in the Recycle Bin. A more secure way to use the RM command is to use the-I option, which prompts you before deleting a file and waits for the user to confirm that
$sudo rm-i test/test.php # #rm: Delete the normal file test.php?
RM provides the-f option to avoid such an interaction, forcing the delete file
RM provides the-r option to recursively delete all files and subdirectories under the directory.
$sudo rm-r picture/ # #删除picture目录下的所有的文件和子目录
Use the RM command with extreme care to avoid deleting important files and directories
Permissions for directories and files: Read (R), write (w), and execute
You can clearly see the properties of a file, including permissions, by viewing the file properties ls-l command.
$ls-L/bin/login
-rwxr-xr-x 1 root root 38096 2016-06-05 14:54/bin/login
A. The first character of the first field represents a file type. (-) plain files, (d) directory files, (c) character device files, (b) block device files, (s) local domain sockets, (p) known channels, (l) symbolic connections
B. The second field represents a permission. Rwxr-xr-x, these 9 characters should be such a broken bit, rwx,r-x,r-x, respectively, the owner, belong to the group, and other people have permissions.
C. Jinzhao This permission field represents the number of connections for the file. Here is 1, indicating that the file has only one hard link
D. The third field represents the owner, and the fourth field represents the genus group, in this case the owner of the login file is the root user and the group is the root group
E. The last field represents the file size (38096 bytes), the last modification date and time, and the full path of the file
Change file ownership chown and CHGRP
Change file Permissions chmod
Octal representation of file permissions. Rwx=4+2+1=7 is expressed as 111,r--=4,---= 0 for 000,-w-= 0+2+0 = 2 for 010,--x 0+0+1 = 1 for 001,rwxr-xr-x=755, and so on.
This article is from the "Ah Cool blog source" blog, please make sure to keep this source http://aku28907.blog.51cto.com/5668513/1786216