Basic operations on files or folders in linux (copying, moving, deleting, searching, and compressing ),
Create, copy, move, rename, and delete basic commands for linux Files (folders)
Copy a file or the entire directory
Cp source file name target Folder/[target file name]
Cp-target folder of the rv source folder/[name of the target folder]
-- Subdirectories in the r recursive directory
-V: returns the details of each copied file.
Move or rename a file
Target folder of the mv source file name/
Target File Name of the mv source file (rename the file)
Create a file
Touch file name
Delete an object
Rm file name
Create folder
Mkdir folder name
Delete the folder and the files under the Directory
Rm-r folder name
Interactive deletion.
Rm-ri folder name
Force Delete add-f
Rm-rif
Delete folders, but rmdir cannot delete non-empty folders
Rmdir folder name
Archive an object
Tar-cvf filename.tar filename
Eg: tar-cvf mongodb_log.tar mongodb_log.log
Release an archive
Tar-xvf filename.tar
Eg: tar-xvf filename.tar
Archive and compress
Tar-cvzf filename.tar.gz/folder
Release and decompress
Tar-xvzf filename.tar.gz
View files
Cat file name
(For viewing the page with a flip down, the Space key is to view the next page, and you cannot look back) more file name
(Page flip with orientation up and down) less file name
Head-n specifies the number of rows of data to be viewed.
Tail-n displays several rows of data starting from the end of the file.
Tail-f continuously views file changes, which are generally used for Log changes.
File Search
Locate keyword (dependent Search Library. If you create a file or folder, use updatedb to update the Search Library)
Find/-name filename (search by file name)
Find/-name *. conf (search by file extension name)
Find/-type d (view by type)
Find/-name test *-exec ls-l {}\; (find and execute the command)