.bashrc is the primary configuration file for the bash shell.

learn more… | top users | synonyms

9
votes
4answers
909 views

How can I find a rogue alias declaration?

I'm trying to find where a specific alias has been declared. I've searched all the usual places I know to look for aliases: ~/.bashrc ~/.bash_profile /etc/bashrc /etc/profile With no luck. I know ...
5
votes
3answers
438 views

Run ssh login command without modifying remote .bashrc

We have a bunch of servers set up with set -o vi in their ~/.bashrc. It would be nice to be able to ssh into these boxes and automagically run set -o emacs as a timesave. I've seen a solution ...
14
votes
2answers
302 views

bash_history: comment out dangerous commands: `#`

To prevent logging "dangerous" commands in bash history, I have added following line to my .bashrc file: HISTIGNORE='rm *:mv *:cp *:cat*>*:pv*>*' this works well, but it has a side effect: I ...
0
votes
1answer
13 views

RVM + TMUX—Duplicate entries in $PATH

My Linux terminal config files (.bash_profile, .profile, .bashrc) expand $PATH by prepending some custom directories. This only happens once (and I've also included some ENV vairiable based guards to ...
5
votes
3answers
45 views

How can I make my .bashrc call to shopt -s autocd depend on the bash version?

In Ubuntu I like having shopt -s autocd in my .bashrc file for automatic CD'ing with typing 'cd', i.e. just type the directory name (and probably use tab completion too) and press return and be ...
1
vote
2answers
175 views

Adding to PS1 in bash_profile

In my .bash_profile currently, I have PS1='\[\e[1;91m\][\u@\h \w]\$\[\e[0m\] '. I am trying to follow these commands to show branch name on iTerm terminal. I changed my PS1='\[\e[1;91m\][\u@\h ...
2
votes
2answers
60 views

bashrc that calls other bashrc depending on linux distro

I login to a system that reads my bashrc file and loads some software ready to use. I'd like to load a given bashrc file depending on the linux system that I am logging into. Specifically, if I am ...
5
votes
1answer
106 views

Is there a Bash file that will be always sourced in interactive mode no matter if it is login or non-login?

As far as I know the interactive shells may be login or not login and the start up files for them are different. If interactive + login shell → /etc/profile then the first readable of ...
0
votes
2answers
53 views

How to create a permanent alias without resourcing the .bashrc-like file?

I really like bash aliases, it annoys me that every time I want to add a new alias I have type two commands: echo "alias \"short-cmd\"='long-command'" >> ~/.bash_aliases source ~/.bash_aliases ...
2
votes
1answer
50 views

Where can I find a good boilerplate bashrc?

I've used unix/linux at work in the past, and recently started developing on a Mac. I'd always (lovingly) borrow co-workers' bashrc's for a good starting point, such as common aliasing and commands, ...
2
votes
2answers
28 views

Setting tabstop for bash output

Is it possible to set a tabstop (number of spaces per tab) for the more and less commands? In vi, I've added this line to .vimrc set tabstop=4 However when I read through a file with more it still ...
7
votes
3answers
101 views

In shell config scripts, how can I account for differences between coreutils on BSD compared to GNU?

Up until this month, my shell configs have been pretty simple (just a .bashrc or .bash_profile with some aliases mainly), but I have been refactoring it so I can get different behavior depending on ...
0
votes
2answers
79 views

How to write an alias function to make dd show progress bar?

According to this article, by replacing: $ dd if=/dev/sda of=/dev/sdb [additional options] with: $ pv -tpreb /dev/sda | dd of=/dev/sdb [additional options] one can augment the default dd ...
70
votes
4answers
110k views

How to correctly add a path to PATH?

I'm wondering where a new path has to be added to PATH environment variable. I know this is accomplished editing .bash_rc (for example), but it's not clear how to do this. This way: export ...
2
votes
4answers
70 views

Defining aliases for a certain directory

Is there a way to have an alias set for a particular directory and its subdirectories? I know I can put it in my .bashrc file, but I would like it only for a certain directory. Edit: what i mean is ...
3
votes
1answer
39 views

Why did my “d” break when I screwed up a bind?

I was swapping some readline settings in my .bashrc earlier today and mistyped the following (bind since it's not in .inputrc): bind "mark-symlinked-directories on" I forgot to put a set in there ...
0
votes
1answer
34 views

Using !n in script or interactive mode

I add to ~/.bashrc the following code: test_exclamation () { printf %s "$READLINE_LINE" | xargs echo } bind -x '"\eX": test_exclamation' I write to bash prompt buffer $ !1700 If I press Enter, ...
5
votes
2answers
104 views

how to add command line calculator to bash that uses comma as decimal mark?

How can I add a command line calculator to my bash? I have found some, but all of them use the full stop as decimal mark, but I want to have it to use the comma as decimal mark as most of the world ...
1
vote
1answer
2k views

sftp gives an error: “Received message too long” and what is the reason?

I was able to do sftp yesterday to a RHEL 5.4 box (RedHat) and today I can't. The message is "Received message too long 778199411", and after some investigation, it was due to my RHEL box's .bashrc ...
0
votes
1answer
80 views

java add to the path

I have some .jar files in a directory, /home/unix/dfernand/bin/picard/picard-tools-1.106. But when I add the directory to the PATH and CLASSPATH in my bashrc, java still does not recognize the .jar ...
0
votes
2answers
55 views

How to format history file to contain username too?

tail -2 /root/.bashrc export HISTTIMEFORMAT="%d/%m/%y %T " export PROMPT_COMMAND='builtin history 1 >> /var/log/root.log' With this all the commands could be logged (even the ones that were ...
1
vote
2answers
87 views

Debian: How to resolve Xserver failure

I keep finding similar posts online but I can't really use the solutions in my case. in my /etc/bash.bashrc file, I have the following code placed at the very bottom: if [ -e /tmp/.X0-lock ]; then ...
5
votes
2answers
179 views

l, ls & la — what are the differences, and are there more of these commands?

So, through typing several commands I've found that there's not only ls, but l and la too. There doesn't appear to be any man entries on Ubuntu 12.14. They all appear to do similar things with minor ...
2
votes
1answer
61 views

How to make an alias active in both current session and in .bashrc at same time?

I just found frequently I decide to add an alias for longer time use at the same time use it now. So I have to type the same thing twice, first in current bash session then .bashrc.
1
vote
2answers
271 views

HISTTIMEFORMAT modification. In /etc/bash.rc or /etc/profile? [duplicate]

I'd like to add the date/time to the output of the history command in CentOS/RHEL 6. I would like this to apply to all users on the machine by default. This itself is easy. It seems to just be a case ...
6
votes
3answers
506 views

How to tell if terminal session is running within screen

When running a bash script, I would like to be able to tell if it is running within a screen. Is this possible? I want this so that .bashrc can set the colour of the command prompt depending on ...
8
votes
2answers
168 views

using export in .bashrc

I have noticed in my .bashrc, that some lines have export in front, such as export HISTTIMEFORMAT="%b-%d %H:%M " ... export MYSQL_HISTFILE="/root/.mysql_history" whereas other have not, such as ...
1
vote
1answer
163 views

How do I track down the source of a ssh login message?

I installed mailutils on my linux machine with Linux Mint 15 (basically Ubuntu 13.04). When I log in, I get the following: Welcome to Linux Mint 15 Olivia (GNU/Linux 3.8.0-32-generic i686) Welcome ...
24
votes
3answers
483 views

Multicolored Grep

I'm trying to get each grep command to highlight it's results in a different color. I can do it manually with a line like this: ls -l GREP_COLORS='mt=01;32' grep c | GREP_COLORS='mt=01;31' grep o | ...
7
votes
2answers
116 views

How can I create a local function in my bashrc?

My .bashrc had some code that was repetitive so I used a function to simplify it do_stuff() { local version=$1 export FOO_${version}_X="17" export FOO_${version}_Y="42" } do_stuff '5.1' ...
8
votes
1answer
1k views

How can I change screen's hardstatus color based on the logged in user?

I haven't edited/created a .screenrc file in a while, but this is what I'm currently using: # Turn off the screen startup message startup_message off # Define format of bottom ...
5
votes
2answers
90 views

How to report time and other information on all bash commands? [duplicate]

Most of the things I run in the terminal take a long time to compute and I would like to have bash output a time report at the end of every command entered into the terminal. Is there something I can ...
1
vote
2answers
107 views

.bashrc execute command after “/bin/bash --login”

I have this alias in my .bashrc: alias s='cd ~/Documents/projects/s && /bin/bash --login && rvm use ruby-1.9' How can I execute the right part after it enters login shell (/bin/bash ...
2
votes
3answers
183 views

SSH parameter to ignore .bashrc script

I have a server which when it starts, a line in .bashrc executes the following command /bin/watch ~/checker.bash which as expected watches that command upon server start. I also have a client which ...
0
votes
1answer
31 views

Unexpected output after switch to root

Does somebody know, why I get -ne (probably param from echo from section of setting PROMPT_COMMAND line 23) after I switch to root? Here is my /etc/bashrc. Bash 3.2.51, OS X 10.9 ...
3
votes
1answer
85 views

Change the location of .bashrc

Is it possible to change the location of .bashrc from /home/orhanc/.bashrc to some other directory?
13
votes
2answers
6k views

What is the difference between ~/.profile, ~/.bashrc, ~/.bash_profile, ~/.gnomerc, /etc/bash_bashrc, /etc/screenrc …?

Answers to the questions on SO and askubuntu, along with poking through (and reading headers of) $HOME and /etc/, indicate a number of files that can be used to set environment variables, including: ...
1
vote
1answer
118 views

Can't get golang working on Fedora 19

I've installed the golang package on Fedora 19. Go also needs the the GOPATH variable. I added to my ~/.bashrc: GOPATH=$HOME/.go/ But go env didn't see it (after the source ~/.bashrc): ...
4
votes
2answers
212 views

How do I execute a command on login for a system user with no home folder and no personal .bashrc file?

I set these users' home folders through the /etc/passwd file, but when they log in I would like them to activate a python virtualenv. If they had a personal .bashrc file, I'd just include the activate ...
1
vote
1answer
203 views

Aliases in scripts are not set globally

I know this sound really wierd but this is exactly what happens. I have my .profile and .bashrc file set up in a way that the .bash_aliases file gets executed (checked it with a echo). I do not get ...
3
votes
2answers
218 views

Bash doesn't read .bashrc unless manually started

bash won't source .bashrc from an interactive terminal unless I manually run bash from a terminal: $ bash or manually source it: $ source ./.bashrc or running: $ st -e bash Here's some useful ...
0
votes
0answers
135 views

Emacs alternate editor client server start

How can I get Emacs to start in server mode with the alternate editor? From this conversation, I was able to enable the server with the alternate editor. However, I just re-installed emacs and I am ...
3
votes
4answers
297 views

Bash aliases/functions and command line options

I want to set an alias to start nedit together with command line option -noautosave (due to text files up to 500MB). What seemed to be easy: alias nn="nedit -noautosave $1 &" just raises some ...
3
votes
4answers
316 views

Why no shebang in .bashrc/.bash_profile?

Simple inquiry: I have just realized that I have never seen a shebang on top of a .bashrc script, which leads me to think the system uses the default shell to source it upon login (${SHELL}). I am ...
0
votes
2answers
133 views

scp from remote host fails due to login greeting set in .bashrc [duplicate]

My simple file scp from a remote host (actually a locally run VM but that shouldn't matter) failed without displaying any error message but clearly not having copied the desired file: scp ...
2
votes
3answers
132 views

sudo command after long sleep call without re-prompting sudo password

I'm trying to write a simple bash function that sleeps X-number of mins and then runs a system sleep command (for me it's sudo pm-suspend since I'm on Ubuntu) right now the function looks like this: ...
3
votes
2answers
111 views

How to make .bashrc call dependant on tmux program being installed?

I have a section in my .bashrc that fires up the tmux program (terminal multiplexor). However if the tmux program isn't installed (say I'm setting up a new computer) then having this in my .bashrc ...
3
votes
2answers
111 views

Preventing accidental directory deletion. Making an alias that contains options?

I use an alias to prevent me from accidentally deleting files, and I would like to do something similar for directories. For files, I have the following added to my .bashrc: alias rm="rm -i" I ...
0
votes
2answers
259 views

Redirect all stderr of a console and subsequent commands to a file [duplicate]

I know how to redirect stderr to a file or to the stdout when I issue a command: command 2 > log or command 2 > &1 or even command 2 > &1 > /dev/null. However, I want to redirect ...
3
votes
2answers
229 views

How can I use aliases in commands?

I have created aliases in my .bashrc for various frequently used long paths but I can not seem to be able to use them inside vim or with commands such as find or grep. E.g the following: db in cli ...