How Do I Copy and Rename Linux Files?

$ cp kartook.conf.backupĀ  kartook.conf
$ cp stuff stuff.bak

Note: The cp command will overwrite files with the same name without warning. To be prompted before overwriting, use the -i flag, like so:

$ cp -i kartook.conf.backup foldername/kartook.conf
cp: over
kartook.conf.backup foldername/kartook.conf (y/n)?

Renaming Files

Use the mv command to rename a file or move it to another directory, like so:

$ mv stuff junk
$ mv junk trashcan

The first example renames the file stuff as junk, and the second moves the file junk into a directory called trashcan.

Note: The mv command will wipe out files without warning. To be prompted before overwriting, use the -i flag, like so:

$ mv -i stuff junk
mv: overwrite junk (y/n)?

Possibly Related Posts:


Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>