Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 01-23-2004, 07:45 AM   #1
LQ Newbie
Registered: Dec 2002
Distribution: Gentoo & Debian
Posts: 25

Rep: Reputation: 15
Question Make ls exclude symlinks

I'm trying to find a way to do 'ls -la' without a bunch of symlinks showing up in the directory listing. The reason is that my home-directory has a bunch of dotfiles symlinked to another directory, and when I type 'ls -la' to see the dotfiles which are not symlinked, the listing is cluttered by a bunch of nasty-looking symlinks. I tried piping ls's output a sed-script and some grepping here and there, but I couldn't find a good way to do it. If anyone of you knows of a simpler way to do it (such as an internal ls-flag ), I'd really appreciate it. Thanks.

Last edited by Creep; 01-23-2004 at 07:58 AM.
Old 01-23-2004, 09:13 AM   #2
Registered: Jul 2003
Location: Virginia
Distribution: Ubuntu Hoary (5.04)
Posts: 550

Rep: Reputation: 31
Check out 'man ls'. I can't do it right now (I'm forced to used a Win Box here) but I remember there is a way to filter what is output.
Old 01-23-2004, 04:28 PM   #3
LQ Newbie
Registered: Dec 2002
Distribution: Gentoo & Debian
Posts: 25

Original Poster
Rep: Reputation: 15
I forgot to mention that I spend an hour and a half reading the manpage of ls trying different things here and there. I didn't find any useful information to solve my problem there though. Thanks for trying to help anyway.
Old 01-23-2004, 05:21 PM   #4
LQ Addict
Registered: Dec 2003
Location: Maine, USA
Distribution: Slackware/SuSE/DSL
Posts: 1,320

Rep: Reputation: 45
ls -p | grep -v @
If you want to get it back to displaying columns:
ls -p | grep -v @ | column
By the way, this will ignore any file including a "@", so there may be a better way.

Last edited by mikshaw; 01-23-2004 at 05:32 PM.
Old 06-11-2020, 08:36 PM   #5
LQ Newbie
Registered: Jun 2020
Posts: 1

Rep: Reputation: Disabled
If you are using `ls -l` and want to display the file info rather than the link info, just change to `ls -lL`. From `man ls`:
-L, --dereference . when showing file information for a symbolic link, show information for the file the link references rather than for the link itself


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to make cp ignore subdirectories? M4l3k Linux - Newbie 4 02-28-2011 12:48 PM
How can I get make to ignore a particular error? SheldonPlankton Linux - Software 1 08-05-2004 01:44 PM
how to make Linux ignore hardware? netmanw00t Linux - Hardware 3 07-11-2004 03:33 AM
make symlinks jazernorth Linux From Scratch 1 03-20-2004 12:22 PM
'make symlinks' doesn't work Linux - Software 1 05-30-2001 06:42 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:34 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration