Rename a directory using Linux/Unix command


To rename a directory in a Linux or Unix-based system you can make use of quite a few commands, one of them is an mv command. Let's see some examples,

Syntax: mv fromDirName toNewDirName

% mkdir myDir

% cd myDir

% touch myFile.txt

% cd ..

% mv myDir myDir1

% ls
myfile.txt






Author Info:

Rakesh (He/Him) has a Masters Degree in Computer Science with over 15+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright Code2care© 2024 | Privacy Policy | About Us | Contact Us | Search