Question | Click to View Answer |
Open up Terminal and change to the Desktop directory (the terms 'directory' and 'folder' are used interchangeably). |
$ cd ~/Desktop
~ stands for the home directory Desktop is a folder (aka directory) in the home directory |
Create a directory called blah_blah. |
mkdir blah_blah
|
Change the directory to be in the blah_blah directory. |
cd blah_blah
|
Print the current directory the shell is in. |
pwd
pwd stands for 'print working directory'. The shell is currently in the blah_blah directory. |
Make the file meow.txt. |
touch meow.txt
|
List all the files that are in the blah_blah directory. |
ls
This command shows the contents of the blah_blah directory ( the meow.txt file in this example). |
Add the text "cats lick themselves" to the meow.txt file. |
echo cats lick themselves >> meow.txt
|
Print the contents of the meow.txt file in the command line. |
cat meow.txt
|
Change back to the Desktop directory. |
cd ~/Desktop
The symbol ~ stands for the home directory. |
Create a directory called shake_n_bake. |
mkdir shake_n_bake
|
Move the ~/Desktop/meow.txt file to the ~/Desktop/shake_n_bake directory. |
mv ~/Desktop/blah_blah/meow.txt ~/Desktop/shake_n_bake
The first directory is the file location and the second is the destination. |
Create a file called woo_hoo in the shake_n_bake directory. |
touch ~/Desktop/shake_n_bake/woo_hoo
If you're already in the shake_n_bake directory, this will also work: touch woo_hoo
|
Copy ~/Desktop/shake_n_bake/woo_hoo file to the ~/Desktop directory. |
cp ~/Desktop/shake_n_bake/woo_hoo ~/Desktop
# Or, from the shake_n_bake directory:
cp woo_hoo ~/Desktop/
|
Delete the ~/Desktop/woo_hoo file. |
rm ~/Desktop/woo_hoo
|
Delete the ~/Desktop/shake_n_bake/ directory. |
rm -rf ~/Desktop/shake_n_bake/
|
Delete the ~/Desktop/blah_blah/ directory. |
rm -rf ~/Desktop/blah_blah/
|