Ubuntu Tutorial

Copy Directory : to copy directory or file we use cp command. following are ways to copy directory.

  1. File Explorer: open directory > select directory right click and select Copy or use shortcut ctrl + c > go to desire directory right click and select paste or use shortcut ctrl + v

  2. Using Terminal : use following syntax. source and destination can be directory name or path of directory.

    syntax : cp -arv source destination

    • -a preserve all file attributes, and also preserve symlinks.
    • -r copy directories recursively.
    • -v print what is being done.

image
copy directory using terminal

following are some examples to copy directory.

  • cp -arv site /home/ubuntu/Documents/"ushi mushi"/
  • cp -arv /home/ubuntu/Downloads/bootstrap-4.3.1/site /home/ubuntu/Documents/"ushi mushi"/

-i option with cp commmand print message to overwrite files. type y for yes and n for no. in following examples vendor directory is copied into copy directory first. when -i option get used with cp commmand cp command print message to overwrite files.

image
cp command with -i option

Move Directory : to move directory or file we use mv command. following are ways to move directory

  1. File Explorer: open directory > select directory right click and select Cut or use shortcut ctrl + x > go to desire directory right click and select paste or use shortcut ctrl + v
  2. Using Terminal : use following syntax. source and destination can be directory name or path of directory.

    syntax : mv source destination

image
move directory using terminal

Rename Directory : to rename directory we can use mv command. following are ways to rename directory

  1. File Explorer: open directory > select directory right click and select Rename or use shortcut F2 or fun + F2 > enter new name and click on Rename
  2. Using Terminal : use following syntax. source will be directory name and destination can be new directory name or path of directory with new directory name.

    syntax : mv source destination

image
rename directory using terminal

Moving Directory to Trash (Recycle Bin) : following are ways to move directory or file to Trash (Recycle Bin) .

  1. File Explorer: open directory > select directory right click and select Move to Trash or use shortcut delete
  2. Using Terminal : use following syntax.

    syntax : mv directory-name ~/.local/share/Trash/files

image
move directory to trash using terminal

Delete Directory (permanently) : following are ways to delete directory permanently.

  1. File Explorer: open directory > select directory use shortcut shift + delete > it will prompt message for confirm delete select delete
  2. Using Terminal : be sure directory is empty otherwise it will through error as rmdir: failed to remove 'docs': Directory not empty . use following syntax for deleting directory permanently.

    syntax : rmdir directory-name

image
delete directory permanently using terminal