Rm--> the command used to delete one or more files and directories, in the format: RM [parameters] File/folder, such as:
RM File # # system will prompt to delete files
Rm-f File # # Forcibly delete files, the system does not prompt
Rm-rf Folder # #删除文件夹及其目录下的所有内容, not prompted
Rm-i *.log # #删除所有. log file, ask for confirmation before deleting
Rm-r Folder # #删除子目录及子目录中所有
CD/TMP <== Switch working directory to/TMP
mkdir testing<== Create a new directory
chmod 744 testing<== Change Permissions
Touch testing/testing<== Create an empty file
chmod testing/testing <== Change Permissions
Absolute path vs. relative path
A. Absolute path: The file name or directory name that is written by the root directory (/). e.g./HOME/DMTSAI/.BASHRC;
B. Relative path: The filename is written relative to the current path. For example./home/detsai or. /.. /home/dmtsai, etc.;
Example: If you are now in the/home directory, want to enter/var/log this directory:
1.cd/var/log (absolute path)
2.cd.. /var/log (relative path)
Because you are under/home, so go back to the previous layer (.. /) to move to/var
. : Represents the current directory, or can be used.
.. : Represents the previous level of a directory, or you can use the. /to express;
-: Represents a previous working directory;
~: The home directory where [directory user identity] is represented
~account represents the user's home directory (account is a name)
Common instructions for working with directories:
CD: Transform Catalog
Example: CD ~REHL7 #代表去rehl7这个用户的家目录, i.e./HOME/REHL7
CD Var/spool/mail #绝对路径, full path name
Cd.. /mqueue #相对路径, from Var/spool/mail to Var/spool/mqueue.
PWD: Show current directory
mkdir: Create a new directory (mkdir [-MP] directory name)
Options and Parameters:
-M: Direct configuration file permissions, do not need to see the default permissions;
-P: helps you to directly set up the desired directory (including the upper directory) recursively;
Mkdir-m 711 Test2
Mkdir-p Test1/test2/test3/test4
RmDir: Delete an empty directory (RmDir [-p] Directory name)
Options and Parameters:
-P: Also deleted along with the upper [empty] Directory
Linux Learning Notes (ii)