First of all, this is not a duplicate of this: Linux ls to show only filename date and size
Because I want to print actual directory name additionally.
I was always using this command:
ls -l | awk '{print $5, $9}'
to get the each file size and name.
But now, I need to print the file directory additionally. Like if the current directory is /path/to/somewhere
, I want:
somewhere/file 1234
somewhere/other-file 4567
Instead of just
file 1234
other-file 4567
Is that possible?
ls
. Imagine what would happen if say the username had a whitespace character in it. – rahmu Feb 24 '12 at 14:16