Linux-(2) Basic file operations in Linux, linux-linux

Source: Internet
Author: User
Tags touch command

Linux-(2) Basic file operations in Linux, linux-linux

In linux, everything is files, directories are files, and hardware is files. Therefore, basic file operations are especially important.

1. List the contents of the directory:

Ls <Directory Name> does not add a directory name to list the current directory

Parameters:

-A: displays all files (including hidden files)

-L display details

-R recursive display subdirectory Structure

-Ld: displays directory and link information


2. view the file information:

File <file Name>


3. Switch the directory:

Cd <path>

"..." Upper-level directory

"." Current Directory

"~ "Home Directory of the currently logged-on user

"-" Previous working directory


4. Create a file:

Touch <File Name> the touch command can create an empty file or update the time of an existing file.


5. Create a folder:

Mkdir <folder Name>


6. copy the file, directory:

Cp <source file/folder> <target file/folder>

Parameters:

-R Recursively copies the entire directory tree

-V: Show Details


7. Move and rename the file or directory:

Mv <File> <target directory>

If the file name is specified, You can rename the file.


8. delete an object:

Rm <file/folder>

Parameters:

-I interactive (every file will prompt whether to delete)

-R recursively deletes all contents in the directory.

-F force Delete, no warning prompt


9. delete an empty folder:

Rmdir <folder> This command cannot delete non-empty folders. Use the previous rm-r

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.