Introduction to UNIX: 
Exercise Sheet Two

  1. Try the following command sequence:
  2. Continue to explore the filesystem tree using cd, ls, pwd and cat. Look in /bin, /usr/bin, /sbin, /tmp and /boot. What do you see?
  3. Explore /dev. Can you identify what devices are available? Which are character-oriented and which are block-oriented? Can you identify your tty (terminal) device (typing who am i might help); who is the owner of your tty (use ls -l)?
  4. Explore /proc. Display the contents of the files interrupts, devices, cpuinfo, meminfo and uptime using cat. Can you see why we say /proc is a pseudo-filesystem which allows access to kernel data structures?
  5. Change to the home directory of another user directly, using cd ~username.
  6. Change back into your home directory.
  7. Make subdirectories called work and play.
  8. Delete the subdirectory called work.
  9. Copy the file /etc/passwd into your home directory.
  10. Move it into the subdirectory play.
  11. Change into subdirectory play and create a symbolic link called terminal that points to your tty device. What happens if you try to make a hard link to the tty device?
  12. What is the difference between listing the contents of directory play with ls -l and ls -L?
  13. Create a file called hello.txt that contains the words "hello world". Can you use "cp" using "terminal" as the source file to achieve the same effect?
  14. Copy hello.txt to terminal. What happens?
  15. Imagine you were working on a system and someone accidentally deleted the ls command (/bin/ls). How could you get a list of the files in the current directory? Try it.
  16. How would you create and then delete a file called "$SHELL"? Try it.
  17. How would you create and then delete a file that begins with the symbol #? Try it.
  18. How would you create and then delete a file that begins with the symbol -? Try it.
  19. What is the output of the command: echo {con,pre}{sent,fer}{s,ed}? Now, from your home directory, copy /etc/passwd and /etc/group into your home directory in one command given that you can only type /etc once.
  20. Still in your home directory, copy the entire directory play to a directory called work, preserving the symbolic link.
  21. Delete the work directory and its contents with one command. Accept no complaints or queries.
  22. Change into a directory that does not belong to you and try to delete all the files (avoid /proc or /dev, just in case!)
  23. Experiment with the options on the ls command. What do the d, i, R and F options do?

(BACK TO COURSE CONTENTS)


© September 2001 William Knottenbelt (wjk@doc.ic.ac.uk)