[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 ).