Linux Learning Notes (ii)

Source: Internet
Author: User

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)

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.