Exploring Unix

Your assignment, should you choose to accept it, is to answer the following questions about our UNIX system. The idea is to try out some errors and special cases. Do this with a sense of exploration. There is often more than one right answer. This tape will self-destruct in 5 seconds.

If, in the process of experimenting, blow up your system, you will have to reinstall. Probably you should not be root while doing this stuff

  1. How many files in /usr/bin start with an 'a'?


  2. How many files in /usr/bin have an 'a' anywhere in the name?


  3. How many files in /usr/bin have an 'a' somewhere in the filename, and a 'b' somewhere later?


  4. Which file was modified most recently in /usr/bin?


  5. What does the up-arrow and down-arrow key do when you type them into a bash shell window?


  6. What does 'cd ~' do?

  7. What does 'cd /' do?


  8. What does the command "!c" do when you try it? What if you replace the 'c' with other letters?


  9. Type control-R and then begin typing some command you've already entered. What happens?


  10. What does the 'history' command do?



  11. Look at the file /etc/passwd.  This is the password file for the system.  Is it world readable?  Is it world writeable?


  12. Show me a command that prints the password file in alphabetic order. Hint: Use a pipe and the sort command.


  13. Show me a command that prints the alphabetically first entry in the password file. Hint: Check out the head command.



  14. Look around the /proc filesystem.  How many megahertz is your CPU?


  15. Look around the /proc file system.  How long has your computer been up since the last reboot.


  16. What happens when you edit a directory (i.e. nano /tmp ) or write to a directory directly (i.e. echo hello > /tmp)? What if you're root?


  17. How many processes are running on your system? The command ps -augx will show all processes, and the first column of wc will tell how many lines were on its standard input.


  18. Ping some other computer that you know is working (i.e. ping turing.nmu.edu). This generates network traffic once per second. It also tells you how long the network round trip between the two computers is. How long?


  19. Try and ping yourself (i.e. if on euclid try ping euclid.nmu.edu ). Is this quicker or slower than pinging some other computer?


  20. What is the longest filename you can use Try echo hello > a_very_long_name until something breaks, and then count the filename length.


  21. Your shell is probably bash. Use ps and kill -KILL to kill your shell. What happened? Hint: There might be more than one bash running. If so, you might need to kill them all.


  22. Make me a file that is exactly one million bytes long.  You can either type for a long time or be trickey.  One hint 'ftruncate'. Show it to me.

  23. What command would print all the file names in /usr/bin in REVERSE alphabetical order?  (Hint: read the output of man ls or use the 'ls' and 'sort' commands.)


  24. Suppose you cd to the root directory (i.e. cd /) and then cd up one more (i.e. cd ..). What happens? What directory are you in?