20
Q:

how to move file from one directory to another in linux

# Linux - Bash

# syntax:
mv [options] <source-filepath> <destination-filepath>

# example-1 (fundamental - no switches):
mv "C:\Users\File_Name.txt" "C:\Users\SubFolder\File_Name.txt"

# example-2 (fundamental - with switches):
mv -u "C:\Users\File_Name.txt" "C:\Users\SubFolder\File_Name.txt"

# + ------ + ---------------------------------------------------------- +
# | OPTION |  DESCRIPTION                                               |
# + ------ + ---------------------------------------------------------- +
# |   -f   | force move by overwriting destination file without prompt  |
# |   -i   | interactive prompt before overwrite                        |
# |   -u   | update - move when source is newer than destination        |
# |   -v   | verbose - print source and destination files               |
# | man mv | help manual                                                |
# + ------ + ---------------------------------------------------------- +
2
mv path/to/src  to/path/destination
1
mv file1 /tmp
1
mv filename directoryname
2

New to Communities?

Join the community