LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] displaying directory listings

[ILUG] displaying directory listings

P at draigBrady.com P at draigBrady.com
Mon Jul 25 12:44:49 IST 2005


Darragh wrote:
> Hello,
> this is probably a very basic question but is there an arguement that I can
> use with ls or another command to show a directory list in one columb? i.e.
> I don't want more than one file or directory per line.

pr is a general way to format things.
For example:

ls -F | pr -T1 -W$COLUMNS

Add a -J if you want names longer than 40 to wrap to the next line.
Change the 1 to 2 to have 2 column output.

You could add a bash alias for this like:
alias l='/bin/ls -F | pr -T1 -W$COLUMNS'

> Finally I'd like to know how to space listings so if a file name was less
> than 40 characters another file or directry name was shown in the next 40
> chunk.

I don't know the layout of your cell display.
How is this requirement different from 1 file name per line?

-- 
Pádraig Brady - http://www.pixelbeat.org
--



More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell