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

learn more… | top users | synonyms

1
vote
1answer
62 views

Alias for perl script

So far while surfing web I've discovered nice addition to my gpg password generator and I've decided to adjust my alias with these commands. Here is the code gpg --gen-random 1 20 | perl -ne'print ...
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
27 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
49 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
29 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 ...
1
vote
0answers
90 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
128 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
77 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
83 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 ...
1
vote
3answers
74 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
4answers
76 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 ...
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 ...
1
vote
1answer
153 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 ...
1
vote
2answers
222 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 ...
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
266 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
83 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
167 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
249 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
173 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 ...
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
311 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
97 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
53 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
78 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 ...
7
votes
3answers
461 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
144 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
199 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 ...
4
votes
4answers
531 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
2answers
59 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
79 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: ...
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?
10
votes
2answers
902 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, ...
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
568 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
637 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
302 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 ...
0
votes
1answer
233 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
126 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 ...
2
votes
2answers
105 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 ...
6
votes
1answer
189 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
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 ...
3
votes
1answer
787 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, ...
4
votes
2answers
361 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 ...