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
UL(1)								   User Commands							     UL(1)

NAME
ul - do underlining SYNOPSIS
ul [options] [file ...] DESCRIPTION
ul reads the named files (or standard input if none are given) and translates occurrences of underscores to the sequence which indicates underlining for the terminal in use, as specified by the environment variable TERM. The terminfo database is read to determine the appro- priate sequences for underlining. If the terminal is incapable of underlining but is capable of a standout mode, then that is used instead. If the terminal can overstrike, or handles underlining automatically, ul degenerates to cat(1). If the terminal cannot under- line, underlining is ignored. OPTIONS
-i, --indicated Underlining is indicated by a separate line containing appropriate dashes `-'; this is useful when you want to look at the underlin- ing which is present in an nroff output stream on a crt-terminal. -t, -T, --terminal terminal Overrides the terminal type specified in the environment with TERM. -V, --version Display version information and exit. -h, --help Display a help text and exit. ENVIRONMENT
The following environment variable is used: TERM The TERM variable is used to relate a tty device with its device capability description (see terminfo(5)). TERM is set at login time, either by the default terminal type specified in /etc/ttys or as set during the login process by the user in their login file (see setenv(1)). SEE ALSO
colcrt(1), login(1), man(1), nroff(1), setenv(1), terminfo(5) BUGS
Nroff usually outputs a series of backspaces and underlines intermixed with the text to indicate underlining. No attempt is made to opti- mize the backward motion. HISTORY
The ul command appeared in 3.0BSD. AVAILABILITY
The ul command is part of the util-linux package and is available from Linux Kernel Archive <ftp://ftp.kernel.org/pub/linux/utils/util- linux/>. util-linux September 2011 UL(1)
All times are GMT -4. The time now is 04:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy