views:

524

answers:

3

Basically I want do the following:

ls -l[+someflags] (or by some other means) that will only display files that are symbolic links

so the output would look

-rw-r--r-- 1 username grp size date-time filename -> somedir -rw-r--r-- 1 username grp size date-time filename2 -> somsdfsdf

etc.

For example,

to show only directories I have an alias: alias lsd 'ls -l | grep ^d'

I wonder how to display only hidden files or only hidden directories?

I have the following solution, however it doesn't display the output in color :(

ls -ltra | grep '->'

+3  A: 

Find all the symbolic links in a directory:

ls -l `find /usr/bin -maxdepth 1 -type l -print`

For the listing of hidden files:

ls -ald .*

ChristopheD
find /usr/bin -type l -print | xargs ls -l doesn't print in color. when I do ls -l it does show colors as I have alias ls 'ls --color=auto'
vehomzzz
I updated my answer to reflect this.
ChristopheD
+1  A: 

For only "hidden" folders - dot folders, try:

ls -l .**

Yes, the two asterisks are necessary, otherwise you'll also get . and .. in the results.

For symlinks, well, try the symlinks program:

symlinks -v .

(shows all symlinks under current directory)

jmanning2k
A: 

You were almost there with your grep solution; let's focus on getting you COLOR again.

Try this:

ls --color=always -ltra | grep '->'
pbr