Mark As Completed Discussion

mv

mv is a command used to move a file or a directory. We can specify this using the syntax below, where source and destination are paths to the file or directory that needs to be moved.

Syntax: mv[option]<source><destination>

SNIPPET
1user@localhost:~$ ls
2Documents Pictures Videos example1
3user@localhost:~$ mkdir NewFolder
4user@localhost:~$ mv example1 NewFolder/
5user@localhost:~$ ls
6Documents NewFolder Pictures Videos
7user@localhost:~$ cd NewFolder
8user@localhost:~$ ls
9example1

mv is a helpful command that can also be used for renaming files. If we specify the destination path the same as the source path, but with a different name, then we can rename the file.

SNIPPET
1user@localhost:~$ ls
2Documents Pictures example1
3user@localhost:~$ mv example1 linux_example
4user@localhost:~$ ls
5Documents Pictures linux_example