Unix/Linux Exercises

  1. Download mystery_file.txt and .hide_me.txt to your /home/<your_username>/ directory
  2. Create a directory called exercise1 in your user account.
  3. Copy the file both files to the recently created exercise1 directory
  4. Make a copy of mystery_file.txt and name it mystery_file1.txt
  5. Make a copy of .hide_me.txt and name it mystery_file2.txt
  6. What does the following commands do:
    1. chmod u-r mystery_file.txt
    2. chmod a+w mystery_file1.txt
    3. chmod g-r mystery_file2.txt
  7. Now, type:
    1. cat mystery_file1.txt mystery_file2.txt > output
    2. what happens?
  8. how big is my file?
    1. hint: wc <filename>
  9. how big is each txt file of the user?
    1. wc *.txt
  10. use the command grep to find out which of the following mystery files you created in your exercise1 subdirectory contain the word "waldo"? Were you able to find Waldo? How about "bioinformatics"? [Hint: if you need help, try the manual page: man grep
  11. Use the command find to list all the files with the names ending in ".txt" in your exercise1 subdirectory.
  12. Now, create another subdirectory under /home/<your_username>/, called exercise2 and copy all files in exercise1 subdirectory to exercise2 subdirectory. [Hint: use the command cp and "*"]
  13. Change directory into the exercise 2 subdirectory, count how many lines in mystery_file1.txt contains the word "bioinformatics". [Hint: grep, "|", and wc]

 

Hints:

Bash shell has automatic completion, just press <TAB> and is used for command names and for file names. Pressing <TAB> twice gives you all the options.