Home > Articles > Operating Systems, Server > Linux/UNIX/Open Source

  • Print
  • + Share This
This chapter is from the book

Advanced Exercises

  1. When you use the redirect output symbol (>) on a command line, the shell creates the output file immediately, before the command is executed. Demonstrate that this is true.
  2. In experimenting with variables, Max accidentally deletes his PATH variable. He decides he does not need the PATH variable. Discuss some of the problems he could soon encounter and explain the reasons for these problems. How could he easily return PATH to its original value?
  3. Assume permissions on a file allow you to write to the file but not to delete it.

    1. Give a command to empty the file without invoking an editor.
    2. Explain how you might have permission to modify a file that you cannot delete.
  4. If you accidentally create a filename that contains a nonprinting character, such as a CONTROL character, how can you remove the file?
  5. Why does the noclobber variable not protect you from overwriting an existing file with cp or mv?
  6. Why do command names and filenames usually not have embedded SPACEs? How would you create a filename containing a SPACE? How would you remove it? (This is a thought exercise, not recommended practice. If you want to experiment, create a file and work in a directory that contains only your experimental file.)
  7. Create a file named answer and give the following command:

    $ > answers.0102 < answer cat

    Explain what the command does and why. What is a more conventional way of expressing this command?

  • + Share This
  • 🔖 Save To Your Account