.bashrc is the Bash shell configuration file for a user's terminal login session.

learn more… | top users | synonyms

52
votes
4answers
69k views

Why ~/.bash_profile is not getting sourced when opening a terminal?

Problem I have an Ubuntu 11.04 Virtual Machine and I wanted to set up my Java development environment. I did as follows sudo apt-get install openjdk-6-jdk Added the following entries to ...
37
votes
3answers
16k views

Bash history search, partial + up-arrow

I have searched, but not found anything on this. I am looking for a functionality in bash, using a terminal. Way back when, I had a user on a debian system, and a friend set me up with a convenient ...
29
votes
6answers
166k views

Where is .bashrc?

I feel stupid asking, but I can't seem to find the answer to this anywhere. I'm trying to follow these instructions to edit my bash prompt, but there is no .bashrc in either my user directory ...
26
votes
3answers
18k views

How can I shorten my command line (bash) prompt?

Currently it is: michael@Castle2012-Ubuntu-laptop01:~/Dropnot/webs/rails_v3/linker/spec/controllers$ Outside of renaming my machine and directory structure... How could I make it be something ...
19
votes
5answers
1k views

How do I teach bash in Ubuntu some curse words?

When bash encounters an unknown command(word?) it does this : The program 'hello' can be found in the following packages: * hello * hello-debhelper Try: sudo apt-get install <selected ...
17
votes
3answers
11k views

Changing colors for user, host, directory information in terminal command prompt

Is it possible to change the colors in the command prompt for the user@computer, as well as the the current directory and command parts of the prompt display? I've already seen something like this ...
16
votes
3answers
4k views

What does “${debian_chroot:+($debian_chroot)}” do in my terminal prompt?

In my terminal prompt definition in my .bashrc file, among other things, I have this snippet of code: ${debian_chroot:+($debian_chroot)} What does this do, and do I need it?
15
votes
4answers
1k views

How (and where) can one change 'user@host $:' pattern in gnome-terminal?

When I start terminal in Ubuntu, I see: ilya@HOST:~$ I need to add a timestamp to this, something like: 2011-10-09T09:32:00 ilya@HOST:~$ How can I configure this?
13
votes
4answers
25k views

Specify JDK for tomcat7

I have installed tomcat7 (using apt-get install) and whenever I want to start tomcat7 it says : * no JDK found - please set JAVA_HOME I have set JAVA_HOME in my bash.bashrc and also in ~/.bashrc ...
13
votes
4answers
642 views

How to get shared bashed history among different tabs

I used the answer in http://unix.stackexchange.com/a/1292/41729 to enable real-time shared history among separate bash terminals. As explained in the answer above, this is achieved by adding: # avoid ...
12
votes
2answers
19k views

.bashrc not executed when opening new terminal

The code in .bashrc does not execute when I open a new terminal window in Ubuntu 12.04. I noticed this when creating a .bash_aliases file. The aliases did not show up when I opened a new terminal. ...
12
votes
1answer
1k views

How to display random jokes from www.icndb.com in your terminal?

I already know that you can get some nice quotes/jokes using the fortune program. But I've found in this urwird script a new source of fun that I'd like to have when I open a new terminal. This time ...
12
votes
2answers
14k views

Configure gnome-terminal to start bash as a login shell, doesn't read .bashrc

I'm trying to integrate RVM with gnome-terminal. Per default, gnome-terminal does not start bash as a login shell. I enabled run command as a login shell as suggested in this answer about the same ...
12
votes
2answers
1k views

Can I create a separate bash history file for each terminal profile?

I use a bash script to start gnome-terminal with multiple tabs, each tab using a different profile, working directory, and in some cases executing a command within the tab. In this situation, I'd ...
11
votes
1answer
11k views

Why is /etc/profile not invoked for non-login shells?

Login and non-login shell defined as: su - $USER # will give you a login shell bash # will give you a non-login shell /etc/profile is not invoked for non-login shells, such as when you start ...
11
votes
6answers
14k views

How to add an alias to a command in terminal?

By typing a manually specified command in terminal i want to do some. How could add an alias to a command? Can i do that with the help of the terminal or should i edit some kind of file?
10
votes
5answers
13k views

difference between bash.bashrc and /etc/environment file

