Skip to main content

Terminal Basics Exercises

Write the following terminal commands to perform the following tasks:

Part I

  1. make a directory called first
  2. change directory to the first folder
  3. create a file called person.txt
  4. change the name of person.txt to another.txt
  5. make a copy of the another.txt file and call it copy.txt
  6. remove the copy.txt file
  7. make a copy of the first folder and call it second
  8. delete the second folder

Part II

  1. What does the help command do? Type in help rm. How do you scroll and get out?
  2. Look at the help page for ls. What does the -l flag do? What does the -a flag do?
  3. Type the following command to download and save the contents of google.com: curl https://www.google.com > google.html
  4. Use less to look at the contents of google.html.
  5. Look at the help page for less. Read the section on /pattern. Search for the text hplogo in the google.html file.
  6. How do you jump between words in the terminal?
  7. How do you get to the end of a line in terminal?
  8. How do you move your cursor to the beginning in terminal?
  9. How do you delete a word (without pressing backspace multiple times) in terminal?
  10. What is the difference between a terminal and shell?
  11. What is an absolute path?
  12. What is an relative path?
  13. What is a flag? Give three examples of flags you have used.
  14. What do the r and f flags do with the rm command?

You can find the solutions here