LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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-04-2013, 10:37 AM   #1
sysbox
Member
 
Registered: Jul 2005
Posts: 117

Rep: Reputation: 15
How to determine size of xterm?


I want my PERL script to format it's output based on the size of the xterm it's running in. What command will tell me how many rows and columns?

EDIT: Nevermind: the output of 'resize' will produce this.

Last edited by sysbox; 05-04-2013 at 10:43 AM.
 
Old 05-04-2013, 05:42 PM   #2
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,627

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
just a question
What is wrong with using "more" or " less" ?
 
Old 05-04-2013, 10:33 PM   #3
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Quote:
Originally Posted by John VV View Post
just a question
What is wrong with using "more" or " less" ?
It depends on what the script is doing. I wrote one once to edit forms, and thus needed the proper window size to position the fields correctly.

You can't use more/less to handle things like that.
 
Old 05-05-2013, 08:11 AM   #4
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,868
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
You can check LINES and COLUMNS environment variables.
 
Old 05-05-2013, 06:39 PM   #5
sysbox
Member
 
Registered: Jul 2005
Posts: 117

Original Poster
Rep: Reputation: 15
LINES and COLUMNS aren't set for me.
 
Old 05-05-2013, 08:07 PM   #6
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,784

Rep: Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083
Quote:
Originally Posted by NevemTeve View Post
You can check LINES and COLUMNS environment variables.
They're just shell variables, not environment variables; they won't be passed to the perl script unless you export them.

Code:
~$ env | grep -E 'COLUMNS|LINES'
~$ set | grep -E 'COLUMNS|LINES'
COLUMNS=84
LINES=42
~$ export COLUMNS LINES
~$ env | grep -E 'COLUMNS|LINES'
COLUMNS=84
LINES=42

Last edited by ntubski; 05-05-2013 at 08:08 PM. Reason: add export to code
 
  


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
how to determine block size when using dd kav Linux - Software 2 12-22-2007 07:16 PM
How do i change the size of a xterm window or lanch one with a specified size? Garavix Linux - Newbie 2 04-20-2006 09:06 PM
Xterm font size onelung02 Slackware 4 03-28-2005 04:34 PM
how to determine if /dev/pts works (i cannot run xterm) stpg Linux - General 2 08-11-2004 09:33 AM
Xterm font size liguorir Linux - Software 3 01-10-2004 08:44 AM

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

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