≡ Menu

export path

Linux / Unix: Unicode and HTML Characters Lookup By Name or Number

I need to replace special characters with equivalent hexadecimal unicode under Linux or Unix like operating system. How do I list or find out unicodes for given characters?
[click to continue…]

Linux / Unix: Bash Shell See All Exported Variables and Functions

How do I see a list of all exported variables and functions under Unix bash shell?
[click to continue…]

HowTo Run a Script In Linux

How do I run a Linux shell script? How can I run a script in Linux operating system using command line options?
[click to continue…]

Linux: Change the PATH [ Add New Directory ]

How do I change the PATH settings under Linux operating systems and add a new directory to $PATH under bash shell?
[click to continue…]

Ubuntu Set User Profile Under Bash Shell

How do I set user profile under bash shell running Ubuntu Linux operating systems?
[click to continue…]

UNIX / Linux: Set your PATH Variable Using set or export Command

How do I add a new path to $PATH variable under Linux and UNIX like operating system? What is my path, and how do I set or modify it using csh/tcsh or bash/ksh/sh shell?
[click to continue…]

How to Set JAVA_HOME / PATH variables Under Linux Bash Profile

I just need a help to show me how to setup java path on Linux. How can I set JAVA_HOME and PATH variables for every user under my Linux system?
[click to continue…]

Display or print UNIX / Linux path ~ $PATH variable

Q. How do I print current path settings under BASH shell? I’m using Debian Linux.

A. In UNIX / Linux file systems, the human-readable address of a resource is defined by PATH. On Unix / Linux like operating systems, (as well as on DOS / Windows and its descendants), PATH is an environment variable listing a set of paths to directories where executables may be found.

Display current PATH

Use echo command:
$ echo $PATH


Modify current PATH

Use export command to add /opt/games to PATH, enter:
export PATH=$PATH:/opt/games

To format your PATH variable for easy viewing, add following code to your bash startup file (such as ~/.bashrc or ~/.bash_profile) :

function path(){
    printf "%s\n" $PATH

(Function credit: usenet archive)

Now just run path:
$ path


How to: Change User’s bash profile under Linux / UNIX

Q. How do I change my own profile? How do I change profile for other users? How do I setup global profile for all users under BASH shell?

A.. You need to add user profile to ~/.bash_profile. It is the personal initialization file, executed for login shells. There is also ~/.bashrc file which is the individual per-interactive-shell startup file. Common uses for ~/.bash_profile are to set environment variables such as PATH, JAVA_HOME, create aliases for shell commands and set the default permissions for newly created files etc. The file ~/.bashrc is similar, with the exception that .bash_profile runs only for Bash login shells and .bashrc runs for every new Bash shell.

Edit user .bash_profile file

Use vi command:
$ cd
$ vi .bash_profile

My same profile:

umask 022
if [ -f ~/.bashrc ]; then
    . ~/.bashrc
if [ -d ~/bin ] ; then
alias dironly='printf "%s\n" */'
alias dironlyv='echo */.'
alias dragon=~/bin/showMenu.pl
export PATH=/usr/lib/jvm/java-6-sun-${PATH}

.bashrc vs .bash_profile files

Let us see the difference with these two scripts:

~/.bashrc file runs every time you open a new non-login bash shell such as xterm / aterm, and ~/.bash_profile runs only with login shells i.e when you first log in into system.

/etc/profile - System wide global profile

The /etc/profile file is systemwide initialization file, executed for login shells. You can edit file using vi (login as root):
# vi /etc/profile

Commonly used UNIX / Linux commands by new user

Q. . I'm a new Linux user. Can you tell me commonly used Linux / UNIX command?
[click to continue…]