Tuesday, 20 August 2013

How to hide the . and .. from ls

How to hide the . and .. from ls

When I run ls -l on a directory, I see an entry titled '.' How can I
remove the row containing '.' from the output?
ls -latr /foo | tail -n5
-rw-rw-r-- 1 guest bar 59169 Aug 20 12:22 foobar
-rw-rw-r-- 1 guest bar 59169 Aug 20 12:23 bar1
-rw-rw-r-- 1 guest bar 59169 Aug 20 12:24 foobar42
-rw-rw-r-- 1 guest bar 59169 Aug 20 12:25 foo
drwxrws--- 8 guest bar 102400 Aug 20 12:26 .
I'm thinking cut should work, but I can't find the right syntax.
ls -latr |tail -n5|cut -d'.'
ls -latr |tail -n5|cut -d.

No comments:

Post a Comment