Key Concepts

Review core concepts you need to learn to master this subject

cp Copy

$ cp file1 file1_copy $ cp file1 file2 destination_folder

The shell command cp is used to copy files or directories.

The basic argument structure is cp source destination, where the source is the file/directory to copy to the destination file/directory.

Lesson 1 of 1
  1. 1
    So far we’ve used the command line to navigate the filesystem. We can view directories and files with more detail. We can also use the command line to copy, move, and remove files and directories….
  2. 2
    The ls command lists all files and directories in the working directory. We can use ls as is, or attach an option. Options modify the behavior of commands. For example: ls -a The command abov…
  3. 3
    $ ls -l drwxr-xr-x 5 cc eng 4096 Jun 24 16:51 action drwxr-xr-x 4 cc eng 4096 Jun 24 16:51 comedy drwxr-xr-x 6 cc eng 4096 Jun 24 16:51 drama -rw-r–r– 1 cc eng 0 Jun 24 16:51 …
  4. 4
    How do we view the contents of an individual file in our terminal? We can use cat. The cat command outputs the contents of a specified file. For example: cat action/superwoman.txt will output a…
  5. 5
    Let’s move on to copying, moving, and removing files and directories from the command line. The cp command copies files or directories. Below, we copy the contents of a source file into a destinati…
  6. 6
    To copy multiple files into a directory, use cp with a list of source files as the first arguments, and the destination directory as the last argument. Here, we copy the files file1.txt and **f…
  7. 7
    In addition to using exact filenames as arguments, we can use special characters like * to select groups of files. These special characters are called wildcards. For example, here we use cp to co…
  8. 8
    The mv command moves files. It’s similar to cp in its usage, except mv moves a file without making a copy. To move a file into a directory, use mv with the source file as the first argument and th…
  9. 9
    The rm command deletes files and directories. Here we remove the file unwanted_file.txt from the filesystem. rm unwanted_file.txt The -r is an option that modifies the behavior of the rm comm…
  10. 10
    Congratulations! You learned how to use the command line to view and manipulate the filesystem. What can we generalize so far? * Options modify the behavior of commands: * ls -a lists all conten…

What you'll create

Portfolio projects that showcase your new skills

Pro Logo

How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory

Pro Logo