Introduction to Linux/Unix

Lab 4
Chapter 7- Archiving and Compression
Chapter 8 – Pipes, Redirection and RegEx
Execute and verify each command. Refer PowerPoints for reference. Do not miss any steps. Include screen capture for each command
Chapter 7 – Archiving and Compression

  1. Create a directory named, “lab4” in your home directory.
    Command:
  2. Change to “lab4” directory. Perform all the commands in “lab4” directory.
    Command:
  3. Archive all files from /etc/ssh directory to “ssh.tar” file within the current directory. Write the command and perform the operation. Attach your screen shot.
  4. Perform the following command, ls –l
  5. Display the contents of the “ssh.tar” archive file
  6. Archive and compress using “bzip2” all files from /etc/ssh directory to “ssh.tar.bz2” file within the current directory. Write the command and perform the operation. Attach your screen shot.
  7. Extract and Uncompress the file you performed in step 6. Write the command and perform the operation.
  8. Perform the following command, ls –l and attach the screen shots.
  9. Copy files from /etc directory starting with the following letters, “hd” to your current working directory. List and verify your operation. Attach your screen shot. I provided the copy command.
    Command: cp /etc/hd* .  “.” represents the current working directory.
  10. Create a compressed file, “hddtemp.db” using “gzip” utility. Write the command and perform the operation. List and verify your operation. Attach your screen shot.
  11. Compressed file name extension using “gzip” utility. __
  12. Create a compressed file, “hdparm.conf” using “bzip2” utility. Write the command and perform the operation. List and verify your operation. Attach your screen shot.
  13. Compressed file extension using “bzip2” utility: __
  14. Uncompress the compressed file, “hdparm.conf” you performed in step 12. Write the command and perform the operation. List and verify your operation. Attach your screen shot.
    Chapter 8 Pipes and Redirection and Regular Expression
  15. Counting the word in a file.
    Run the command to count the words in “hdparm.conf” file. Write the command and perform the operation. List and verify your operation. Attach your screen shot.
  16. Searching a word in a file
    a. Run the command to search the word “localhost” in /etc/hosts file. You can use the option “i” to ignore the case. Write the command and perform the operation. List and verify your operation. Attach your screen shot. Searching a word or a string in all files in a given directory
    b. Run the command to find all the file in /etc/dhcp directory that contains the string “eth0” {it is zero not the letter “o”}. Write the command and perform the operation. List and verify your operation. Attach your screen shot.

Leave a Reply