.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

306
votes
4answers
92k views

Difference between .bashrc and .bash_profile

What's the difference between .bashrc and .bash_profile and which one should I use?
37
votes
3answers
45k 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?
0
votes
1answer
24 views

need to source bash_profile in each new iterm window

I am on macbook pro, el capitan. I have aliases set in .bash_profile, which work in the first instance of iTerm, however they are not recognized if I open a new iTerm instance, I have to do source ~/....
0
votes
0answers
19 views

Mac Terminal error - .bash_profile

In the process of trying to update git I've been in the .bash_profile. I've obviously done something and when I open the terminal now I get this message. -bash: X≈function: command not found ...
4
votes
3answers
53 views

Periodically source shell profile

I'm a zsh user, but this should apply to any shell in theory. When I edit my .zshrc to add a new alias, I have to source ~/.zshrc in all of my open terminal tabs/windows to be able to use the new ...
0
votes
2answers
20 views

running chained bash function commands in background

I am attempting to call port() { fuser -k $1/tcp; python manage.py runserver $1 ;} runproject() { cd $HOME/projects/$1 ; workon $1 ; port $2 & ; sleep 3 ; google-chrome 127.0.0.1:$2 ;} (port is ...
15
votes
3answers
37k 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 ...
0
votes
1answer
40 views

recover the currently loaded scripts in bash

I just typed rm ~/.profile instead of vim ~/.profile. I have several terminal windows open still. Can I recover this easily, based on what was run when a different terminal started?
5
votes
1answer
115 views

Execute same command for each non-interactive bash session

I need to implement some config - I need to execute some code, if someone on my system calls for bash command in any form (interactive, non-interactive and bash -c form). For example this is command I ...
3
votes
5answers
9k 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 ...
0
votes
0answers
40 views

bash how to remove “__bp_precmd_invoke_cmd” error?

I get after each command the error bash: __bp_precmd_invoke_cmd: command not found even after the command is successfully executed. e.g. if I run the ls command I get the proper listing of the ...
22
votes
5answers
18k 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 ...
20
votes
3answers
27k 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 ...
1
vote
2answers
142 views

Create PATH for OS X Python virtualenv install

I'm a Terminal and Python newbie, but I'm using virtualenv a lot right now for a Python project. Changing directories manually to source the virtualenv in my filesystem is quite tedious, so I'm ...
0
votes
1answer
62 views

Where is .bash_profile?

I'm trying to follow the instructions here: http://www.ladysign-apps.com/developer/mac-osx-run-sublime-from-your-terminal/#.Vj0ZfYRqmj4. Where is .bash_profile located? I see a .bash_profile.swp in ...
0
votes
2answers
86 views

.bashrc/.bash_profile not loading export

I'm trying to compile code and in order to get it to work I need to run the following line before compilation: export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig After this the code compiles normally, ...
0
votes
0answers
60 views

Git related Issue with Terminal commands on my Mac OS X 10.10 (Yosemite)

My question follows a previously answered question in this forum. But I have an even stranger problem. The same screenshot about Git command requiring Xcode installation is appearing on my Mac OS X 10....
0
votes
1answer
9 views

Add a command to user terminal profile?

Every time I start a new terminal, I have to type nvm use 4.1.1 to get my node version selected. Is there a way to get this to be 'typed' or added to some environment variable when I open a new ...
0
votes
0answers
10 views

Running bash_profile on reboot terminal

If I have a terminal (iTerm2) open on reboot, and ask for OS X to reopen currently open windows on start, it will reopen my terminal in the same directory, but .bash_profile won't be run. why? and ...
1
vote
3answers
550 views

Is it possible to set color for the user input in bashrc?

Note that I only want user's input to have specific color (words that user has typed with keyboard), not the actual command's output. I tried: export PS1="$ \033[38;5;154m" I know that it should ...
1
vote
1answer
2k views

Why does mac iterm and iterm2 not source .bashrc or .bash_profile?

I have ready many posts related to login/non-login and interactive/non-interactive. It would be my understanding that .bashrc should be sourced from iterm - which is interactive logon shell. It is ...
2
votes
2answers
150 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 ...
0
votes
0answers
90 views

Running 'su - user sh -c “~/.profile”' returns “No such file” error

I have a shell script running as root with the following command: ssh remotehost 'su - user sh -c "source /home/user/.profile; <command>"' I get the following output: bash: su - user sh -c "...
0
votes
1answer
64 views

Is there a standard place to put my Aliases? bashhrc vs. bash_aliases

Is there a standard place to put custom aliases? If not, what are the benefits and disadvantages of .bash_aliases, .bashhrc, and .bash_profile?
13
votes
5answers
47k 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. ...
2
votes
1answer
45 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 ...
73
votes
5answers
172k 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?
0
votes
2answers
59 views

Creating a bash routine

Everytime I log in into my work machine, I have to open a terminal and type the same routine: $ cd /Documents/some_folder/some_another_folder $ vagrant up $ vagrant ssh I'd like these commands to ...
8
votes
4answers
12k 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 ...
1
vote
1answer
505 views

Non-interactive ssh sessions don't have PATH set on some systems

I set my environment in .profile. My .profile is idempotent and .bash_profile, .bashrc, .kshrc and .zshrc all source .profile. That way I always get the same environment regardless on what bourne-...
2
votes
9answers
2k 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 regex?...
0
votes
1answer
73 views

Mac .bash_profile.save How to make it run by itself / where to actually change paths

trying to change my path for Ruby / SASS. I have always used a file in my home called '.bash_profile.save' In there I have the export paths which work fine but only when I run: source ~/....
0
votes
1answer
66 views

Bash file error

When I type "./" followed by a file name, how do I find out which program is executing it? ie. I have some scripts like "derp.sh" that will execute if I type "/bin/bash derp.sh" but fail if I write "./...
2
votes
1answer
136 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 ...
0
votes
2answers
102 views

Why do I add a path to ~/.bash_profile and source it, but there's no effect?

In my install.sh: # other commands to install java... echo 'export JAVA_HOME="/usr/java/latest"' >> ~/.bash_profile source ~/.bash_profile After this script runs, I type echo $JAVA_HOME, but ...
0
votes
1answer
1k views

How to install the debian bash-completion using homebrew?

I want bash to install bash command completion on my mac using brew.
0
votes
1answer
61 views

Configure bash_profile for one single terminal emulator

I am using a new terminal emulator. Terminology is the E17 default terminal, and it has a great command: tyls which is a "graphical" ls I want to create an alias just for this terminal, because the ...
0
votes
0answers
133 views

Entered wrong .bash_profile and now my laptop is running hot

I am just learning how to use the command line and was editing the bash prompt setting in .bash_profile. I made an error in the prompt settings in .bash_profile and I lost the prompt and the ability ...
1
vote
3answers
13k views

OS X Lion - Installing Oracle 10g Standard Edition

Im trying to install oracle 10g on to OS X Lion, I have previous achieved this on snow leopard with the following http://blog.rayapps.com/2009/09/14/how-to-install-oracle-database-10g-on-mac-os-x-snow-...
0
votes
0answers
146 views

How to permanently make the Output of python codes to appear in a different color in the terminal?

I found it really annoying when I use terminal that everything is in one color. I am looking for a way to print the output of my python code in a different color on the terminal console, so it will ...
0
votes
1answer
54 views

How to store setings

I have made my .bashrc give me two types of prompts; longp: xanth@X-VboxTux:~➤➤➤ and shortp: ➤ I have done this by writing a 0 or a 1 to a file and then to determine what prompt should be shown ...
16
votes
3answers
7k 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 ...
7
votes
2answers
2k 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 ....
10
votes
3answers
45k 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 ...
3
votes
1answer
1k 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
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 ...
0
votes
1answer
21 views

BASH Variable substitution(?)

I have the following script: var1="var1value" var2="var2value" var3="var3value" I want to create the following code: option=$1 myvar=`echo var$option` So, when the option is "1" the myvar ...
0
votes
1answer
308 views

osx - change terminal-color based on user

what i want to achieve : everytime i log onto a machine via ssh with a specific user -> "danger" like ssh danger@somehost i want the terminal to change its background to red, so i have a visual ...
1
vote
1answer
617 views

Can .bash_profile automatically run without sourcing it in iTerm2?

I am using iTerm2 in Mavericks OSX and made sure I updated to the latest version. My working directory inside preferences is set to Home Directory. I was watching a tutorial on iTerm customization ...
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: __git_ps1:...