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

learn more… | top users | synonyms

1
vote
3answers
72 views

How long do the contents of the .bash_history file last?

How can I modify the contents of my bash_history file? What values or variables control how long the history lasts? Are there any other things I can change to provide finer control of my BASH ...
0
votes
0answers
33 views

Bash ignore “update” command

I have this in my .bashrc export HISTTIMEFORMAT="%Y/%m/%d - %H:%M:%S - " export HISTIGNORE="&:[ ]*:reload:update" export HISTCONTROL=ignoreboth:erasedups shopt -s autocd shopt -s cmdhist shopt ...
0
votes
2answers
26 views

making my UID work the same on all servers

I have a user id on 5 servers same user name. for one of the servers I have modified my .bashrc and added a bunch of new features to customize how my UID command line, etc work. What is the best way ...
0
votes
2answers
47 views

bash NOT reading .bashrc on RHEL 6

machine A --RHEL 7 and updated. machine B -- RHEL 6 and updated. If I do this on A (RHEL 7) ssh B I get in, like I should, but my .bashrc has NOT been run. This is new behavior to me. I want ...
0
votes
1answer
22 views

Debian Segmentation Fault

After editing .bashrc I had "Segmentation fault" as an error. This is what I added to bashrc: if [ -f ~/.bashrc ]; then source ~/.bashrc fi # If not running interactively, don't do anything [ -z ...
3
votes
1answer
28 views

Bash scripts ran from from gnome/nautilus don't have enviroment variables

In my ~/.bashrc and ~/.profile I have some variables set to some filepaths: export MY_VAR1="/path/to/somewhere" In my ~/bin/ (which is added to my PATH) I have a few scripts that rely on those ...
10
votes
2answers
900 views

Is it OK to use “.” to run files instead of source - in .bashrc in Ubuntu and OS X?

OK, so source runs the script in the current shell and . separately, as detailed in running script with ". " and with "source " for example, but, specifically, in my .bashrc file, ...
1
vote
0answers
88 views

Opening multiple tabs in gnome-terminal, having them automatically password-lessly ssh to servers and do so using alias from my bashrc file

I regularly have to ssh into four or so servers we run, at the same time. I have aliased these like. SERVER1=root@server1 alias sshserver1='ssh -t ${SERVER1} "bash -rcfile .my_bashrc"' # Above line ...
0
votes
2answers
50 views

How to get the ~/.bashrc to work in the native terminal application in Centos? [closed]

The problem I had was to get the .bashrc and .bash_profile and/or .profile scripts to execute by default when using the native Gnome terminal application. I found a number of references which told me ...
1
vote
1answer
123 views

Jenkins does not use system's locales

I got a interesting behavior in Jenkins. Jenkins' shell does not use my systems locales. Jenkins runs as user jenkins on my system. Logged in as jenkins via SSH: locale displayed: ...
1
vote
1answer
71 views

How to fix corrupted bash-completion in command substitution?

