LinuxQuestions.org
Visit Jeremy's Blog.
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 03-06-2005, 03:21 PM   #1
Kanon
Member
 
Registered: Sep 2004
Location: Norge
Distribution: Debian
Posts: 116

Rep: Reputation: 15
Sort in .bashrc


Im trying to setup .bashrc so I can put it in skel. But first I want to have it so "normal" ppl (aka windows users) can read the out put. So what I was thinking is to set it up so it lists this in order, dir then files. But also alphabeticaly.

So far I can do either ls -la (then I got sort) or ls -Ula (then I got dirs first, unsorted).
I did check the man pages. Could not figure out who to accomplish this, so Im asking here...

Any one care to give me a hint? Thanks!
 
Old 03-06-2005, 04:24 PM   #2
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
I don't know of any option to accomplish what you're shooting for. This might do what you need:
Code:
alias dir='ls -lA | grep "^d" | sort -k 9; ls -lA | grep -v "^d" | grep -v "^total" | sort -k 9'
There may be other, more efficient ways of doing it.
 
Old 03-07-2005, 03:40 AM   #3
Kanon
Member
 
Registered: Sep 2004
Location: Norge
Distribution: Debian
Posts: 116

Original Poster
Rep: Reputation: 15
Yeah! That works!
Thanks!!!

Edit: How do I get the colors to work with this?

Last edited by Kanon; 03-07-2005 at 03:44 AM.
 
Old 03-07-2005, 12:51 PM   #4
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
I'm not sure that you can. The output of "ls" is being fed through other commands, and they are likely stripping off the special character sequences that denote color changes.
 
Old 03-07-2005, 01:56 PM   #5
Kanon
Member
 
Registered: Sep 2004
Location: Norge
Distribution: Debian
Posts: 116

Original Poster
Rep: Reputation: 15
Its looking good anyhow! Thanks alot!
 
  


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
C++ Sort() bendeco13 Programming 2 11-03-2005 12:26 AM
Help with Windoze XP - sort of nightoil Linux - Newbie 1 05-18-2005 11:52 PM
Sort Types k1ll3r_x Programming 2 01-15-2005 01:55 AM
Hello (sort of...) Gethyn LinuxQuestions.org Member Intro 1 10-15-2004 01:10 PM
sort pantera Programming 5 05-26-2004 08:36 PM

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

All times are GMT -5. The time now is 08:49 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