Archive

Posts Tagged ‘Environment’

How to find out Ubuntu version?

December 24th, 2008 No comments

There are a few options/commands you can use to find out which version of Ubuntu you are using. They give very similar information which you wanted to know but present in different format.

Command line:

cat /etc/lsb-release

Example:

manet@ubuntu:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=8.10
DISTRIB_CODENAME=intrepid
DISTRIB_DESCRIPTION="Ubuntu 8.10"

Command line:

lsb_release -a

Example:

manet@ubuntu:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 8.10
Release:        8.10
Codename:       intrepid

Command line:

cat /ect/issue

Example:

manet@ubuntu:~$ cat /etc/issue
Ubuntu 8.10 n l

Command line:

cat /proc/version

Example:

manet@ubuntu:~$ cat /proc/version
Linux version 2.6.27-9-server (buildd@rothera)
(gcc version 4.3.2 (Ubuntu 4.3.2-1ubuntu11) )
#1 SMP Thu Nov 20 22:53:41 UTC 2008
Categories: FAQ & Tip

How to set Path in Linux?

April 26th, 2008 No comments

PATH is a System Environment Variable which you can find most of the important commands/values that are available to user.

The syntax for setting your path can be slightly different dependent on which shell you are using.

Note: Use finger command to find out which shell you are using

$ finger manet
Login: manet                            Name: Manet Yim
Directory: /home/manet                  Shell: /bin/bash

Set path

On bash shell

export PATH=$PATH:/usr/sbin/:/usr/local/bin

On tcsh or csh shell

set PATH = ($PATH /usr/sbin /usr/local/bin)

These settings can be added to your profile file so it will be available every time you login.

.bashrc on bash shell or .cshrc on csh or tcsh shell.

Categories: FAQ & Tip

How to set global variable in Linux?

September 4th, 2007 No comments

When you create a global variable, you are making it available system wide (for all users). It is an alias of a certain command or directory which/where it should be available and can be access from anywhere in the system. For example, you are installing Java Development Kit manually and javac command need to be accessed from anywhere, then you create a variable for java home directory and the alias to javac command.

eg.

alias $JAVA_HOME=/usr/shared/jdk1.5
alias javac=$JAVA_HOME/bin/javac

Below is how to setup the global variables in linux. I am using Ubuntu Server 7.04 at the time I post this walk-through instruction.

The file /ect/profile is a system-wide profile for Bourne shell it’s also compatible with bash, ksh, ash. Edit this file to add your new environment variables.

  • type: sudo vi /etc/profile
  • Enter root password if prompted
  • Add the following lines
    export VARIABLE_NAME=path_to_your_destination
  • Repeat this line until you finish adding your variables
  • Exit current shell window and re-open (not reboot the machine)
  • type: env to list all environment variables that available to your current login,
  • You should see VARIABLE_NAME=path_to_your_destination

To test it

  • type: cd $VARIABLE_NAME
  • It should change current directory to path_to_your_destination
Categories: FAQ & Tip