Copying files under Linux is similar to copying files under DOS. Here's an example using the cp (copy) command: $ cp goulash recipes/hungarian
$ cp stuff stuff.bak


The first example copies the goulash file from the current directory and stores it in your recipes/hungarian directory. The second example creates a file called stuff.bak in the current directory that is identical to the source file stuff.


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 goulash recipes/hungarian
cp: overwrite recipes/hungarian/goulash (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)?