Get Started with Ubuntu 19.04 by Vogel Matt

Get Started with Ubuntu 19.04 by Vogel Matt

Author:Vogel, Matt [Vogel, Matt]
Language: eng
Format: epub
Published: 2020-06-05T16:00:00+00:00


12.8 Copying and Moving Files and Directories

It may be necessary to copy or move files and directories from time to time. The Linux command line interface has several commands that can be used to copy or move files and directories.

The following commands are covered in this section:

12.8.1 cp

12.8.2 mv

12.8.1 cp

The cp command is used to copy files and directories. The basic syntax for the cp command is cp filename newfilename .

The cp command may require root permissions to work depending upon the permissions of the file so you may have to use the sudo command.

The following subsections are covered in this section:

12.8.1.1 Copy a file to the same directory

12.8.1.2 Copy a file to a different directory

12.8.1.3 Copy a file from one directory to another

12.8.1.4 Copy a directory

12.8.1.1 Copy a file to the same directory

In the example below, the ls command is used to list the current files, the cp command is used to copy myfile1 to file2 in the current directory, and the ls command is used to verify the file copy. In this example the cp command is used to make a copy of the file and give it a new name.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.