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
ENVIRON(7)						 Miscellaneous Information Manual						ENVIRON(7)

NAME
environ - user environment SYNOPSIS
extern char **environ; DESCRIPTION
An array of strings called the `environment' is made available by execve(2) when a process begins. By convention these strings have the form `name=value'. The following names are used by various commands: PATH The sequence of directory prefixes that sh, time, nice(1), etc., apply in searching for a file known by an incomplete path name. The prefixes are separated by `:'. Login(1) sets PATH=:/usr/ucb:/bin:/usr/bin. HOME A user's login directory, set by login(1) from the password file passwd(5). TERM The kind of terminal for which output is to be prepared. This information is used by commands, such as nroff or plot(1G), which may exploit special terminal capabilities. See /etc/termcap (termcap(5)) for a list of terminal types. SHELL The file name of the users login shell. TERMCAP The string describing the terminal in TERM, or the name of the termcap file, see termcap(5),termcap(3X). EXINIT A startup list of commands read by ex(1), edit(1), and vi(1). USER The login name of the user. PRINTER The name of the default printer to be used by lpr(1), lpq(1), and lprm(1). Further names may be placed in the environment by the export command and `name=value' arguments in sh(1), or by the setenv command if you use csh(1). Arguments may also be placed in the environment at the point of an execve(2). It is unwise to conflict with certain sh(1) variables that are frequently exported by `.profile' files: MAIL, PS1, PS2, IFS. SEE ALSO
csh(1), ex(1), login(1), sh(1), execve(2), system(3), termcap(3X), termcap(5) 4.2 Berkeley Distribution May 20, 1985 ENVIRON(7)
All times are GMT -4. The time now is 04:17 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy