LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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, 05:32 AM   #1
littlebigman
Member
 
Registered: Aug 2008
Posts: 461

Rep: Reputation: 32
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, 05:36 AM   #2
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

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

Original Poster
Rep: Reputation: 32
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


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


All times are GMT -5. The time now is 12:36 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration