Basic operations for Linux files and directories

Source: Internet
Author: User

Comparison of special directories:

. Represents this Layer directory

.. Represents a previous level directory

-Represents a previous working directory

~ Represents the home folder where the current user's identity resides

~account represents the home folder where the account user resides

1. Directory-related Operations

CD Switch Directory

CD [Relative path or absolute path]

CD special directory//switch to special directory

CD//does not add any path, also represents the meaning of returning to their home folder

PWD Displays the current directory

Pwd-p display the current path instead of using a connected path

mkdir New Directory

mkdir [-MP] Directory name

-m configuration file directory permissions

-P directly creates the desired directory recursively.

Example

#mkdir-P Test1/test2/test3 Recursive creation of TEST1,TEST2,TEST3 directory

RmDir Delete "Empty" directory, note that only empty directory can be deleted

-P directly deletes the desired directory recursively

2. File and Directory Management

View files and directories: LS

ls [-alt] directory name

-A All files are listed together with hidden files to

-L lists long strings of data, including file attributes and permissions

-T Sort by time

Copy, delete, move: CP,RM,MV

CP [-AIFRP] source file destination file

-A is equivalent to all attributes and permissions copied together

-F Forced replication

-I if the target file already exists, ask for the action before overwriting

-P along with the properties of the file copy the past

-R Recursive Continuous replication

RM [-rfi] File or directory

-F Mandatory

-I interactive mode, asking the user whether to operate

-R Recursive Delete

MV [-FIU] source destination

-F forced Override

-I interactive mode

-U if the target file exists and the source is newer

Basic Linux file and directory operations

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.