LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-31-2004, 06:09 AM   #1
TroelsSmit
Member
 
Registered: Feb 2004
Location: Denmark
Distribution: Debian / Suse
Posts: 223

Rep: Reputation: 30
ls, dirs first, files later


Hi,

how do I list the contents of a directory so the directories are first listed, and later files ?

Thanks,
Troels
 
Old 05-31-2004, 06:12 AM   #2
flamah
Member
 
Registered: Feb 2004
Location: London
Distribution: FEDORA CORE 2
Posts: 53

Rep: Reputation: 15
maybe ls -d
?
 
Old 05-31-2004, 06:28 AM   #3
TroelsSmit
Member
 
Registered: Feb 2004
Location: Denmark
Distribution: Debian / Suse
Posts: 223

Original Poster
Rep: Reputation: 30
No I have tried that, and it does not seem to work.
 
Old 05-31-2004, 09:53 AM   #4
zeropash
Member
 
Registered: Apr 2003
Location: Bangalore,India
Distribution: FC2, RHES, RH9, FC3, FC1, Slackware 3.0
Posts: 208

Rep: Reputation: 30
if you are using bash write a function like this
zeropash@zeropash$ function myls() { find $1 -maxdepth 1 -type d; find $1 -maxdepth 1 -type f; }
zeropash@zeropash$ myls firefox
does this help?
if you want write a script and use it
 
Old 05-31-2004, 11:47 AM   #5
TroelsSmit
Member
 
Registered: Feb 2004
Location: Denmark
Distribution: Debian / Suse
Posts: 223

Original Poster
Rep: Reputation: 30
The find function truly does what I wanted - exept for:
1. It doesn't know how to put color if it finds a directoroy
2. I don't want to find files starting with a '.'

Something like: ls -gotpUXh |less
but listing directories first would be awesome.
- sorry for bothering everyone with this question, but I really don't understand why ls doesn't have this option.

Thanks
 
  


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
chkrootkit - suspicious files and dirs Dave Lerner Linux - Security 2 07-09-2005 08:49 AM
invisible files and dirs karmine Slackware - Installation 8 12-26-2004 03:05 PM
Canīt see certain files/dirs in debian partition jimdaworm Slackware 2 10-11-2004 06:54 AM
hiccup: dirs off root showed up as files bdp Linux - Hardware 0 07-19-2002 12:38 PM
Cmd to rm dir thats has files and other dirs psyklops Linux - General 4 04-17-2002 08:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:32 PM.

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