-2

I am new to linux bash , i was trying to do a problem which asks to edit bash.rc file and add an alias .The alias should be able to get the space usage of all the files and folders and display it on your screen. After digging out on internet i found that command for such thing is ls -lh but along with file or folder name and disk usage it is also showing the date at which file created and other unuseful things.enter image description here

So how can remove those things so that i only get file and folder name when i execute ls -lh command.

Deepak
  • 49
  • 1
  • 6

1 Answers1

-1

You have the right command, you can use tools like awk and sed to parse the output.

See this topic for example:

How to get the second column from command output?

Edit

Like Benjamin W. said in the comments, the output of ls should not be parsed.

This as been discussed on the following page: https://unix.stackexchange.com/questions/128985/why-not-parse-ls

TSpark
  • 189
  • 1
  • 14