Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Here is what I noted down from my lecture:

  • Find file .bashrc in your home directory
  • do vi .bashrc
  • When you put an application folder somewhere, make sure that its address is in the path variable.

The problem is that I do not have a .bashrc file in my home directory. There is only a .bash_history file in my home.

If i go to the root, there is a etc/bash.bashrc file there but what i think is that it will make changes for all users and not just for me. I want to add this path just for myself. It shouldn't effect others. Also there is no $PATH variable in that bashrc file so I am even more confused.

share|improve this question

migrated from stackoverflow.com Apr 18 '13 at 14:29

This question came from our site for professional and enthusiast programmers.

4 Answers 4

up vote 4 down vote accepted

Don't forget it is a hidden file inside your home directory (you would not be the first to do a ls -l and thinking it is not there).

Do following ...

ls -la ~/ | more

There should be a .bashrc on the first page. If not just create it with

vi ~/.bashrc

And simply write following line into it.


OR Most of the distributions keep a standard .bashrc file in /etc/skel/ You can copy it to home directory.

$cp /etc/skel/.bashrc ~
share|improve this answer
OK I get that now. On other computers, I can type lego and the software starts. On my system, the lego folder is in my ~/data/user1/bin folder. I have added this path to .bashrc file. Now what do I have to do so that when i type lego, it should start the software? Do i have to set up an alias? If yes, how? alias lego='<What do i put here???>' –  detraveller Apr 18 '13 at 13:47
@detraveller Have you added ~/data/user1/bin to your PATH environment variable in the .bashrc file? (add this line: export PATH=$PATH:~/data/user1/bin) - if so, you should be able to just type lego in the terminal, and the program should start. –  AcId Apr 18 '13 at 14:40
I added only PATH=$PATH:~/data/user1/bin. You didn't mention export so I didn't put it there. I will try again tomorrow when I go to Uni. –  detraveller Apr 18 '13 at 18:12
But i was wondering how do i tell bash that lego is the word that starts the software? –  detraveller Apr 18 '13 at 18:25

Most distributions keep a standard .bashrc file in /etc/skel/ you can just copy to your home dir. Otherwise you could just make a new empty .bashrc file in your home dir.

share|improve this answer

Create Your Own Startup File for Interactive Shells

About Bash Startup Files

From the INVOCATION section of man 1 bash says:

When an interactive shell that is not a login shell is started, bash reads and executes commands from /etc/bash.bashrc and ~/.bashrc, if these files exist.

Note that these startup files are optional; Bash doesn't require them. Bash also differentiates between login shells and interactive shells. An interactive shell is defined thus:

An interactive shell is one started without non-option arguments and without the -c option whose standard input and error are both connected to terminals (as determined by isatty(3)), or one started with the -i option.

Many distributions source one type of startup file from the other, but some don't, so this issue can be difficult to address canonically. You need to examine all your startup files to see how and when your ~/.bashrc will be invoked on your system.

Creating Your Per-User Interactive Shell Startup File

If you're simply missing a user-specific ~/.bashrc file, just create one. This will be invoked by Bash for non-login shells (e.g. shells started without the --login flag), or whenever you force the shell to be interactive by invoking it with the -i flag.

share|improve this answer

If you don't have a .bashrc, you can simply create one and add the lines you wish to it, such as:


to add your user bin directory to the end of the path.

But you should be careful if there are other startup files. The rules as to what files get used are rather complex, but they're detailed in the bash man page. Enter man bash on a command line and look for INVOCATION.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.