Till data I was used to set my environment variables in the bash.bashrc file. Recently I told to use the /etc/environment file. Well, both work fine. So, what is the difference between them? I ...
10
votes
1answer
1k views

How do I show a message with username and date at login?

How to show the message "hello $username, today's date is $date" as soon as you login to Ubuntu.
10
votes
2answers
971 views

Why does Ubuntu's default ~/.profile source ~/.bashrc?

These are the contents of the stock ~/.profile that came with my 13.10 (commented lines removed): if [ -n "$BASH_VERSION" ]; then if [ -f "$HOME/.bashrc" ]; then . "$HOME/.bashrc" fi fi ...
9
votes
2answers
1k views

What does the first '.' mean in '. ~/.bashrc'? [duplicate]

I saw a post about fix your alias in .bashrc. And he says after you put your alias in .bashrc , you need to use: . ~/.bashrc I do not quite understand what the first dot(' . ') does here. What's ...
8
votes
3answers
9k views

How to restore .bashrc file?

The terminal shows this when it opens: bash: /home/atlas/.bashrc: line 73: syntax error near unexpected token `[' bash: /home/atlas/.bashrc: line 73: `if [ -x /usr/bin/dircolors ] ; then ' I've ...
8
votes
4answers
13k views

Can not successfully source .bashrc from a shell script

Normally we can source ~/.bashrc file using this command source ~/.bashrc but if I write this in a shell script and execute it, nothing happen. Why? Is there any way to do this? my shell code: ...
7
votes
1answer
432 views

Sequence of scripts sourced upon login

I would like to concentrate all my login config in my ~/.bash_profile. There was a ~/.bashrc there by default but I replaced it with a ~/.bash_profile. However, when I log in, something before my ...
7
votes
2answers
9k views

Root's .bashrc not executing on sudo -i

On one of my Ubuntu 11.10 servers, when I use sudo -i to become the root user, root's .bashrc is not being executed. On all other servers, whose relevant configurations are identical as far as I know, ...
7
votes
2answers
6k views

What if I don't have a bashrc?

Will I be able to login? What havoc will it cause, if any? How will it mess up m terminal? There are login and non-login terminals too. How will it affect those?
6
votes
2answers
143 views

What is a .bashrc file and what does it do?

I can't seem to find any clear information on what the .bashrc file is and what it does exactly. Thanks for all the help so far. It seems that this script does everything from coloring, ...
6
votes
1answer
6k views

How is ~/bin added to my path?

I have not added ~/bin to any of my .bash* files. However, $PATH does list that directory. The reason I am asking this in the Ubuntu specific StackExchange is because, well, I have exactly the same ...
5
votes
1answer
2k views

Restore .bashrc to its default?

I've been trying to install Android developer tools on Eclipse, and I followed the information in this video: http://www.youtube.com/watch?v=-qk9c-Ug2UI&list=PLQOohAn5nxx43fqFugU6dIwSQNbvXdgi5 . ...
5
votes
2answers
804 views

How to check which terminal emulator is being currently used?

I have gnome-terminal and Guake installed. I want to give different startup messages to be displayed on these terminal emulators as they start. What code should I write in .bashrc so that this is ...
5
votes
1answer
310 views

My bash function runs only once per terminal opened

When I try to run my bash function, defined in .bashrc, for a second time in the same terminal, it doesn't work. The code is the following: function nos (){ local option while getopts cs ...
5
votes
2answers
11k views

