Introduction

This section will introduce the following commands:

  • cp - Copy files and directories
  • mv - Move/rename files and directories
  • mkdir - Create directories
  • rm - Remove files and directories
  • ln - Create hard and symbolic links

These five commands are among the most frequently used Linux commands. They are used for manipulating both files and directories.

Why use these command?

Now, some of the tasks performed by these commands are more easily done with a graphical file manager. With a file manager, we can drag and drop a file from one directory to another, cut and paste files, delete files, etc. So why use these old commands?

The answer is power and flexibility. While it is easy to perform simple file manipulations with a graphical file manager, complicated tasks can be easier with the commands. A simple example is:

Copy all files from one directory to another, but only copy files that do not exist in the destination directory or are newer than the versions in destination directory. 

Wildcards

Before using these commands, we need to talk about the special characters that makes these commands so powerful. These special characters are called wildcards.

Using wildcards (which is also known as globbing) allow you to select filenames based on patterns of characters.