Rename File in linux computer system can be performed via terminal using a simple linux command. While file 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 file if necessary.

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

How To Rename File in Linux?

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

Linux Command To Rename File

“mv” command is used to move files, although it can also be used to rename files. 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 file 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 file inside it.
  3. Use “mv” command with option as alternative and specify the “file-name”.
  4. The syntax for using the “mv” command as shown below.
    mv [option] [file-name] [new-file-name]
    • Rename a file in the current directory.
      mv doc.txt document.txt
    • The command above will rename “doc.txt” to “document.txt”.
    • Rename a file with option in the current working directory.
      mv -v doc.txt document.txt
    • “-v” (verbose) option will display what is being done.
  5. Done, now you’ve already renamed the file.

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 modern computer systems, files are typically accessed using names (filenames). In some operating systems, the name is associated with the file itself. In others, the file is anonymous, and is pointed to by links that have names. In the latter case, a user can identify the name of the link with the file itself, but this is a false analogue, especially where there exists more than one link to the same file.

Many computer systems use extensions in file names to help identify what they contain, also known as the file type. Extensions consist of a dot (period) at the end of a file name, followed by a few letters to identify the type of file. An extension of .txt identifies a text file; a .doc extension identifies any type of document or documentation, and so on.

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