Linux exercise 4 - Basic commands

  1. What is the path for your user's home directory? How do you change your current working directory to your user's home directory?
  2. How can you find out your current working directory?
  3. Explain briefly what option -p does when used with mkdir command. In addition, find out what version number of mkdir command you have.
  4. Create the following directory structure including the files to your home directory using your Linux shell. Files can be empty or containing text.

    Linux exercise 4 - Directory structure

  5. Copy all files with .txt extension from dir2 to dir1 using relative path for directories using only one command.

  6. Move all files starting with string File1 from dir2 to dir3 using absolute path for directories using only one command.
  7. Create tmp directory inside your user's home directory. Copy directory structure created in fourth part starting from directory h1 into the tmp directory in one command. The final directory tree should then look like this: /home/your_user/tmp/h1...
  8. Remove tmp/h1 directory structure using only one command.
  9. Rename File1.txt file under dir1 in a way it begins with string NewFileX1 (File1.txt → NewFileX1.txt)
  10. How do you distinguish the following two paths: relative and absolute? What do these terms mean? Give examples from both paths.