Linux command line basic file/folder operations

Source: Internet
Author: User

Operations on files

Create an empty file: Touch + filename # is usually the first touch good one file and then vim this file. Curious why it's called touch.
Delete File: RM + file name # straight out, not to the Recycle Bin

Copy the file to the specified location: CP + file + target directory # For example, the CP file sub copies the file files in the current directory into the current directory sub-directory sub.
Rename/Move files: MV + files (folder) + target directory

# For example, MV Dir1 Dir2/new moved the folder Dir1 (and its contents) to the same level of DIR2 as it did, and renamed New.

# You can also direct MV Dir1 new to rename Dir1 to new but not move.

# if the target already exists, then the moved file/folder will overwrite the original file/folder. Similarly, copying to an existing target can also lead to overwriting.

Actions on a folder
Create empty directory: mkdir + folder name
Delete Empty directory: RmDir + folder name
To delete a directory and what it contains: Rmdir-r + folder name # this r in-R is the word I don't know, please let me know.

Copy the entire folder to another location: Cp-r + folder + Directory location

Operations on a directory

First, make it clear that the main scope of a user activity is/home/username, such as I am/home/abram. If you want to "move the knife" in the other directory of root, it involves troublesome permissions, in short, may be less than root.

Enter directory: CD # Memory: CD change Directroy changing directory

# Assuming that starting in the user directory such as:/home/abram, Linux will show ~ means this directory, also can CD ~ Back to this directory, very handy.

View Catalog contents: LS # Memory: List Listing

# All files, folders are listed. and the colors of the executable files and folders are different. Under my SuSE, it shows:

Green is an executable file, and blue-gray is a folder. The others are ordinary files.

View directory details: Dir # Returns a detailed table equivalent to the upgraded version of LS.

Finally, the use of a "point":

When representing a directory,./represents the current directory,.. /indicates a parent directory, but .../does not indicate a superior directory, not this thing, but. /.. /To achieve. can also continue to set.

Should continue to add, write so much first.

------December 15, 2014------

Linux command line basic file/folder 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.