pwd
- pwd View the full path of the current directory
cd - adjust location (go back, open folder, etc.)
- cd directory name: open the specified directory
- cd ~: Open the current user's home directory
- cd ..: go back to the previous directory
- cd -: return to the directory
- cd /: open the root directory
ls - displays all files and folders in the current path
- ls -l: View the list of files in the current directory in one column
- ls -a: View all files in the current directory (including hidden files)
- ls -la: View all files in the current directory in a list
mkdir - create file directory
- mkdir folder name: create folder
- mkdir -p: recursively create a multi-level directory
rmdir - delete file directory
- rmdir directory name: delete the specified directory
- rmdir -p directory name: recursively delete the specified directory and intermediate directories
rm - delete a file or directory
- rm -f: Force delete the specified file
- rm -i: ask to delete before deleting
- rm -r: delete recursively
- rm -rf directory or file: force delete a file or directory
- rm -ri directory or file: ask for confirmation to delete before deleting
- Note: Because the lethality of forced deletion is too great, it is generally not recommended to use rm -rf for file deletion;
- Without the r parameter in the rm command, the directory cannot be deleted, only the file can be deleted.
cp - copy a file or directory
- cp -r: recursive continuous copy, for the copy behavior of directories
- cp -f: Forced copying, when there are repetitions or other doubts, the user will not be asked, and the forced copying will be performed directly
- cp -p: save attributes of source files and directories
- cp -i: ask user before overwriting existing directory
- cp -r directory 1 directory 2: recursively copy all files and folders of directory 1 to directory 2
- cp -ri directory 1 directory 2: ask the user before overwriting the original directory when performing a copy operation
mv-move file (cut), modify file name
- mv -b: If the file is overwritten, back up before overwriting
- mv -f: force overwrite if target file already exists
- mv -i: If the target file exists, it will ask whether to overwrite
- mv file 1 file 2: change the name of file 1 to file 2) (rename the file)
- mv directory 1 directory 2: move the files of directory 1 to directory 2 (move the files of directory 1 to directory 2)