an openBSD nifty trick – or so i call it ;)

i’ve just finished installing my openBSD 3.8 on to an virtual machine for testing. after the installation and reboot, the first time i login it ask me which Terminal Type to use. by default its “vt220“, so at the prompt i press enter… okay..??  but at each login i make to my bsd machine it keeps on asking the same question…. okay now that boring, dosent it know by now that i am into defalut terminal, ofcourse not, unless or otherwise i set the variables right…

so after going through some files i found out how to stop asking that question everytime i login.. the trick – to modify the users profile 😉

i use root login to acceess my machine, so i am gonna edit roots profile.

once you are looged in, type:
# cd $HOME
what this does is, it chages the directory in to the users home directory, the global_variable $HOME is a shortcut, the actual directory path is /root

then do an ls command:

#ls
this will display all the files in the directory, in the list there will be a file named .profile, the dot before the filename represents that the file is infact a hidden file.

now to see the contents of the file, we will use the cat command to print the details to the screen, type:

# cat .profile
this will display something simillar to the following.

# $openBSD: dot.profile,v 1.5 2005/03/30 21:18:33 millert Exp $
# sh/ksh initialization

PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6:/bin:/usr/local/sbin:/usr:/local/bin
export PATH
: ${HOME=’/root’}
export HOME
umask 022

if [ -x /usr/bin/tset ]; then
eval `/usr/bin/tset -sQ \?$TERM`

fi

now we have to edit a single line in the .profile file, to edit we use vi command, type:

# vi .profile
now move the cursur using keyboard arrow keys and place it on the begining string of “eval `/usr/bin/tset -sQ \?$TERM`”….. now add a “#” at the begining of the line… to add press “i” on the keyboard to insert and add the hash sign. after adding it shud look like the following:
    “#eval `/usr/bin/tset -sQ \?$TERM`

now type below that string, excalty as it is without the “\?“, so it shud finally look like the following:

#eval `/usr/bin/tset -sQ \?$TERM`
eval `/usr/bin/tset -sQ $TERM`

the pound sign (#) is a comment and it wont be executed by the program. so now the whole script should look like the following:

# $openBSD: dot.profile,v 1.5 2005/03/30 21:18:33 millert Exp $
# sh/ksh initialization

PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6:/bin:/usr/local/sbin:/usr:/local/bin
export PATH
: ${HOME=’/root’}
export HOME
umask 022

if [ -x /usr/bin/tset ]; then
#eval `/usr/bin/tset -sQ \?$TERM`
eval `/usr/bin/tset -sQ $TERM`

fi

once, its done press ESC and type:

:wq

this will write to file and quit … now to test if its working fine, logout by typing exit, and login again… and voila it vorks… it dosent aks the question, it is set to use the default terminal mode.

so hope this nifty trick will help ya… then again dose it bother to ask that question at each login or am i being lazy…hey it just fooling with the OS…so we can understand better..

untill; next time, CIAO

Advertisements

About this entry