Ubuntu 18.04 – shell commands copy, move and delete items (files/directories)

Copy – Use cp if you want to copy files and directories

SYNTAX
cp [OPTION]... SOURCE... DIRECTORY

EXAMPLE copy file
cp xab xtest/
Working with files and directories, <span>Ubuntu 18.04 – shell commands copy, move and delete items (files/directories)</span>, KandZ

Some Options

  • -n does not overwrite a file that exists
  • -i promts you before overwriting a file
  • -u overwrites if source file is newer
EXAMPLE copy directory
cp -r Videos xtest/
Working with files and directories, <span>Ubuntu 18.04 – shell commands copy, move and delete items (files/directories)</span>, KandZ

Move/Rename files with mv

SYNTAX
mv [OPTION]... SOURCE DEST

EXAMPLE move file
mv xae xtest/
Working with files and directories, <span>Ubuntu 18.04 – shell commands copy, move and delete items (files/directories)</span>, KandZ
EXAMPLE rename file
mv xae newXAE
Working with files and directories, <span>Ubuntu 18.04 – shell commands copy, move and delete items (files/directories)</span>, KandZ

Some Options

  • -n does not overwrite a file that exists
  • -i promts you before overwriting a file
  • -u overwrites if source file is newer

Remove file and directories with rm

SYNTAX
rm [OPTION]... FILE...

EXAMPLE remove file
rm xab
Working with files and directories, <span>Ubuntu 18.04 – shell commands copy, move and delete items (files/directories)</span>, KandZ
EXAMPLE remove directory
rm -rf Videos/
Working with files and directories, <span>Ubuntu 18.04 – shell commands copy, move and delete items (files/directories)</span>, KandZ

Some Options

  • -f ignore nonexistent files and arguments, never prompt
  • -i promts you before overwriting a file
  • -r remove directories and their contents recursively

You can also remove a directory with rmdir

SYNTAX
rmdir dir

EXAMPLE
rmdir newDir/
Working with files and directories, <span>Ubuntu 18.04 – shell commands copy, move and delete items (files/directories)</span>, KandZ

Create directory with mkdir

SYNTAX
mkdir [OPTION]... DIRECTORY...

EXAMPLE
mkdir newDir
Working with files and directories, <span>Ubuntu 18.04 – shell commands copy, move and delete items (files/directories)</span>, KandZ

THE END!!!

76890cookie-checkUbuntu 18.04 – shell commands copy, move and delete items (files/directories)Ubuntu 18.04 – shell commands copy, move and delete items (files/directories)

Related posts

2 Thoughts to “Ubuntu 18.04 – shell commands copy, move and delete items (files/directories)

  1. […] Ubuntu 18.04 – shell commands copy, move and delete items (files/directories) […]

  2. […] Ubuntu 18.04 – shell commands copy, move and delete items (files/directories) […]

Comments are closed.