Learn to move and rename files and directories at the Linux command line.
Linux mv command summary with examples (4:23)
Videos can also be accessed from the YouTube Playlist.
Our twenty-fourth word, or command to memorize is
mv from our category
mv allows you to move or rename files
Recall from the last video (tutorial) we copied files around? Now we'll learn how to move those files around and change names.
Before we start, it helps to think of commands as mini programs and
most follow this structure:
command -option(s) argument(s).
mv command has
14 options and two arguments, the first is the
source and the second is the
Like most commands, help is available here with double-dash
-i, or interactive mode will
prompt you before overwriting files, as the dangerous default with
mv is, like in
cp just to overwrite the files
-uonly moves the source when it is newer, like a backup.
So why is
mv an important command?
mv allows you to customize
files and directories to make them descriptive and useful.
And now you know how to do that.
Okay, the best way to embed this in your memory is by typing in your own terminal window.
Find this on your Mac using a program called Terminal. On Linux use Terminal or Konsole, and currently Microsoft is adding this functionality to Windows.
Here we go, let's do a quick
the name of
video5.txt here has been
bothering me for a while.
Let's do a
mv -i of
source, and rename it
destination, keeping it in this directory.
Oh good. Now when we do an
shows up in the proper order.
Next, let's dive in to stuff where we have three directories, with a
cd stuff, then rename with
mv yourstuff mystuff and then verify.
Ok. And then last let's move that file now in
mystuff, with a
mystuff/video23.txt over to
-i worked, so let's recycle
with the up arrow
↑ and instead
I'll rename it
move it at the same time.
Okay now you know how to use
And you know the syntax for commands, options and arguments.
One last tip about the
So now we know how to move, copy and make files, next we'll cover how
we delete them.
Okay, thanks for visiting today. I hope this was a helpful
introduction to the
For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the categories and a Q&A section, visit:
If you'd like YouTube Channel reminders, click here.
cpcommand, hit Back.
rmcommand, click Next.