How to list the symlinks of a folder on Linux?

Asked

Viewed 5,102 times

2

I’m using a tool to deploy in PHP.

When I use the command, some symbolic links are created for certain folders.

As I will run this command on a Linux server, I wonder if there is a command to list all the symbolic links created in the folder.

With the command ls I’m not being able to differentiate between folders and links

How can I do this on Linux?

  • tried ls -la ? You can see who’s link by ->

  • What does that?

  • is the ls, but with the flags to "list in list" and show everything. If you prefer has the find . -type l -ls, that restricts to links only

  • Responds to friend

  • 1

    http://linux.die.net/man/1/ls e http://linux.die.net/man/1/find

  • 1

    Who gave the -1 could inform how I could improve the question?

Show 1 more comment

1 answer

5


If it’s just for viewing, you can use the ls even:

ls -l
  • the option -l is the "long listing" that shows the details

Links will appear with origin indication (->).

http://linux.die.net/man/1/ls

If you want to better filter the listing, you can use the find:

find . -type l -ls
  • . is the current directory. You can switch to the specific path if you prefer.

  • the -type is a file type filter. The l, as you may have imagined, is the type "symbolic link".

  • the -ls in case it is only a helper here, to show the special characters "escaped", so that they are legible.

http://linux.die.net/man/1/find

  • 1

    With the ls -l then give to combine with a grep "\->":p

  • 1

    If you really want to research, you better find. I think the ls is good to go "in the zoo" only. But you can filter with grep without problems.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.