Rename Directory in linux computer system can be performed via terminal using a simple linux command. While directory or folder also can be created, modified, grown, and shrunk (truncated). In most cases, software programs that are executed on the computer handle these operations, but the user of a computer can also modify directory if necessary.

For instance, directories are normally renamed by program in response to user commands, but the user can also rename these directories directly by using a file manager program such as Windows Explorer (on Windows computers) or via terminal emulator with command (CLI) on linux system.

How To Rename Directory in Linux?

You can easily rename directory in linux via terminal on your system using the command line with the following methods mv, and Information.

Linux Command To Rename Directory

“mv” command is used to move files or directory, although it can also be used to rename files and directories. It also allows you to move one or more files or directories from one place to another directory. This is one of the most common administrative tasks you can perform when working on terminal with the linux command line.

To rename directory in linux:

  1. Open “Terminal” on your linux system.
  2. Keep on the current working directory or go to the specific directory (use “cd” to change directory) that you want to rename the directory inside it.
  3. Use “mv” command with option as alternative and specify the “directory-name”.
  4. The syntax for using the “mv” command as shown below.
    mv [option] [directory-name] [new-directory-name]
    • Example Rename a directory in the current directory.
      mv MyPicture MyFile
    • The command above will rename “MyPicture” to “MyFile”.
    • Another Example Rename a directory anywhere.
      mv /home/user/MyPicture /home/user/MyFile
    • Rename a directory with option in the current working directory.
      mv -v MyPics MyFiles
    • “-v” (verbose) option will display what is being done.
  5. Done, now you’ve already renamed the directory.

More Information

“mv” command related information can be obtained with “–help”.

mv --help

Usage: mv [OPTION]… [-T] SOURCE DEST
or: mv [OPTION]… SOURCE… DIRECTORY
or: mv [OPTION]… -t DIRECTORY SOURCE…
Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.

Mandatory arguments to long options are mandatory for short options too.

In general, a directory can contain either a list of files or a list of links to files. Within this definition, it is of paramount importance that the term “file” includes “directories”. This permits the existence of directory hierarchies, i.e., directories containing sub-directories.

A name that refers to a file within a directory must be typically unique. In other words, there must be no identical names within a directory. However, in some operating systems, a name may include a specification of type that means a directory can contain an identical name for more than one type of object such as a directory and a file.

License: CC-BY-SA Creative Commons License
☝️