Post icon

Moving Files with Terminal

Terminal makes it quick and easy to move files around Mac OS X. This quick tutorial will explain the move command and its uses

Warning: Using Terminal can be very dangerous and is for advanced users only. Be very, very careful with what you do in Terminal as you can cripple your Operating System.

The mv (move) command is your key to moving files and directories around the file system. Your basic command will look like mv path/to/file.ext path/to/newlocation/file.ext

In the example below I am going to move a file from my Documents folder to my Desktop.

  1. First I cd (change directories) into Documents by entering cd Documents/First I cd into the Documents folder
  2. Now that I’m in my Documents folder I’ll move my file to the desktop by entering mv myFile.txt ~/Desktop/myFile.txtuse the mv command to move your file
  3. Next I’ll change directories to my Desktop folder and use the ls (list) command to see that my file has been successfully moved. Change directories to the desktop and use ls to view that the file was moved

As you can see the file has been successfully moved to the Desktop. In this tutorial I used the cd command to change to my desired directory before moving my file, but technically I could just issue the command from any location as long as I know the path. For example, to do the same command if I were in a different directory, I would enter mv ~/Documents/myFile.txt ~/Desktop/myFile.txt This is great because you don’t have to actually navigate to the directory as long as you know the path.

Leave a Reply