Environment set and display Freebsd

Written by
Date: 2013-06-06 13:12:13 00:00

Spanish version

If you need to display or set new environment variables in FreeBSD operating system you will have the use the command env. This command will display the current values for all environmental pair, name / value.

env

The result would be like this:

$ env
SSH_CLIENT=200.87.xx.yy 58338 22
LOGNAME=ggarron
PAGER=more
FTP_PASSIVE_MODE=YES
MAIL=/var/mail/ggarron
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/home/ggarron/bin
EDITOR=vi
ENV=/home/ggarron/.shrc
PWD=/usr/home/ggarron
TERM=xterm
SSH_TTY=/dev/pts/0
HOME=/home/ggarron
USER=ggarron
SSH_CONNECTION=200.87.xx.yy 58338 146.185.xx.yy 22
SHELL=/bin/sh
BLOCKSIZE=K

Now if you need to set up a new variable, use the command setenv

setenv a 2

Will set the value "2" to the variable "a"

Making changes permanent

Those changes are going to be temporal, if you need them to be permanent changes, you will have to edit the ~/.cshrc file.

vi ~/.cshrc

Add something like this, setenv EDITOR vim and save the file. (shift zz to save it). Now everytime you log in your session, those variables are going to be loaded.