Teaching Cyber Security (Part 9)

in #linux7 years ago (edited)

This is the 9th post of a series for teaching cyber-security in a coding-club. Read [part 8]

Create directories and move files

Creating directories

We have a lot of files and folders on our home directory, so we are going to do some tidying.

brain definition Command: mkdir NAME_OF_NEW_DIR

Definition: The mkdir command creates a new folder (or directory). so, mkdir myfolder will create a new folder called myfolder at the level we are at.

We are going to create a new folder were we will move all the clutter. Create a directory called mystuff by typing:

mkdir mystuff

use ls -l to confirm that it has been created.

Moving files

Let's move all the clutter away.

brain definition Command: mv file directory

Definition: The mv, or move command takes two arguments: The name of the file we want to move and the directory where we want to move it. It will only work in that order.

Let's try it out. Assume there is a file called index.html.

mv index.html mystuff/

Remember that you can do mv i and then hit tab to autocomplete and then type m and again tab ).

The file index.html should now have disappeared from the home directory. Let's make sure it ended up where we wanted it to be:

ls mystuff/

Is it there? Can you move any other files to your new folder? Check that it worked:

ls -a mystuff/

Moving directories

It turns out that the move (mv) command can also move entire directories. To use it you write:

mv <source directory> <destination directory>

Let's try it out. let's move test-website into mystuff:

mv test-website/ mystuff/

In the example above, we are passing the <source> (the test-website/ directory) as the first argument and the second argument, (the <destination>) as the mystuff/. You can now find the test website at /mystuff/test-website/.

Let's move on to more advanced commands in [Part 10]

Coin Marketplace

STEEM 0.19
TRX 0.15
JST 0.029
BTC 63878.47
ETH 2625.83
USDT 1.00
SBD 2.79