LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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,107

Rep: Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478
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,702

Rep: Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270
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: 3,193

Rep: Reputation: 961Reputation: 961Reputation: 961Reputation: 961Reputation: 961Reputation: 961Reputation: 961Reputation: 961
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: Arch
Posts: 3,151

Rep: Reputation: 1352Reputation: 1352Reputation: 1352Reputation: 1352Reputation: 1352Reputation: 1352Reputation: 1352Reputation: 1352Reputation: 1352Reputation: 1352
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


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
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 05:13 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration