- 13. Terminal
- 13.5. Exercises: Terminal
13.5. Exercises: Terminal
- If you haven’t done so already, set up your command line environment with
instructions from the Setting Up Your Terminal appendix.
- Using your terminal, navigate to your Home directory using
ls to view the contents of your Home directory.
cd to move into your Desktop directory. For most, the command to do
cd Desktop/ since the Desktop is most often a child of the Home
- In the terminal, use
mkdir to create a folder on the Desktop called
“my_first_directory”. Look on your Desktop. Do you see it?
cd my_first_directory/ to move inside that directory.
pwd to check your location.
- There, make a file called “my_first_file.txt” with
- Open the file and write yourself a message!
- Back in the terminal, list the contents of your current directory from the
- Make a copy of your “my_first_file.txt” from its current spot to directly
on the Desktop with
cp my_first_file.txt ../my_first_copy.txt.
- Move back out to your Desktop directory from the terminal with
ls in the terminal to verify your “my_first_copy.txt” on your
Desktop. Open it up. Is it the same as your first file?
- Move your copied file into your “my_first_directory” with
mv my_first_copy.txt my_first_directory/.
ls to see that the copied file is no longer on your Desktop.
cd my_first_directory/, followed by
ls to confirm that your
copy has been moved into “my_first_directory”.
cd .. to get back out to your Desktop.
rm -r my_first_directory/ and do a visual check, as well as
on your terminal, to verify that the directory has been removed.