LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 12-21-2008, 12:52 AM   #1
twelvenine
Member
 
Registered: Sep 2006
Posts: 72

Rep: Reputation: 16
ls columns


i'm trying to use "ls -w" so that more of the width of my screen gets used and i don't have to scroll up so much. my problem is that i can't seem to understand what the columns are. is each column a character width, pixel width, or something else? i've tried looking around with google and even experimenting on my own with different widths, but it's just not clear to me.

also, what does the -T option do? i thought it would increase the spaces between filenames by one column(whatever a column is), but it doesn't seem to behave that way.

Last edited by twelvenine; 12-21-2008 at 01:06 AM.
 
Old 12-21-2008, 05:17 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
ls -w XX sets the screen size to be assumed. It appears to keep the column spacing the same

The -T option is totally confusing......I could not figure it out in the time I was willing to devote.
 
Old 12-21-2008, 08:40 AM   #3
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
As I understand the T option, all it's doing is specifying the spacing of the tab stops in the terminal output. For us old folks, this is perfectly reasonable, since a typewriter platen moved to the next tab stop every time the tab key was pressed. The "stops" were pieces of metal (little tabs) that you could slide onto a bar behind the platen that "stopped" the motion when the single-space gear was released.

Since the "terminal" window is emulating a typewriter, you should be able to specify the position of the "tab" stops, although most settings assume that the "stops" are equally spaced, so, for example, -T8 places the "stop" after every eighth character.
 
Old 12-21-2008, 09:34 AM   #4
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
The -w option can be like these examples :

'ls -w120' or 'ls -w150'

( May print almost like ls -T8 )
....

Last edited by knudfl; 12-21-2008 at 09:36 AM.
 
Old 12-21-2008, 10:53 AM   #5
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by PTrenholme View Post
Since the "terminal" window is emulating a typewriter, you should be able to specify the position of the "tab" stops, although most settings assume that the "stops" are equally spaced, so, for example, -T8 places the "stop" after every eighth character.
I think that's the correct explanation.

What is not immediately obvious is why the default (8) gives neat columns, and other settings do not. I suspect it has to do with the actual "tab" characters that are inserted in the text stream.
 
Old 12-21-2008, 12:38 PM   #6
twelvenine
Member
 
Registered: Sep 2006
Posts: 72

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by pixellany View Post
ls -w XX sets the screen size to be assumed. It appears to keep the column spacing the same

The -T option is totally confusing......I could not figure it out in the time I was willing to devote.
so, a screensize in pixels? should i give it like "ls -w 640" if i'm in 640x480 resolution?

it's confusing because the man page calls the argument COLS(width=COLS), which i guess means columns of pixels now.

Last edited by twelvenine; 12-21-2008 at 12:41 PM.
 
Old 12-21-2008, 01:33 PM   #7
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Do some experiments...

I just opened a terminal and it defaulted to 80 characters wide (not pixels).

If I do "ls -w 100", the output runs off the side of the window. Thus, I assume that---with the flag---ls thinks I have a terminal that is 100 characters wide.
 
  


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
substitute 2 columns ovince Programming 2 05-04-2007 01:07 AM
rearranging columns sureshbup Programming 3 11-01-2006 12:48 PM
Need Help With Columns Post Modern Programming 2 02-01-2006 11:18 AM
Vi Columns Chaitanyayardi Linux - Software 5 05-12-2005 07:27 AM
How can I see the other 10 columns sakulagi Linux - Software 1 06-16-2003 09:45 PM

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

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