Example Club Page

From Club Ubuntu

Jump to: navigation, search

(the following structure of a club page is tentative and subject to frequent revision as we work out the most intuitive and ergonomic approach, also feel free to improve the wiki formating if you think it can be made more attractive)

Contents

Name

cp

What it does

The cp command copies files or directories.

When to use it

The cp command is one of the most commonly used utilities. You are likely to find it useful any time you would like to make a copy of a file or directory.

Use Cases

  1. Alice has written a paper for school and saved it in her /home directory. She wanted to take a copy of this paper with her on a flash drive, so she used the cp command to copy the paper from her home directory to the flash drive.
  2. Bob has saved a collection of family photos in a directory called /images. He is concerned that his internal hard drive might fail so he uses the cp command to copy the entire directory and all of its contents onto an external hardrive.

(More use cases can be added, you can't have too many, and they can become increasingly elaborate in order to illustrate the various permutations of options)

How to use it

cp uses the following syntax: "cp [options] source [source2 source3..] destination" This can be used to copy a single source file or directory to a destination file or directory, or a list of sources to a single directory.

Examples

(examples are an important part of club pages, there should be A LOT of them, and each example should be followed by a written description of what this example will do)

cp essay.txt /media/flashdrive/homework

This example will copy the file essay.txt (located in the current directory)to a directory on your flashdrive called homework.

cp -r ./images ~/album

This example will copy all of the files in the images directory into a directory called album in your home directory.

cp paper1 paper2 paper3 ~/mypapers 

This example will copy three files (paper1, paper2, and paper3) to a directory called mypapers in your home directory.

(and so on.. there cannot be too many examples)

Most Common Options

(A comprehensive list of options is probably not necessary, for that there is always man, the purpose here is to list the most useful and most common options for this command)

-r this option will recursively copy the contents of the directory and any directories contained in it.

-a this option will preserve important details about the file so that it can be archived.

Personal tools
community