What’s in a Name (Reprise)
Having given a file a name, you may want to change it later. Maybe you spelled it wrong in the first place. In any case, you can rename a file by using the mv (lazy typist-ese for move) command.Suppose that you made a file called bugdet.march . Oops, dratted fingers. . . . Type the following line to correct the error in the filename:mv bugdet.march budget.march
After mv , you type the current name of the file and then the name you want to change it to. Note that it can be harder to retype the same typo than to type the name correctly!Linux Because you can’t have two files with the same name in the same directory, if a file already has the name you want to use, mv thoughtfully blows away the existing file (probably not what you want to do). You can use mv -i (like cp -i ) to prevent inadvertent file clobbering.Tip Want to hide a file so that it doesn’t appear in your directory listing? Use a period ( . ) as the first letter of the filename. To see all your files, including hidden files, type
ls -al