[Linux] Linux system (File Operations), linux System File Operations

Source: Internet
Author: User

[Linux] Linux system (File Operations), linux System File Operations

Linux has three file types: common files, directories, and device files.

 

View files

Use the ls command to get ll and view the file list. parameters:-l (list form) and-a (display hidden files)

Use metacharacters *? To view the list of matched files, for example, ll a * (displays files starting with)

Run the cat command to view the file content. The parameter "-B" indicates the row number and file name.

Use the wc command to count the number of lines, words, and characters of the current file. Parameter: File Name

Use the grep command to search for strings in the text. parameters:-I (case-insensitive), target string, and file name

 

Edit File

Use command vi to create and edit a file. Parameter: File Name

Go to the file editing page and enter the I key.

Run the command wq to save the file.

Run the following command to exit the editing mode: q !, If the file is modified, save it and exit.

Run the following command to exit the editing mode: q !, Do not save and exit. If the file is modified, the following error is reported:

 

 

Use the esc key to exit the editing mode, and use the v Key to enter the visual interface.

Select text, copy with the y key, and paste with the p key

Use the dd command to delete the row where the current cursor is located

 

Move files

Run the command cp to copy the file. The parameter is the file name and the new file name.

Use the command mv to move the file. parameters: file name, new file name

 

Delete an object

Run the "rm" command to delete the file. The parameter is-r (recursively deleting the Directory)-f (no information is prompted ).

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.