.bash_profile is one of the scripts the Bash shell reads and executes when started as an interactive login shell.

learn more… | top users | synonyms

237
votes
3answers
69k views

Difference between .bashrc and .bash_profile

What's the difference between .bashrc and .bash_profile and which one should I use?
60
votes
5answers
122k views

Where to find the .bashrc file on Mac OS X Snow Leopard and Lion?

I want to install rvm on my Snow Leopard machine. It says I need to add a line to my .bashrc file (I'm using bash) but where is my .bashrc file?
20
votes
2answers
23k views

How do I modify my git bash profile in Windows?

I'm using Git Bash on Windows 7 and would like to set up bash profile aliases such as alias gs='git status' to make my life easier. How can I do this?
16
votes
2answers
21k views

Environment variables in bash_profile or bashrc?

I have found this question [blog]: Difference between .bashrc and .bash_profile very useful but after seeing the most voted answer (very good by the way) I have further questions. Towards the end of ...
15
votes
3answers
12k views

MinGW Bash profile

I use MinGW on windows 7. I have a .bashrc with some aliases in it. The file is in my home folder which is where MinGW starts me in, so it also believes that the folder is my home folder. It does not ...
12
votes
5answers
40k views

How to automatically execute a shell script when logging into Ubuntu

How do I get a script to execute automatically when I log in? Not when the machine starts up, and not for all users, but only when I (or any specific user with the script) login via the GNOME UI. ...
11
votes
1answer
5k views

enabling colors in the python interactive shell on OS/X

I have just modified my .bash_profile so as to have colors in iTerm and Terminal. Now, I want to enable syntax highlighting for the Python interactive shell, IDLE-style. How to do that?
9
votes
3answers
4k views

Is it possible to override the command line's built in “cd” command?

Just about every time I 'cd' to a different directory on my machine (in this case, running Mac OS X 10.6.7) via the command line (which is bash), I immediately type 'ls' to get the list of contents in ...
9
votes
2answers
19k views

How can I fix a Broken Pipe error?

I recently reinstalled RVM (following the instructions at http://rvm.io) after a fresh install of Ubuntu 12.10 when I got an SSD Drive. Now, when I type: type rvm | head -1 I receive the following ...
8
votes
5answers
971 views

Syncing bash profile between computers

I have tons of stuff in my .bash_profile. The problem is, I use ~3 computers very frequently, and I'm tired of having to copy paste my prefs everywhere. Two of them run Ubuntu 10.10, and one runs OSX. ...
8
votes
3answers
28k views

How to reset Bash on Mac OSX, .bash_profile corrupted and bash no longer works

I am on a MacBook Pro, running the latest version of Mountain Lion. I really need some help, I have managed some how to damage my .bash_profile (I think) so that every time I open up the terminal I ...
6
votes
2answers
577 views

why error code 1 returned by loading .bash_profile in Mac

Whenever I open a bash terminal, the error code 1 is returned: Last login: Tue Jan 15 16:19:53 on ttys000 spam@moss:~ $ echo $? 1 I found this is caused by last line of code in my .bash_profile: ...
5
votes
4answers
7k views

~/.profile is not loaded when using SSH (Ubuntu)

Edited to reflect the problem I really wanted to solve: I need to set up my ruby environment so I can deploy via Capistrano. export PATH=$HOME/.rbenv/bin:$PATH eval "$(rbenv init -)" I put these ...
5
votes
2answers
1k views

Mac OSX: Cannot color broken symlinks

On my linux machine, you can tell intact symlinks from broken ones, because broken ones are colored red. I've tried to set this up on my mac by adding some configurations to PSCOLORS in my ...
4
votes
2answers
7k views

How do I create a terminal shortcut to this path?

So I'm having a problem creating a shortcut to a deep folder. None of the examples I've seen on Superuser have helped :( This is my path: cd / Applications / MAMP / htdocs / whoat / solr / whoat I ...
4
votes
4answers
5k views

.bash_profile not sourced

I have a .bash_profile file that I added some stuff to (aliases and color and some git stuff) and when I open iTerm and source it then everything's fine and I have everything but when I close iTerm ...
4
votes
1answer
916 views

How to make alias/function in .bash_profile for `curl` that takes an argument?

I found this tip super helpful, for using curl to resume an interrupted file copy. The full syntax is: curl -C - -O file:///Volumes/path/to/file I would like to add an alias or function called ...
4
votes
2answers
221 views

Why does bash sometimes think my $HOME isn't the correct directory?

Like the title says it seems that bash sometimes misidentifies my $HOME. This cropped up after a seemingly unique series of events that I will now replay in broad strokes. Running OS X 10.6 with ...
3
votes
2answers
7k views

Explain why .bash_logout won't run commands?

So I've been wondering how to run these two lines of code everytime I close an open instance of Terminal: history -c cat /dev/null > ~/.bash_history I export HISTFILE=5 on startup, but still ...
3
votes
2answers
3k views

How do I close an OS X application from the command line using a alias defined in my .bash_profile?

I found the following shell script that can be used to tell an OS X application to quit: #!/bin/sh echo | osascript <<EOF tell application "$*" quit end tell EOF I have several simple ...
3
votes
1answer
8k views

How can I permanently add a path to my bash profile? [duplicate]

Possible Duplicate: How do I set PATH and other environment variables? I would like to put the path of a binary in my bash profile which is not present in the usual location like /usr/bin ...
3
votes
1answer
533 views

How can you remove duplicates from bash history?

Since I'm saving history from different sessions this is an issue where erasedups can't help because I'm using the following: PROMPT_COMMAND="$PROMPT_COMMAND;history -a" Is there an easy way to ...
3
votes
1answer
76 views

Why am I not able to add directory in linux $PATH

I am trying to add ~/.bin into my path and for that I edited the .bash_profile and added the below line PATH=$PATH:$HOME/.bin/ and than I logged out/in. Now when I do echo $PATH I get ...
2
votes
9answers
1k views

Command to search programs in Linux

Do you have any easy idea to define some alias in .bashrc for finding some command that you want to search (when you forgot its name) in your machine, visiting all "bin" directories, maybe using ...
2
votes
2answers
28k views

Edit .bash_profile in OS X

How do I edit the bash_profile? I've tried using the command chflags but it shows the error [Error writing. Bash_profile: Operation not permitted] I'm using OS X Snow Leopard 10.6.8.
2
votes
5answers
471 views

Multiple-command alias enters bash shell but fails to navigate to path

I have this alias defined to run bash then navigate to a certain folder but when I run it, it only runs bash and stays in the current path/directory/folder. I've defined them in two different ways in ...
2
votes
1answer
3k views

.profile and .bash_profile ignored when starting tmux from .bashrc?

I've been having an issue with getting my .profile to be sourced when SSHing into an Ubuntu 12.04 server instance. My .bashrc does the following towards the end: if [[ "$TERM" != "screen-256color" ]] ...
2
votes
2answers
888 views

Set ls to return colored results by default

In my .bashrc I have the following lines to turn on colors for grep and ls alias ls='ls --color=auto' export GREP_OPTIONS='--color=auto' I've tried changing the alias to export ...
2
votes
4answers
4k views

Aliases in .bash_profile do not work

I have added some cd blah blah commands as alias in my .bash_login so as to ease changing directories.It was working fine .Suddenly though none of the aliases in there work .It says command not found ...
2
votes
1answer
39 views

Removed lines in .bash_history are still listed in history command. How to load the changes?

I removed command lines in my .bash_history. The problem is that when I execute the history command the deleted commands are still listed. How do I load the changes ? I tried source .bashrc and ...
2
votes
1answer
2k views

Error when installing and trying to get version of SASS via Terminal

Not sure what is going on, I was able to install git via the terminal (had to create a bash_profile). Now I installed ruby and did install sass. However when I did sass --version I got a bash error? ...
2
votes
1answer
783 views

Overwrite ls in .bash_profile

I'm new to bash and unix. I'm trying to create an alias for ls. In my .bash_profile I have the following: alias ls="ls -lhHG" This doesn't work at all. If I change it to: alias la="ls -lhHG" ...
2
votes
1answer
124 views

Script acting strange in bash_profile (but just under X)

I have made a simple .sh script which checks every minute whether a particular file is empty or not, and if it is not empty, makes a led on my laptop blink at 0.5Hz. I call this script from my ...
2
votes
1answer
182 views

Sort out where to put my bash commands, alias, and configurations

It seems to me that every Linux distro that I SSH into or use locally (Mostly RHEL/CentOS and Debian/Ubuntu machines) have a different idea about which of .bashrc and .bash_profile to run when I log ...
2
votes
0answers
384 views

Why does this line appear every time I launch iTerm on my MacBook?

So I use iTerm on my MacBook Air and also my MacBook Pro. I've been playing around with .bashrc and .bash_profile and trying to come up with clever ways to configure things. At one point I decided I ...
2
votes
1answer
79 views

In bash 4.3.27 “su” ignores user variables when combining “-” with “-c command”?

Since forever we used to launch user scripts from a different user crontab like this: 00 12 * * 1 su - user2 -c "/home/user2/myscript.sh" By doing this, the script is launched after the interactive ...
1
vote
2answers
1k views

bash alias doesn't carry over with sudo

I'm curious if there's a way to get my .bash_profile to work when I sudo a program. For example, I have it set to alias emerge='emerge -av' so that I can install software, and it will always ask me ...
1
vote
2answers
3k views

Mac OS Lion Terminal: Add blank line after command output?

How can I configure my .bash_profile to add a blank line after any command output?
1
vote
2answers
1k views

Getting GNU Emacs Windows to run my ~/.bash_profile when creating a Cygwin M-x shell subprocess

I use GNU Emacs on Windows and Cygwin for the shell that I do all my work in. The ~/.profile used by Cygwin is ~/.bash_profile. If I start a Cygwin shell by running C:\cygwin\Cygwin.bat, it starts ...
1
vote
2answers
1k views

-bash: __git_ps1: command not found

I recently uninstalled Homebrew and Cellar (web dev applications), and this error now appears after every Terminal command (although I can't confirm that these are the culprits!): -bash: ...
1
vote
4answers
961 views

Unable to make bash default shell in freebsd

I wanted to change my default shell to bash in freebsd. I tried the following: 1.chsh -s /bin/bash (or /usr/local/bin/bash) <my_username> I get this error after entering the password: chsh: ...
1
vote
3answers
5k views

I've broken my .bash_profile

In the course of trying to install something on my Mac OSX machine, I think I have broken my ~/.bash_profile file. I edited it, and suddenly, now, when I open a terminal, I can't run anything, or even ...
1
vote
2answers
33 views

Is there a way to make my .bash_profile load the contents of my .profile file?

I was using a .profile quite happily for two years on my Mac now running Yosemite. A recent brew install created a .bash_profile and whilst my .profile still exists, it is now no longer loaded. I ...
1
vote
1answer
122 views

Alias for viewing logs with todays date

I want to create an alias: alias readFile='ls file1.todaysdate' where todaysdate is in format 130714. How would i do this?
1
vote
3answers
187 views

bash: repeatedly executed script in .bash_profile blocks login

I have a bash script (let's call it script.sh) which looks like this while true; do if [ $someFile -eq = "1" ] then # make laptop LED blink here fi done So when some file has some value ...
1
vote
1answer
92 views

Problem with bash profile

I modified my .bash_profile on my Mac (now running Tiger) to get a different command prompt. Before I did that, I used to be able to use the up arrow key to cycle through previously issued commands. ...
1
vote
1answer
3k views

Where can I find bash_profile / bashrc themes?

I've been searching for bash_profile / bashrc themes on google for awhile but I'm not finding any kind of aggregation for themes. Most of them I find are small snippets like: export ...
1
vote
1answer
90 views

Custom prompt doesn't work on Mac's terminal

I like to use a custom prompt (current path in blue) on my unix machine: export PS1='\[\e[0;34m\]\w \$\[\e[m\] ' But when I try to use it on Mac's terminal it doesn't work: it fails to detect the ...
1
vote
2answers
246 views

Default file extensions in .bash_profile

I use Mac OS Lion and I would like to declare in my .bash_profile the file extensions and the default application to open them. For example, I want to associate all .txt files to TextMate so that ...
1
vote
1answer
1k views

brew doctor giving error on a directory that has been removed

I just installed homebrew and as suggested, I ran the brew doctor command. I am linux newbie and do not know how to fix most of these things. But I would like to ask especially about the following ...