Table of contents
No headings in the article.
- cp -> Use the cp command to create a copy of the contents of the file or directory specified by the SourceFile or SourceDirectory.
syntax -> cp [OPTION]source destination
example: copy file1 (file) in folder1 (directory)
example: copy delhi(directory) to india(directory)
-r option used for directory
-v option used for view
- mv -> mv is used to move one or more files or directories from one place to another in a file system like UNIX. It has two distinct functions:
(i) It renames a file or folder.
(ii) It moves a group of files to a different directory.
syntax: mv [option] source destination
option -i -> Like in cp the -i option makes the command ask the user for confirmation before moving a file that would overwrite an existing file, you have to press y for confirm moving, any other key leaves the file as it is. option doesn’t work if the file doesn’t exist, it simply rename it or move it to new location.
option -i -> It specifies an interactive process and specifies a prompt on standard error before going to move a file that will overwrite an old file. The move is initiated if the response through the standard input starts with the 'Y' or 'y' character.
option -f -> It stands for force. In this option, force can overwrite the destination.
- rm -> This command is used to remove a file. The command line doesn't have a recycle bin or trash unlike other GUI's to recover the files. Hence, be very much careful while using this command. Once you have deleted a file, it is removed permanently.
syntax : rm [option] filename
Removing one file at a time
Removing more than one file at a time
rm options:
rm *extension: Used to delete files having same extension.
rm -r or R ->To delete a directory recursively.
rm -rf -> Remove a directory forcefully.
rm -v -> To remove a test.txt file from your current working directory
rm -i -> (To confirm) you before removing every file
rm -Iv -> To confirm whether you want to delete more than 3 files
rm -d -> To remove empty directories
rm -rfv -> To remove every file and subdirectories
rm -rvi -> It keeps asking you to confirm the removal.
Thanks for reading to the end; I hope you gained some knowledge.❤️🙌
- PARAMVEER SINGH :)