Common Linux Commands--File handling commands

Source: Internet
Author: User

Use Ctrl+l to clear the screen shortcut keys

Linux All files, directories are also files, we call it directory files, directory files and ordinary files are different, ordinary files are used to save data, and directories are used to save files, the concept of directory is the concept of folders in Windows

(1) Directory processing naming

1. Create directory: mkdir (make Directories)

mkdir-p[directory name]-P recursive creation

2. Switch directory (change directory) PWD displays the current directory

Simplified operation:

CD ~: Enter the current user's home directory

cd [directory] Enter to the specified directory CD direct return to home directory

CD-Go to last directory

Cd.. Go to the top level directory

Cd. Go to current directory

Relative path and absolute path

Relative path: Search by reference to the current directory

Absolute path: Starting from the root directory, first-level recursive lookup, in any directory, can enter the specified location

3. Search Directory Location: pwd (print working directory) print working directory display location

4 Delete Empty directory RmDir [directory name] (remove empty directories) rarely used (delete file must be careful)

RM can delete files or directories: All can rm-rf [files or directories]

Customary use (RM-RF [files and directories])

RM-RF *: You can delete files that have the beginning of a and delete directories must be with the-R but when you move the directory or rename the directory file

No need to bring the-R

  RM-RF [file or directory] Use this command R means delete directory (will ask) F Force Delete (RM-RF/Never execute, let Linux commit suicide Linux root is the real root of real administrator) rm-rf A *

rm-rf/tmp/* (plus * represents the deletion of the contents of the directory, does not add * represents the deletion of the system directory)

command to create an empty file touch ABC

(5) Copy command CP [options] [source file or directory] [destination directory]

Both copy and delete directories need to be prefixed with the-R

Options:

-r Copy Directory does not add-R is the copy file

-P Joint File attribute copy

-D If the file is a linked file, copy the link property

-A equals-pdr (all hidden properties are the same)

ll command is shorthand for the ls-l command (Ls-l is ll alias relationship)

(6) Cut or rename command: MV (move)

MV [source file or directory] [target directory] This is not used with-R

The role of a common directory: (the role of a common directory)

/root directory to explain and familiarize yourself with the role of first-level catalogs

Both the bin and the Sbin,usr directory in the root directory are the bin and sbin four directories that are used to hold system commands (all users in the bin directory can execute)

(Commands in the Sbin directory can only be performed by a super Administrator)

/bin command to save directories (commands that ordinary users can read)

/boot directory to start related files

/dev Device File save directory

/etc configuration File Save Directory

Home directory for normal users

/lib System Library Save Directory

/MNT System Mount Directory

/media Mount Directory

Date: The time the file was displayed

(2) directory File command

(3) Link command

Common Linux Commands--File handling commands

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.