The Unix `mv` command can move a file or give it a new name by taking the current filename first and the new filename second. That simple order matters. Once it clicks, renaming documents in Linux or macOS feels much like moving a paper into a folder with a fresh label.

Multiple Choice

What command should Shakira use to rename "untitled_essay.doc" to "draft1.doc"?

The command to rename files in a Unix-like operating system, including Linux and macOS, is `mv`, which stands for "move." This command is used not only to move files from one location to another but also to rename them by specifying the current name and the new name you desire. In this case, Shakira needs to rename the file "untitled_essay.doc" to "draft1.doc." The correct command, `mv untitled_essay.doc draft1.doc`, takes the existing file, which is the first argument, and changes its name to the second argument. Therefore, this command accurately captures the action Shakira wants to perform—renaming the file. The other options do not correctly execute the desired renaming operation for various reasons. Some utilize the `rename` command, which is not standard on all systems and may not function as intended in the context given here. Meanwhile, others have their arguments in the incorrect order for renaming tasks. The chosen command properly reflects the standard Unix command pattern needed for renaming files.

Renaming a file in a Unix-like system is often as simple as moving it to a new name. The mv command, short for “move,” handles both jobs: it can change a file’s location, its name, or both at once. To rename untitled_essay.doc to draft1.doc, use:


mv untitled_essay.doc draft1.doc


The command reads from left to right. The first name is the file that exists now; the second is the name you want it to have. If both files are in the current folder, `mv` changes the name without creating a separate copy. The file’s contents stay the same.

It’s a small command, but it’s a handy one to understand. File names are labels, and clear labels make a busy folder much easier to manage. A rough draft, a final draft, and a signed version can all contain similar material. Giving each one a useful name helps prevent mix-ups.

## Why a move command can rename a file

The word “move” may sound as if `mv` only shifts files between folders. It does that, but it can also move a file to a different name in the same folder.

Think of a folder as a set of addresses. A file has a name at its current address. When you run:

```bash

mv untitled_essay.doc draft1.doc

you tell the system to place the existing file under the new name. Since no different folder is named, it remains where it is. The change is much like updating a label on a storage box rather than carrying the box to another room.

The same command can do both tasks at once. For example:


mv untitled_essay.doc essays/draft1.doc

Here, untitled_essay.doc is moved into the essays folder and given the name draft1.doc. The source goes first, and the destination comes second—a simple pattern worth remembering.

The order matters

For a rename, the general form is:


mv current_name new_name

The first argument tells the shell what to find. The second tells it where to put that file, including what name to use. Reverse them, and the command describes a different action. If a file named draft1.doc already exists, putting it first could move that file instead.

Before pressing Enter, read the command once from left to right: “Move this existing item to this destination.” It’s a tiny pause that can save a lot of head-scratching, especially when filenames look alike.

A command line does exactly what its arguments say, not what someone meant to type. That precision is powerful, though it can feel a little unforgiving at first.

What happens if the new name is already taken?

mv can replace an existing file at the destination, depending on the system and how the command is used. That means a file named draft1.doc could be overwritten by the file being renamed. If that older file matters, the result may be hard to undo.

A cautious approach is to check the folder first:


ls

The ls command lists the items in the current directory. You can also ask mv to prompt before replacing a file:


mv -i untitled_essay.doc draft1.doc

The -i flag means “interactive.” If a file with the destination name is already present, the command asks before replacing it. The exact prompt can vary, but the idea is simple: you get a chance to stop and reconsider.

Some systems also offer a no-clobber flag, commonly written as -n, to prevent replacement. Command behavior can differ across tools and operating systems, so it’s wise to check the local manual page when a detail matters:


man mv

Manual pages can look dense, but you don’t need to read every line. Search for the flag you’re curious about and focus on the examples or description.

Names, spaces, and paths

File names with spaces need a little extra care. The shell treats spaces as separators between arguments, so a name like my essay.doc may be read as two separate pieces unless you quote it:


mv "my essay.doc" "draft one.doc"

Single quotes work too:


mv 'my essay.doc' 'draft one.doc'

Quotes tell the shell to treat the words inside as part of one filename. This is useful not just with spaces, but also with characters that have special meaning in a shell.

You can use full paths as well:


mv /home/shakira/untitled_essay.doc /home/shakira/draft1.doc

A path describes where a file lives. The example uses an absolute path, which starts from the top of the directory tree. A relative path, such as essays/draft1.doc, starts from the current directory. If a command says a file cannot be found, a typo or an unexpected current directory is often the culprit. Running pwd shows the current directory; running ls helps confirm what’s inside it.

Is rename the same thing?

Some Unix-like systems include a command called rename, but it isn’t as universal as mv. What it does—and the way its arguments are written—can vary between systems. On some machines, it’s built for changing patterns across many filenames. On others, it may not be installed at all.

For one straightforward rename, mv is the dependable choice on Linux and macOS. It’s built into the basic set of file-management tools, and its source-then-destination pattern is consistent. When working with a system you don’t know, you can check whether a command exists with command -v rename or look up its local documentation.

This difference is a useful reminder: familiar command names don’t always behave identically everywhere. The shell may be similar, while the set of installed tools varies.

A few habits that make file changes safer

Before renaming an important file, confirm the source name and destination. If you’re unsure, list the folder contents. For a valuable document, keeping a separate copy can be sensible, especially before making several changes in a row.

It also helps to choose names that explain what a file contains. A name like draft1.doc is clearer than untitled_essay.doc, though a date or topic can make it clearer still—for example, history-essay-draft1.doc. A consistent naming style acts like a tidy filing system: less time spent searching, fewer accidental edits.

If you make a typo in the new name, you can usually rename the file again with mv, as long as you know its current name. For instance:


mv drfat1.doc draft1.doc

That command fixes a misspelled filename by moving it to the intended one. But if the source name is uncertain, use ls first rather than guessing.

The central idea stays simple: mv takes an existing file as its first argument and gives it a destination as its second. To rename untitled_essay.doc as draft1.doc, run mv untitled_essay.doc draft1.doc. Once that pattern clicks, moving and renaming files from the command line feels less like a trick and more like a clear instruction.