Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Resizing Terminal Size Upon Login? Post 302933553 by mrm5102 on Friday 30th of January 2015 02:29:47 PM
Old 01-30-2015
Resizing Terminal Size Upon Login?

Hello All,

PC: CuBox-i
OS: OpenSuSE 13.1
uname: Linux CuBox 3.14.14-cubox-i #1 SMP Sat Sep 13 03:48:24 UTC 2014 armv7l armv7l armv7l GNU/Linux
Shell: Bash

So I was trying to see if there was a way to resize the terminal dynamically upon logging into a remote PC. How I login now is to use minicom on my PC (*or could be Putty from Windows depending on where I am) and Dial into the PC remotely. On the remote PC I have mgetty running to listen for and initialize the connection. I have mgetty configured to use TERM=vt102 as the Terminal type (*this is because this terminal produced the best result for using the screen command while dialed into this PC)...

Once I'm logged in I can see $COLUMNS is set to 80 and $LINES is set to 24.

I know I can change this by default in /etc/termcap, but who knows what size "My" terminal will be on my laptop before dialing into the PC. So I wanted to do it dynamically. I was able to successfully run the resize command which sets COLUMNS and LINES to the current window size and exports the variables after logging-in... So I was wondering if there is a way to run this automagically after logging in?

I read there is a file called "/etc/csh.login" that is supposed to get executed upon logging in, but looking over the file it doesn't even look like it would execute given the syntax of the code...
*For example, it has this in csh.login, which is not in any shell syntax I'm used to...
Code:
#
# Initialize terminal
#
if ( -o /dev/$tty && -c /dev/$tty && ${?prompt} ) then
    # Console
    if ( ! ${?TERM} )           setenv TERM linux
    if ( "$TERM" == "unknown" ) setenv TERM linux
    if ( ! ${?SSH_TTY} && "$TERM" != "dumb" ) then
        path stty sane cr0 pass8 dec
        path tset -I -Q
    endif
    # on iSeries virtual console, detect screen size and terminal
    if ( -d /proc/iSeries && ( $tty == "tty1" || "$tty" == "console")) then
        setenv LINES   24
        setenv COLUMNS 80
        eval `path initviocons -q -e -c`
    endif
    settc km yes
endif
unsetenv TERMCAP

Given just the 1st If statement above, it fails with an error... Which got me wondering if csh.login was only for CSH/C Shell.?
Or maybe I can do something from ~/.bashrc file..?

Also, when I dial into the PC now, after I login and get the Command prompt the terminal size is working at the same physical size of the terminal window, but as soon as I use something like vi, view, man, etc... The terminal switches to 24 rows and 80 cols, which remains that way even after exiting those commands. But if the variables COLUMNS and LINES are set to what I want the size does NOT change.

But anyway, does anyone know what the best way to try and do this would be? Any thoughts or suggestions would be greatly appreciated!

Thanks in Advance,
Matt
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

won't allow root login from another terminal to my sun

I'm trying to log in to one of my sun boxes via EXCEED's X-terminal and it won't allow me to do so as root, says not at system console, is there a way to change that so it allows logging in as root at a remote terminal? (3 Replies)
Discussion started by: kymberm
3 Replies

2. Shell Programming and Scripting

expanding standard terminal size

what is the Ksh syntax to expand/change the geometry of the running terminal window? thanks (6 Replies)
Discussion started by: prkfriryce
6 Replies

3. Solaris

How to allow root login from a specified terminal ?

I want to enable root login just from one terminal machine, can i do that via /etc/default/login in console=/dev/console line ? and if so what i have to type exactly, another question is it normal to edit the files inside defaults directly ? or i can copy it to /etc/ and edit it there and its... (3 Replies)
Discussion started by: XP_2600
3 Replies

4. Solaris

Login from X-terminal

I have a Solaris 8 system acting as a NIS slave. My /etc/nsswitch.conf file specifies passwd: files nis and in general users can login successfully. However, I have a few users who use X-terminals booted off the Solaris box and these people are unable to login unless they have entries in the... (0 Replies)
Discussion started by: Scrollon
0 Replies

5. Shell Programming and Scripting

