Welcome to the Hindi Tutor QA. Create an account or login for asking a question and writing an answer.
Sima in Web Hosting
edited
I have read about copying files with terminal but these examples will help me a lot. So here is what I want to do.

3 Answers

0 votes
Pooja
edited
 
Best answer

Copy A File

The cp command is the primary method for copying files and directories in Linux. Virtually all Linux distributions can use cp. The basic format of the command is:

sudo cp [additional_option] file target_folder

For example:

sudo cp my_file.txt desired-folder

Copy all files from a folder: Change the directory, which you want to copy;

sudo cp -r * /var/www/html

where '/var/www/html' is target folder

Delete a file or folder

sudo rm -rf  index.html

where 'index.html' is target file or folder

Move or Paste a file

mv [file] [directory]

For example, to move info.txt from the actual directory into the config/ directory, type

mv info.txt config/

If you prefix the command with sudo, you are telling the system to run the command as the root user (similar to an Admin account). Example:

sudo mv info.txt config/
0 votes
Pooja

1) By using -i for interactive you will be asked if you would like to replace the file:

cp -i /home/levan/kdenlive/untitelds.mpg /media/sda3/SkyDrive/

or you can use -b to create a backup of your file:

cp -b /home/levan/kdenlive/untitelds.mpg /media/sda3/SkyDrive

2) Same as the above:

cp (-i or -b) /media/sda3/SkyDrive/untitelds.mpg /home/levan/kdenlive

3) Use -R for recursive and -i for interactive:

cp -Ri ~/MyFolder /sda3/

4) This last one can be done via the mv command, move is like cutting:

mv -i ~/MyFile ~/OtherFolder/MyFile

if you want to move a directory, use:

mv -Ri ~/MyDirectory ~/OtherDirectory/
0 votes
Pooja

How to Make a Folder in Ubuntu

The basic Ubuntu create folder command is "mkdir," literally "make directory." Make sure you're in the location you want to create your new folder and then type "mkdir" followed by a space and the name of the folder you want to create.

sudo mkdir Music

Multiple folders at a time With 'mkdir'

If you want to create a bunch of subfolders along with the original folder, you can type "-p" after "mkdir" and a space and then type out the whole string of folders and subfolders you want to make.

mkdir -p /Albums/Rock/Led_Zeppelin

Multiple folders in the same directory

If you want to make multiple folders in the same directory in a single command, you type multiple folder names after the command, separated by a space.

mkdir Rock Blues Jazz Rap

Related questions

...