Unix command that moves one or more files or directories from one place to another
via Wikipedia infobox
In the first synopsis form, the mv utility shall move the file named by the source file operand to the destination specified by the target file . This first synopsis form is assumed when the final operand does not name an existing directory and is not a symbolic link referring to an existing directory. In this case, if source file names a non-directory file and target file ends with a trailing character, mv shall treat this as an error and no source file operands will be processed. 2. If the source file operand and destination path resolve to either the same existing directory entry or different directory entries for the same existing file, then the destination path shall not be removed, and one of the following shall occur: 3. If the source file operand and destination path name distinct directory entries, then the source file operand is removed, no error occurs, and no diagnostic is issued. 3. The mv utility shall perform actions equivalent to the rename () function defined in the System Interfaces volume of POSIX.1-2017, called with the following arguments: 6. The file hierarchy rooted in source file shall be duplicated as a file hierarchy rooted in the destination path. If source file or any of the files below it in the hierarchy are symbolic links, the links themselves shall be duplicated, including their contents, rather than any files to which they refer. The following characteristics of each file in the file hierarchy shall be duplicated: When files are duplicated to another file system, the implementation may require that the process invoking mv has read access to each file being duplicated. If files being duplicated to another file system have hard links to other files, it is unspecified whether the files copied to the new file system have the hard links preserved or separate copies are created for the linked files. If the duplication of the file characteristics fails for any reason, mv shall write a diagnostic message to standard error, but this failure shall not cause mv to modify its exit status. Prompt for confirmation if the destination path exists. Any previous occurrence of the -f option is ignored. The standard input shall be used to read an input line in response to each prompt specified in the STDERR section. Otherwise, the standard input shall not be used. The input files specified by each source file operand can be of any file type. Provide a default value for the internationalization variables that are unset or null. (See XBD Internationalization Variables for the precedence of internationalization variables used to determine the values of locale categories.) If set to a non-empty string value, override the values of all the other internationalization variables. Determine the locale for the behavior of ranges, equivalence classes, and multi-character collating elements used in the extended regular expression defined for the yesexpr locale keyword in the LC MESSAGES category. Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multi-byte characters in arguments and input files), the behavior of character classes used in the extended regular expression defined for the yesexpr locale keyword in the LC MESSAGES category. Determine the locale used to process affirmative responses, and the locale used to affect the format and contents of diagnostic messages and prompts written to standard error. [XSI) ] ![[Option Start]]( Determine the location of message catalogs for the processing of LC MESSAGES. ![[Option End]]( Prompts shall be written to the standard error under the conditions specified in the DESCRIPTION section. The prompts shall contain the destination pathname, but their format is otherwise unspecified. Otherwise, the standard error shall be used only for diagnostic messages. Some implementations mark for update the last file status change timestamp of renamed files and some do not. Applications which ma
~5 min read
mv is a shell command for renaming and moving files and directories. If both items are on the same file system, the command renames; otherwise items are copied to the destination and the old items are removed (more specifically unlinked). To move between two directories, the user must have write permission for both because the command modifies the content of both. For a rename, an item's timestamp is not modified.
On Unix implementations derived from AT&T Unix, cp, ln and mv are implemented as a single program with hard-linked binaries.
Excerpt from a page describing this subject · 18,442 chars · not written by Vinony
via Wikidata · CC0
via Wikidata sitelinks · CC0
Discovered by embedding cosine similarity (sentence-transformers MiniLM, 384-dim).