How To Copy/Move Files and Folders In Redhat Linux
How to Copy|Move Files and Folders In Linux Redhat
In This Post You'll Learn How to Copy|Move Files And Folders In Linux Redhat
We Have Some Command For You. Following These Commands For Move|copy File and Folder Into other Folders or Other Destination.
cp <source> <destination>
Replace <source> with the name of the file you want to copy, and <destination> with the name of the directory where you want the file to go.
To copy the file yourfile.txt to the directory folder/ in your home directory, move to your home directory and type.
cp File.txt Folder/
Read the cp man page (type man cp at the shell prompt) for a full list of the options available with cp. Among the options you can use with cp are the following:
- -i (interactive) — Prompts you to confirm if the file is going to overwrite a file in your destination. This is a handy option because it can help prevent you from making mistakes.
- -r (recursive) — Rather than just copying all the specified files and directories, this copies the whole directory tree, subdirectories and all.
- -v (verbose) — Shows the progress of the files as they are being copied.
Now that you have the file File.txt in the Folder/ directory, use cp -i to copy the file again to the same location.
cp -i File.txt Folder/ cp: overwrite 'Folder/File.txt'?
To overwrite the file that is already there, press [Y] and then [Enter] . If you do not want to overwrite the file, press [N] and [Enter] .
How TO Move Files And Folders.
To move files, use the mv command. For more about mv, refer to the mv man page (type man mv).
Common options for mv include the following:
- -i (interactive) — Prompts you if the file you have selected overwrites an existing file in the destination directory. This is a good option, because like the -i option for cp, you are given the chance to make sure you want to replace an existing file.
- -f (force) — Overrides the interactive mode and moves without prompting. Unless you know what you are doing, this option is dangerous; be very careful about using it until you become more comfortable with your system.
- -v (verbose) — Shows the progress of the files as they are being moved.
If you want to move a file out of your home directory and into another existing directory, type the following (you need to be in your home directory):
mv File.txt Folder/
Alternatively, the same command using absolute pathnames looks like
mv File.txt /home/ramuser/File.txt /home/ramuser/Folder/
How To Use These Commands In Linux Redhat.


Leave a Comment