Home / VPS & Dedicated / The Copy Command in Linux

The Copy Command in Linux

File copy graphical dialog
This week, I will be featuring several Linux/Unix commands that are very useful and important to know if you have a virtual private server or dedicated server. All of the commands can be executed from an SSH connection. If you have Mac OS X or Linux, you can use the terminal that comes with them to connect via SSH. If you have Windows, you should download a free client like PuTTY.

The first command to know is “cp”, which is the copy command. To copy one file to another location, navigate to that directory and type: cp filename /home/user/newlocation

To copy all of the files in a directory, type: cp * /home/user/newlocation

To copy files and directories, type: cp -r * /home/user/newlocation

By default, the cp command is silent, meaning you will not see the progress of long copies. If you want to see your multiple files confirmed as they are copied, use the “-v” verbose flag: cp -v. Adding the “-f” flag will force the removal of existing files without prompting you, which can be very dangerous. In general, use the cp command with caution and be sure you know ahead of time what you intend to copy. For more information about the cp command, type: man cp at the prompt.

Photo Source: Flickr

Check Also

servers

Importance of web hosting to business

The world of business is very ruthless and unfair in some cases. It is a …