In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces the relevant knowledge of "how to use the mv command of linux". The editor shows you the operation process through the actual case. The operation method is simple, fast and practical. I hope this article "how to use the mv command of linux" can help you solve the problem.
Mv command
Basic operation of directory
The mv command is used to rename a file or directory or to move a file from one directory to another. Source represents the source file or directory, and target represents the destination file or directory. If you move a file to an existing target file, the contents of the target file will be overwritten.
The mv command can be used to move source files to a target file, or to move a set of files to a target directory. Moving the source file to the destination file has two different results:
If the destination file is the path to a directory file, the source file is moved to that directory with the same file name.
If the destination file is not a directory file, the source file name (there can be only one) becomes the destination file name and overwrites an existing file with the same name. If the source and target files are in the same directory, the function of mv is to change the file name. When the target file is a directory file, there can be multiple source files or directory parameters, and all source files are moved to the target file. All files moved to this directory will retain the previous file name.
Note: the result of mv is different from that of cp. Mv is like a file "moving", and the number of files has not increased. While cp copies files, the number of files increases.
Grammar
Mv (option) (parameter) option
-- backup=: if you need to overwrite a file, overwrite the previous backup;-b: create a backup for the file before it is overwritten;-f: if the target file or directory duplicates with the existing file or directory, then directly overwrite the existing file or directory -I: interactive operation, ask the user before overwriting, if the source file has the same name as the target file or the file in the target directory, ask the user whether to overwrite the target file. The user enters "y" to indicate that the target file will be overwritten, and "n" to cancel the movement of the source file. This avoids mistakenly overwriting the file. -- strip-trailing-slashes: delete the slash "/" in the source file;-S: specify a suffix for the backup file instead of using the default suffix;-- target-directory=: specify that the source file should be moved to the destination directory;-u: perform the move operation when the source file is newer than the destination file or the destination file does not exist. Parameters.
Source file: a list of source files.
Target file: if the "target file" is the file name, rename the file to "target file" while moving the file; if "target file" is the directory name, move the source file to the "target file".
Example
Rename the file ex3 to new1
Mv ex3 new1
Move all files in the directory / usr/men to the current directory (with. Represents):
Mv / usr/men/*. This is the end of the content about "how to use the mv command of linux". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.