Linux file and directory operation commands detailed

Source: Internet
Author: User
Tags mkdir

1. ls command

This command is the same as the dir command under DOS and is one of the most important commands in the Linux console command. The most commonly used parameters for LS are three:-A,-L, and –f.

Ls-a

Files on the Linux system are treated as hidden files by the system, and they are not visible with the LS command. With Ls–a, in addition to displaying a generic filename, even hidden files are displayed.

Ls–l (This parameter is the lower case of the letter L, not the number 1)

This command can display the contents of a file in a long format. If you need to see more detailed documentation, use the LS-L command.

Ls–f

Add a symbol after the listed file (directory) name, such as executable plus "*", and the Directory Plus "/".

2. CD command

CD This command is used to access the directory, it is used in the same way as in DOS, but unlike DOS is the Linux directory is sensitive to case, if the capitalization is misspelled, your CD operation is not successful. In addition, if the CD is entered directly, nothing on the back of the CD will go back to the user's own home directory. Suppose that if it is root it is back to/root, and this function is the same as cd~.

3. mkdir RmDir

The mkdir command is used to create a new directory, such as entering the following command:

mkdir work

A new work directory will be created under the current directory.

RmDir is used to delete an established directory, such as entering the following command:

RmDir work

An existing empty directory will be deleted work

4. CP

CP This command corresponds to the Copy command under DOS. The specific usage is:

Cp-r source destination file (target)

Parameter r is a copy of a subdirectory in the same homologous file.

5. RM

RM This command is used to delete files, the RM command commonly used parameters with three-i,-r,-f.

For example, I now want to delete a file with the name text, enter the following command:

Rm–i Test

The system asks us if we want to delete the test file, knocking "y/n" to confirm that you want to delete the test file:

Rm–r Directory Name: This operation can be deleted with the subdirectory below this directory, the function is more powerful than the rmdir mentioned above, not only may delete the specified directory, but also can delete all the files and subdirectories in the directory.

Rm–f file name This operation can forcibly delete files without confirmation.
6. MV

MV The function of this command is to move directories or files, the extended function is to rename the directory or file,

Like what:

Mv/tmp/xxx.tar/root

This command moves the Xxx.tar file in the/tmp directory to the/root directory.

and

MV Aaa.tar Bbb.tar

is to rename the file Aaa.tar in the current directory to Bbb.tar.

7. Cat
Cat This command is a very important command in Linux, its function is to display or link the general ASCII text file, its use is as follows:

Cat text

This command displays the contents of text in this file.

Cat File1 File2

This command displays the contents of the File1,file2 in order.

Cat File1 File2>file3

This command combines file1,file2 content and redirects > to file3 files.

8. More

More is the instructions for displaying generic text files. If a text file is too long for more than one screen, use cat to look at it is not ideal, you can try more, use the following:

More File1

9. pwd

PWD The function of this command is to display the user's current working path, directly input pwd.

Related Article

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.