What are common mv options?

079

The mv command has several options that enhance its functionality. Here are some common options:

  1. -i (interactive): Prompts before overwriting an existing file.

    mv -i source.txt destination.txt
  2. -f (force): Moves files without prompting, even if it means overwriting existing files.

    mv -f source.txt destination.txt
  3. -n (no clobber): Prevents overwriting an existing file. If the destination file exists, the move will not occur.

    mv -n source.txt destination.txt
  4. -v (verbose): Displays detailed information about the move operation, showing what is being moved.

    mv -v source.txt destination.txt

Example Usage

To move a file with prompts for confirmation if it exists:

mv -i file.txt /path/to/destination/

To move multiple files and see what is being moved:

mv -v *.txt /path/to/destination/

These options can be combined as needed. If you have more questions or need further examples, feel free to ask!

0 Comments

no data
Be the first to share your comment!