LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 05-03-2011, 04:32 AM   #1
littlebigman
Member
 
Registered: Aug 2008
Location: France
Posts: 658

Rep: Reputation: 35
Question List files/directory names without directory contents?


Hello

When I run "ls -al somedir*" (I use the "ll" shortcut, actually), Linux not only list files that match, but also the contents of directories whose name also happens to match.

Is there a way to limit "ls" so that it will only show names (files and directories) and ignore the contents of the directories?

Thank you.
 
Old 05-03-2011, 04:36 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Yes. See man ls and look for the -d option.
 
Old 05-03-2011, 04:42 AM   #3
littlebigman
Member
 
Registered: Aug 2008
Location: France
Posts: 658

Original Poster
Rep: Reputation: 35
Thanks for the tip. The alias is defined in the following files: /etc/skel/.bashrc, ~/.bashrc. Just change the "ll" alias, and run "source ~/.bashrc".
 
  


Reply



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 list the contents of Apache's cgi-bin directory? Joel Koltner Linux - Newbie 4 03-27-2009 11:23 PM
Tried but in vain to list contents of a directory rs_vijay Programming 3 01-17-2007 03:59 PM
list contents of directory without listing contents baddah Linux - Newbie 2 06-12-2006 04:02 AM
cannot list directory contents kpachopoulos Linux - General 2 11-29-2005 05:24 PM
List the contents of a directory to a file MasterC Linux - General 19 11-26-2002 10:09 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:31 AM.

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