Environment variables are very important aspect of Linux based operating systems. They are used by system to adjust its own behavior according to what you have specified during operating system installation and after that you can use it to tweak you system even more. Environment variables take form of name=value and you can view list of current environment variables by issuing following command on your favorite Linux terminal:
printenv |
Some environment variables are set by the root user for all users on one PC, but every one of those users can have its own environment variables. Now lets see how should we assign lets say "en_US.UTF-8" value to environment variable named "LC_ALL" (by the way this is the way to tweak you environment locale setting for things like time and date format and things like that). Typically you will assign environment variable like this:
export LC_ALL=en_US.UTF-8 |
Ubuntu operating system provides ton of configuration files you can use to set environment variables for different purposes. But it turns there's two system environment configuration files that rule them all. For single user this file is at his home under ".profile" name. This file you can also use to start bash scripts and programs when you log in. Here's how to edit its contents:
gedit /home/$USER/.profile |
To tweak environment variables for all users on your PC you can tweak global configuration file located in "/etc " directory under name "environment". Here's how to get access to this file:
sudo gedit /etc/environment |
To start scripts at boot for all users generally it is best to set your script as Debian service. Lets say you want to set "myscript.sh" to run at boot. Here's basic procedure (don't forget the "." at the end of the end of the last command):
cd /etc/init.d/ sudo nano myscript.sh sudo chmod +x myscript.sh sudo update-rc.d myscript.sh start 99 2 3 4 5 . |
Just to mention that all of this is just the tip of the iceberg to get you started with controlling your Linux environment. Linux gives you greater flexibility than any other OS, but to use that flexibility you need CLI (Command Line Interface). But don't get discouraged, CLI is you friend.