it seems my bash-completion got corrupted. Every time I try to use command substitution, for example when I type ls $(ls Deskto<Tab> ..result is.. ls $(ls Desktobash unexpected eof while ...
0
votes
1answer
81 views

Bash Script - Disable Wireless Connections

OS: Arch Linux Network Manager: Netctl I am trying to write a bash script that will disable all current network connections and turn off wifi on my system. I currently have the following, but after ...
0
votes
4answers
75 views

how to execute a bash script without typing ./ [duplicate]

It has been bugging me for a very long time and I'm really sick of it. For example there's a script called testscript that compares two directories. In class the prof can just type testscript dir1 ...
27
votes
3answers
11k 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: ...
4
votes
2answers
6k views

Where is the system profile that gets sourced at login on CentOS 5.8?

In CentOS release 5.8 (Final), where is the bash system profile? Is it /etc/profile ? I've added the following to source my ~/.bashrc file but haven't had any luck as it fails. I know it fails ...
3
votes
2answers
65 views

What's a smart way to use/maintain two separate bash_profile's and vimrc's

I have two different setups I like to use in terminal and vim. One uses a light background and a somewhat fancy airline statusline in vim. The other uses a dark background and a more barebones vim ...
0
votes
2answers
212 views

Non-interactive shell expand alias

I'm having trouble getting aliases to expand on my hosting account when I run a command like: ssh user@server "bash -c \"alias\"" My .bashrc file is: echo .bashrc # .bashrc shopt -s ...
1
vote
1answer
151 views

Reload .bashrc file for parent shell

I'm creating a script for managing my dotfiles and I want to source my ~/.bashrcfile automaticaly for the current bash. But I found that when in my script write : source ~/.bashrc it will source ...
0
votes
1answer
16 views

bash_completion does not work in dtach

I start dtach from bash using the following command dtach -c /tmp/dt0 bash the problem is, before I started dtach, bash_completion worked. But once I start dtach, bash_completion does not work ...
-1
votes
1answer
256 views

Connect via SSH with hostname instead of username and hostname

Whenever I have to login to a remote server, I have to enter ssh username@hostname and subsequently a password. I want to save time by omitting some parameters whenever I try to login to a server. I ...
2
votes
1answer
82 views

Match empty line in an alias .bashrc

I would like to bind my empty line in my bash to a specific command (for example pwd, ls, ...), like so : $<enter> $/home/ I tried // ~/.bashrc alias ="pwd" But obviously this was ...
1
vote
1answer
166 views

.bashrc and .bash_profile not executed [closed]

I'm running RHEL5. I added simple alias command into ~/.bashrc. When I start a new terminal, nothing happens but source ~/.bashrc works so I know the syntax is correct. I also ...
2
votes
3answers
245 views

bashrc in custom folder [duplicate]

I want to cleanup my home folder and have managed to move out most of the configuration files to the .config folder. But, one file I'm not able to figure out is the .bashrc file. How can I specify ...
2
votes
1answer
80 views

Bash: How to get different color for the command line and its output? [duplicate]

Basically, I am trying to edit my .bashrc such that when I type ls or whatever I type on the console, it will be displayed in Green color. At the same time, all the results / output displayed by ls or ...
1
vote
1answer
171 views

Sourcing bashrc file fails with ssh -t

ssh -vvv -F /home/me/.ssh/config serva -t "source ~/.bashrc" This is the output I get when I use -vvv flag: debug1: Authentication succeeded (publickey). debug1: channel 0: new ...
4
votes
4answers
523 views

disabling job control in bash (CTRL-Z)

It happens to me sometimes, that I press CTRL+Z by accident and my application disappears into background. I know, I can bring it back with fg, so it's not such a big deal. But I am wondering about ...
2
votes
3answers
54 views

bash: dynamic environment control

I have an application which modifies environment variables. The intent is to launch a bash shell with a modified context-specific environment. When my application modifies the environment, and ...
2
votes
3answers
303 views

Upstart - load bashrc variable

I'm wondering how to load bashrc variables in an upstart script and run (node.js in that case server). What is the best way to do it? I tried this: exec sudo -u someuser $NODE_PATH ...
2
votes
1answer
96 views

Including .bash_profile over ssh

I am trying to write a script that will: Copy files to a server (I already have a script copy.sh that does this task) ssh to that server cd to the directory where the files I just copied are run ...
1
vote
1answer
52 views

'script' session logging makes me exit twice

I'm using a solution described here to log my shell sessions, by adding this to the end of /etc/bash.bashrc: test "$(ps -ocommand= -p $PPID | awk '{print $1}')" == 'script' || (script -f ...
0
votes
2answers
43 views

Point program without garbaging up alias (~/.bashrc)

What is the correct way to point to a program/script without passing the command through aliases in the bashrc? For example: I create a custom script MyScript.sh. I wish to create a command that can ...
2
votes
1answer
77 views

Change the PS1 prompt in a subshell sh called from parent bash

When I am running an interactive bash session, I sometimes experiment with sh. I call sh directly from this bash session. My question is, how can I change the PS1 prompt of this subshell? I would ...
127
votes
4answers
218k 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 ...
7
votes
3answers
460 views

How can I have my .bashrc only invoke TMUX if it exists on my system?

I use tmux on most boxes, but not all. I have the following line in my .bashrc file: [ -z "$TMUX" ] && export TERM=xterm-256color && exec tmux which invoke tmux if it exists. I ...
16
votes
2answers
477 views

How to retrieve lost aliases?

Let me start by saying I know this was dumb. Time and Linux make fools of us all. I made an echo command to my .bash_aliases file and erased all of my aliases, except the test alias. However, I ...
5
votes
1answer
142 views

Linux: $SSH_CONNECTION is set even without SSHing to the server

I have a remote server and I am writing a script in the server and want it to fire only when I SSH. I thought of using the $SSH_CONNECTION and $SSH_TTY for this purpose. I found out that when I have ...
4
votes
1answer
198 views

PS: what does “ps -o comm= -p $PPID” do

I have a script which does ps -o comm= -p $PPID. The explanation says this gets the parent process name. From the man page I found out -o means user defined format, comm means command and -p means ...
3
votes
3answers
1k views

Messed up bash.bashrc file, commands not working anymore

Trying installing Java, I tried to add it to the executable path with the line: export PATH=/usr/lib/jvm/jdk1.7.0_60/bin:$PATH in the system-wide /etc/bash.bashrc file. For some reason this ...
2
votes
2answers
2k views

What is the purpose of .bashrc and how does it work?

I found the .bashrc file and I want to know the purpose/function of it. Also how and when is it used?
2
votes
2answers
56 views

How do I remove the new environment commands that were created by the virtualenvwrapper script?

I've installed and run virtuarenvwrapper.sh to try to configure an alternate version of python on my system. This script has placed somewhere a series of commands that are now executed whenever I ...
1
vote
2answers
78 views

How to find out the right String syntax for my bash?

I am getting an error message for this alias: alias ejectall='osascript -e 'tell application "Finder" to eject (every disk whose ejectable is true)'' And here is the error message: -bash: .bashrc: ...
0
votes
3answers
1k 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 ...
4
votes
4answers
2k views

execute bash script inside .bashrc

Hi I am curious if it is possible to execute a bash script inside bash rc. It would seem to create a infinite loop unless there was some way to tell it to not try and start a new shell. Here is an ...
0
votes
2answers
81 views

How can I shorten an if then else using the [] format

I want to shorten this to a one liner: if ls --version 2>/dev/null | grep -q 'coreutils'; then alias ls='ls --color=always' else alias ls='ls -G' fi I frequently use [] for conditionals, e.g. [ ...
1
vote
0answers
563 views

Make xterm transparent

I'm going through the process of making xterm transparent, I've followed the steps on this site. I installed transset-df and Xcompmgr and added this line to my .bashrc file [ -n "$XTERM_VERSION" ] ...
1
vote
1answer
631 views

Terminal, Prompt changed to “-Bash-4.2” and colors lost

Usually my terminal prompt was username place$ now it only shows bash-4.2$ and all the color settings have been lost (on the terminal profile I have the same color scheme, but it just don't show ...
3
votes
2answers
300 views

How can I use nested [] to replace a if-then-fi ? (“[: -f: binary operator expected”)

In my .bashrc file I have: if [ -f /etc/bash_completion ] && ! shopt -oq posix; then . /etc/bash_completion; fi I wanted to use [] around it instead of if then fi I already have [ -f ...
12
votes
4answers
3k 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
716 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 ...
13
votes
2answers
369 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 ...