Question
11. The df command shows you how much disk space is available on a Linux system. Use the output from the previous question to write
11. The df command shows you how much disk space is available on a Linux system. Use the output from the previous question to write a command pipeline that prints how much disk space is available on each of the disks found in question 1. The only acceptable output consists of two numbers only.
NOTE: instead of cut, you may want to use awk. To print the second field in a whitespace-delimited file using awk, use the following command: awk '{print $2}'
answer :
$ a=$(dmesg | grep SCSI | grep Attached | cut -d ' ' -f 8)
as mentioned to use $2 so after using that i got :
$ df | awk '{print $2}' 1K-blocks 4028580 814876 197976004 4074368 5120 4074368 56960 56960 94080 64896 64896 50816 51072 94080 515858104 814872 814872 814872 814872 814872 814872 814872 814872 814872 814872 814872 814872 814872 814872
12. Extra fancy: update the command pipeline above to add up both numbers and print only one value. If you do it right, you will only need to chain two commands!
and for the last answer this is what i got
~$ df | awk '{print $2, $4}' 1K-blocks Available 4028580 4028580 814876 808384 197976004 137422688 4074368 4074340 5120 5120 4074368 4074368 56960 0 56960 0 94080 0 64896 0 64896 0 50816 0 51072 0 94080 0 515858104 195291292 814872 814872 814872 814872 814872 814872 814872 814872 814872 814872 814872 814872 814872 814872 814872 814872 814872 814872 814872 814872 814872 814872
let me know if this is correct .
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started