Tagged Questions

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

learn more… | top users | synonyms

1
vote
1answer
45 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
21 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
46 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
56 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 ...
2
votes
2answers
49 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
63 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
2answers
60 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
70 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
71 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
93 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
150 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
64 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
82 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
51 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
131 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
75 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
38 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
36 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
49 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
379 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
473 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
103 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
150 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
631 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
339 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
53 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
63 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
722 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?
9
votes
2answers
842 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
68 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
495 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
395 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
274 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
192 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
113 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
99 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
159 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
534 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
691 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, ...
3
votes
2answers
254 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 ...
0
votes
2answers
252 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 ...
2
votes
4answers
124 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
46 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
43 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
251 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 ...
0
votes
1answer
449 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
199 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
290 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 ...
7
votes
2answers
1k 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 ...