-1

This should be a simple hw problem but I can't seem to get it to work correctly. This is an old lab that I missed a while ago (make ups are not allowed), so no I'm not just trying to get other people to do my work I legitimately want to know how to make this work.

When logging in, you want to see how much data your $HOME directory is using (in term of MB). The command you want to use is du. However du will show you information for entire file/directory hierarchy under $HOME. Use the man page to figure out the options that give you only the size in MB of your $HOME directory. You must print out a useful message before running du. (echo "The size of the home directory is:")

Getting each command to work separately is easy, but I have no idea how to combine them.

  • 3
    What commands have you tried? What was the output of those commands? – Eric Renouf Oct 12 '15 at 17:11
  • At least give us an idea that you homed in on the options for du that are relevant based on your analysis of the man page output. Edit your post and include these details. – Anthon Oct 12 '15 at 17:48
  • You can use the method in the answer below, but I expect the question just wanted you to run echo and du in sequence – Michael Mrozek Oct 12 '15 at 20:56
1

you my need this:

 echo "$(du -sm $HOME)"

or

echo "$(du -sm $HOME)mb"
  • 1
    By way of explanation: -h means human-friendly values (mb), -s means 'summary' (so, doesn't list each file, just the total), and -m sets block size to 1M. $HOME resolves to the home dir of the user that is running the shell. – Klaatu von Schlacker Oct 12 '15 at 22:32
  • I think they also want -S. – Sparhawk Oct 12 '15 at 22:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.