Remote Login in to another Terminal

hi all , i need the command for remote login in to another terminal, came accross by using "tty" command. please suggest and help me out in this. Regrds Sridhar. (1 Reply)
Discussion started by: Sridhar_dev
1 Replies

6. Shell Programming and Scripting

size of the terminal window

Hi, I am programming a script that shows a figure on screen but I would be centered, so What I have to use command to get the size of the window? Thanks a lot, (2 Replies)
Discussion started by: Gengis-Kahn
2 Replies

7. Red Hat

terminal size

Is there an easy command to know the size of a terminal window from a command line command? (3 Replies)
Discussion started by: garethsays
3 Replies

8. OS X (Apple)

How to prompt for login on OSX when starting Terminal

I was wondering if anyone can tell me how to log back in to unix after logging out. I have a MBPro. If I don't have the window close after exiting, then there is the phrase 'process completed' in brackets with a blinking cursor, but I can't type anything in. Is it also possible to start the... (4 Replies)
Discussion started by: Straitsfan
4 Replies

9. AIX

AIX 7.1 Login Terminal

Hi there, I am a newbie in AIX. I have reboot the AIX today and then the CDE login screen disappear. :eek:I have reboot several times and still it only shows the terminal (lft0) with only green characters and black screen:confused:. Anyway I can have the CDE login screen back?:confused: Also, as... (5 Replies)
Discussion started by: sunnytai
5 Replies

10. AIX

Unable to login in ssh terminal

Hi guys when ever i tried to connect aix server in my institute through ssh terminal the pop is coming like network is unreachable .Am using MacBook air the other guys who are using putty software in windows they can easily login in tho the server through remotely . Is there any one can... (3 Replies)
Discussion started by: aashishb007
3 Replies
RESIZE(1)                                                     General Commands Manual                                                    RESIZE(1)

NAME
resize - set environment and terminal settings to current xterm window size SYNOPSIS
resize [ -u | -c ] [ -s [ row col ] ] DESCRIPTION
Resize prints a shell command for setting the appropriate environment variables to indicate the current size of xterm window from which the command is run. For this output to take effect, resize must either be evaluated as part of the command line (usually done with a shell alias or function) or else redirected to a file which can then be read in. From the C shell (usually known as /bin/csh), the following alias could be defined in the user's .cshrc: % alias rs 'set noglob; eval `resize`' After resizing the window, the user would type: % rs Users of versions of the Bourne shell (usually known as /bin/sh) that don't have command functions will need to send the output to a tempo- rary file and then read it back in with the "." command: $ resize > /tmp/out $ . /tmp/out Resize determines the user's current shell by first checking if $SHELL is set, and using that. Otherwise it determines the user's shell by looking in the password file. Generally Bourne-shell variants (including ksh) do not modify $SHELL, so it is possible for resize to be confused if one runs resize from a Bourne shell spawned from a C shell. OPTIONS
The following options may be used with resize: -u This option indicates that Bourne shell commands should be generated even if the user's current shell isn't /bin/sh. -c This option indicates that C shell commands should be generated even if the user's current shell isn't /bin/csh. -s [rows columns] This option indicates that Sun console escape sequences will be used instead of the VT100-style xterm escape codes. If rows and columns are given, resize will ask the xterm to resize itself. However, the window manager may choose to disallow the change. Note that the Sun console escape sequences are recognized by XFree86 xterm and by dtterm. The resize program may be installed as sunsize, which causes makes it assume the -s option. The rows and columns arguments must appear last; though they are normally associated with the -s option, they are parsed separately. FILES
/etc/termcap for the base termcap entry to modify. ~/.cshrc user's alias for the command. ENVIRONMENT
TERM set to "xterm" if not already set. TERMCAP variable set on systems using termcap COLUMNS, LINES variables set on systems using terminfo SEE ALSO
csh(1), tset(1), xterm(1) AUTHORS
Mark Vandevoorde (MIT-Athena), Edward Moy (Berkeley) Copyright (c) 1984, 1985 by X Consortium See X(7) for a complete copyright notice. X Window System RESIZE(1)
All times are GMT -4. The time now is 07:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy