How do I rename a file in UNIX?
The mv is a Unix command that renames one or more files or directories. The original filename or directory name is no longer accessible. Write permission is required on all directories and files being modified.
mv Syntax
You need to use the mv command to rename a file as follows:
mv old-file-name new-file-name
Examples
Open the terminal (bash shell prompt) and type the following command to list file names:
ls ls -l
In this example, rename a file called data.txt to letters.txt, enter:
mv data.txt letters.txt ls -l letters.txt
File is renamed so the following command will display an error on screen:
ls -l data.txtOutputs:
ls: cannot access data.txt: No such file or directory
Suggested Readings:
Type the following command to read mv command man page:
man mv
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop












{ 3 comments… read them below or add one }
Hi,
How can i read a multiples files from MF/Cobol, whose inside programs is assigned to read “file1″.
i am getting: 201108251343file1
201108251430file1
201108251740file1
Is there an routine to added the 3 files into one file1.
Many Thanks.
cat 201108251343file1 201108251430file1 201108251740file1>file1
it is use ful for engg