The main record file/directory copy, Move (rename), delete, and view the contents of the file commands.
First, copy (CP)
Replication requires that the source file (directory) must exist and that the destination file (directory) does not exist to create a new one.
1. copy file FA
- And the new file FB,FB Originally does not exist:
CP FA FB
CP FA DB
2. Copy directory da(must join-r option)
- And the new directory db,db originally does not exist.
Cp-r DA DB
- To the directory DB, the DB must actually exist.
Cp-r da db (Da becomes a subdirectory of db)
Second, mobile (MV)
The move command can also be used to rename a file or directory
1. Move files
- renaming the file fa (Directory da) to FB (directory db), FB does not exist.
MV FA FB
- To move the file fa (Directory da) to the directory DB, the DB must exist.
MV FA DB
2. Move the directory (-r option not available)
- renamed the Directory da to directory db,db originally does not exist.
MV DA DB
- To move the directory da to the directory DB, the DB must exist.
MV DA DB
Third, delete (RM)
1. Delete file FA
RM FA
2. Also delete files FA and FB
RM FA FB
3. Delete directory (the-r option must be added)
Rm-r da (if there is a directory or file under DA, the system will always ask whether to delete the following subdirectory or file, you can join the option-F forcibly delete , do not confirm)
RM-RF DA
Four, display
1. Instructions for displaying the contents of the file are cat, more, head, tail.
Cat/more/head/tail FA
2. Differences
- Cat Display all content
- More pagination display, the space bar page DOWN, b front turn, enter down one line, Pageup,pagedn page, q exit
- The first 10 rows are displayed by the head
- Tail Displays the following 10 rows by default.
commands for copying, moving (renaming), deleting, and viewing the contents of a file from a Linux file/directory