nerdexam
LPI

010-100 · Question #53

In order to rename the directory ~/bilder/letzter-urlaub to ~/bilder/sommer-2011, which command line could be used?

The correct answer is A. mv ~/bilder/letzter-urlaub ~/bilder/sommer-2011. In Linux, the mv command is used to both move and rename files and directories. Renaming is achieved by specifying a different destination path in the same parent directory.

The Power of the Command Line

Question

In order to rename the directory ~/bilder/letzter-urlaub to ~/bilder/sommer-2011, which command line could be used?

Options

  • Amv ~/bilder/letzter-urlaub ~/bilder/sommer-2011
  • Bmove ~/bilder/letzter-urlaub ~/bilder/sommer-2011
  • Ccp -m ~/bilder/letzter-urlaub ~/bilder/sommer-2011
  • Dcopy -m ~/bilde/letzter-urlaub ~/bilder/sommer-2011
  • Erename ~/bilder/letzter-urlaub ~/bilder/sommer-2011

How the community answered

(33 responses)
  • A
    82% (27)
  • C
    3% (1)
  • D
    9% (3)
  • E
    6% (2)

Why each option

In Linux, the mv command is used to both move and rename files and directories. Renaming is achieved by specifying a different destination path in the same parent directory.

Amv ~/bilder/letzter-urlaub ~/bilder/sommer-2011Correct

The mv command is the standard Unix/Linux utility for moving and renaming files and directories. When the source and destination share the same parent directory but differ in name, mv effectively renames the directory without copying data.

Bmove ~/bilder/letzter-urlaub ~/bilder/sommer-2011

move is not a valid Linux shell command; it is used in Windows CMD environments, not Unix-like systems.

Ccp -m ~/bilder/letzter-urlaub ~/bilder/sommer-2011

cp is the copy command and has no -m flag for renaming; it would duplicate the directory rather than rename it.

Dcopy -m ~/bilde/letzter-urlaub ~/bilder/sommer-2011

copy is not a valid Linux command, and the source path contains a typo (~bilder instead of ~/bilder/), making this doubly incorrect.

Erename ~/bilder/letzter-urlaub ~/bilder/sommer-2011

rename (or prename) is used to rename files based on pattern substitution, not to move or rename directories by specifying explicit source and destination paths.

Concept tested: Linux mv command for renaming directories

Source: https://man7.org/linux/man-pages/man1/mv.1.html

Topics

#mv command#directory rename#file operations

Community Discussion

6
Bao N.Bao N.Jun 24, 2026

A is your answer. On Linux, mv handles both moving and renaming, so pointing it at a new path within the same parent directory is all you need to rename that directory in one shot.

11
Yusuf A.Yusuf A.Jun 26, 2026

A is right, mv handles renames since both paths share the same parent. Does mv actually move data, or just update the directory entry?

4
Toby R.Toby R.Jun 6, 2026

Honestly I almost put E because I kept thinking rename was a real shell command for this, but when I actually sat down at the terminal during practice it was clear that rename works on files with patterns, not for just moving a directory to a new name. mv is the one that handles both moving and renaming for files and directories, so A is the right pick.

2
Nina C.Nina C.Jun 7, 2026

Good point on mv handling both jobs, though worth noting that rename does exist on many Linux systems (usually as a Perl script) and can technically rename a single file too, it just shines when you need to batch-rename with a regex pattern, which is why it felt wrong for the directory case.

0
Nina C.Nina C.Jun 15, 2026

A is right, mv handles both moving and renaming in Linux.

1
Bao N.Bao N.Jun 16, 2026

Yep, mv does both, and the key thing to remember for exam questions is that mv across different filesystems actually copies the data and deletes the source, while mv within the same filesystem just updates the directory entry, so if you see a question about inode behavior after a rename that detail can trip you up.

0
Full 010-100 Practice