bash: [: too many arguments?

I'm trying to create a directory and cd into it: In ~/.bashrc: function abc() { appname=$1 appdir="$HOME/code/$appname" if [ mkdir $appdir -a cd $appdir ]; then echo Success else ...
5
votes
1answer
499 views

Synchronize profiles across servers (.vimrc and .bashrc)

I'm on a few different servers on any given day. I'm starting to really tweak two files in my bash profile: .vimrc and alias.sh. Would anyone have a recommended way to save and sync these two files. ...
5
votes
1answer
792 views

Source/Dot operator error on login. Possibly caused by bad byobu uninstall

I am getting an error message every time I ssh into my box or run sudo -i. It looks like this for login: login as: person chands@ubuntu-server's password: -bash: .: filename argument required .: ...
5
votes
2answers
198 views

How to easily make an alias command permanent? [duplicate]

I search everywhere and almost everyone was suggesting to open the ~/.bashrc or ~/.bash_aliases, then put the alias command there, I created a function name palias as permanent alias function and put ...
5
votes
3answers
2k views

gnome-terminal does not allow changing the title

I've selected "Replace initial title" setting in gnome-terminal's preferences, but it just shows the default title "Terminal". After reading this answer, I added this to my .bashrc: ...
4
votes
3answers
850 views

write function in one line into ~/.bashrc

Why when I try to wite a function just in one line into .bashrc file, list(){ ls -a } I get error? bash: /home/kasiya/.bashrc: line num: syntax error: unexpected end of file but when I write it ...
4
votes
5answers
1k views

How can I uniqely record every new command I use, and possibly timestamp it?

I've been on Linux for more than 6 months now but never went too much into the CLI (command-line interface or terminal or shell) Now as I ask questions here, get answers, or help from other sites, I ...
4
votes
2answers
827 views

Store frequently used terminal commands in a file

Okay, so I want add a command to my Desktop (Or any convenient location), and whenever I run it I want it to clone the HTML5 boilerplate. $ git clone git://github.com/paulirish/html5-boilerplate.git ...
4
votes
2answers
6k views

How to save terminal history manually?

It's my understanding that the history file is updated when the terminal exits. But sometimes my computer crashes out, and the terminal doesn't exit cleanly, and then I lose those commands from my ...
4
votes
2answers
169 views

Shell gives no prompt if auto completion is enabled (blinking cursor instead)

I tryed to enable shell autocompletion uncommenting the following lines in my .bashrc: # enable programmable completion features (you don't need to enable # this, if it's already enabled in ...
4
votes
1answer
623 views

changes to /etc/bash.bashrc not permanent

After a recent upgrade to 12.04, auto tab completion was disable in /etc/bash.bashrc. I uncommented the following lines: if [ -f /etc/bash_completion ] && ! shopt -oq posix; then . ...
4
votes
1answer
4k views

What could be a reason for `.bash_profile` and `.bashrc` not to execute the exports?

the CUDA installation tutorial tells me to add the following two lines to my .bash_profile. export PATH=/usr/local/cuda/bin:$PATH export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH But ...
4
votes
1answer
277 views

why aren't my bash aliases applied when logging in to server

When I log in to my Ubuntu 12.04 LTS server my bash aliases aren't applied, but if I execute bash from the command line they are. ~/.profile executes ~/.bashrc: if [ "$BASH" ]; then if [ -f ...
4
votes
3answers
2k views

How can I shorten the bash prompt's current path to one letter per directory?

I can't remember where, but I've already seen the bash prompt's current path shortened in an interesting way: every directory contained in the path is replaced by its first letter only. For instance: ...
4
votes
1answer
342 views

Open terminal in current directory with tmux

I have a simple .bashrc file at the moment that allows me to always open the same terminal (reopen, actually) running tmux. The important part is shown below. The essence of this is that when you ...
3
votes
1answer
87 views

Is there a way to mirror directory changes in Terminator?

I'm on Ubuntu 12.04 and am using Terminator as my primary terminal. I like it because it lets me keep a python interpreter and bash terminal open at the same time, in the same view. What is annoying ...
3
votes
2answers
338 views

.bashrc shebang line reports command not found

Tried the following shebang lines: $ head -n2 .bashrc | od -c 0000000 357 273 277 # ! / b i n / b a s h \n $ bash bash: #!/bin/bash: No such file or directory .bashrc starts ...
3
votes
1answer
247 views

Saw an interesting command but can't alias it

Saw an command from this post http://askubuntu.com/a/266839/75967 that I would like to alias find {,/usr}/{,s}bin -printf '%f\0' | xargs -0 whatis | sort | less I assume the less or the | is ...
3
votes
1answer
4k views

I think I accidently deleted the PATH variable

Whatever I try to run, I get the error: The command could not be located because '/usr/bin' is not included in the PATH environment variable. I had some modification in my .bashrc file but then ...
3
votes
2answers
2k views

I messed the file bash.bashrc ubuntu 14.04

Trying to install java jre, I messed up the file bash.bashrc on Ubuntu 14.04, by adding these two lines at the end : export PATH= $PATH:usr/java/bin/ ; export JAVA_HOME= ...