Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Be more comfortable with the command line

Command Line Practice

Download this file if you'd like to use it as part of the practice text file. When I'm referring this file, you are free to use any other file with text.


  1. Go to a child directory. Say you're in directory, but you should go to directory/child_directory.

  2. Use an absolute path to go to a directory

  3. Go to an adjacent directory - say you're in foo/bar but you want to go to foo/boo

  4. Go to your home directory

  5. Create a environment variable called I_LOVE_CLI with a value of true.

    echo ${I_LOVE_CLI}  # should print `true`
  6. Print all current environment variables

  7. Get all your command history

  8. Create an alias called e and it should be an alias for echo

    e foo  # should print `foo`
  9. List all files and directories in your current working directory.

  10. List all files and directories, including the hidden ones, in your current working directory.

  11. Rename a file.

  12. Rename a directory.

  13. Move multiple files to a separate directory.

  14. Create a copy of a file.

  15. Create a copy of a file in a separate directory.

  16. Remove a file.

  17. Remove all files in a directory.

  18. Find out the absolute path of your current working directory.

  19. Create an empty directory.

  20. Print out I'll use the command line for everything.

  21. Print out the contents of a text file in full.

  22. View the contents of a text file in pages.

  23. Create an empty file.

  24. Find all lines with the letter a in this file.

  25. Copy this text file into your computer's clipboard.


  1. Find all lines with a vowel in this file.

  2. Print out all files in a directory.

  3. Print all your environment variables that have the letter A.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment