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

learn more… | top users | synonyms

2
votes
1answer
218 views

How to make a permanent variable

In terminal: VAR="Extremely long and often used command" echo $VAR Output: Extremely long and often used command So far it works fine, but after restarting a terminal my variable doesn't ...
2
votes
2answers
198 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
3answers
247 views

What is the difference between ./script and . ./script? [duplicate]

Possible Duplicate: Using ‘.’ to execute files in bash I was trying to figure out how to export my environmental via script instead of changing my .bashrc file. I found this old useful ...
2
votes
2answers
4k 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 ...
2
votes
3answers
370 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 ...
2
votes
3answers
156 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: ...
2
votes
2answers
122 views

Is there any way I can fit this into my ~/.bashrc as a function?

I just discovered this useful bit of code on this useful-looking website. #!/bin/sh exec tclsh "$0" ${1+"$@"} proc main {} { set lines [lrange [split [read stdin] \n] 0 end-1] set count ...
2
votes
3answers
375 views

When the lines of a file or directory get too long, upgrade to ls list format?

Is there a way I can do this? For example if a gets a long name like: i-have-names-that-are-too-long-to-describe/ i-have-names-that-are-too-long-to-describe-2/ ...
2
votes
1answer
209 views

Alias in .bashrc doesn't seem to accept an argument [duplicate]

Possible Duplicate: In Bash, when to alias, when to script, and when to write a function? I'm trying to setup an alias in my .bashrc file, but it's not working as expected. I have this ...
2
votes
2answers
41 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 ...
2
votes
4answers
90 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 ...
2
votes
1answer
84 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.
2
votes
2answers
90 views

Color PS1 based on previous command output [duplicate]

I have my current PS1 as follows. The $? output is really useful (second line). export PS1="\ ${PSOn_Blue}${PSBWhite}\t\ ${PSColor_Off} \$?\ ${PSColor_Off}${PSBGreen} \u\ ${PSColor_Off}${PSWhite}@\ ...
2
votes
1answer
2k views

How to colorize “root” in red in CentOS?

This is the content of /etc/bashrc, I would like to modify it for show "root" as red but don't know where to add the color code. # /etc/bashrc # System wide functions and aliases # Environment stuff ...
2
votes
2answers
709 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 ...
2
votes
1answer
120 views

How to link different (incompatible) libraries at runtime depending on program?

I have a number of legacy codes that need to be compiled with specific (and often conflicting) libraries. To be specific I have a program which can only be compiled with g77 and another program which ...
2
votes
2answers
77 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 ...
2
votes
0answers
288 views

.bashrc alias not working [closed]

I have set up a few aliases in my .bashrc file, like the following: alias ras='rails server' alias res='redis-server' alias rc='rails console' alias be='bundle exec' # git alias's are as follows ...
2
votes
0answers
296 views

Populate PS1 asynchronously

I have a few git svn related functions that see if I have to pull/push from/to the repository. My problem is that the functions I've wrote to gather these informations are too slow, I'd like to make ...
1
vote
3answers
137 views

In bash, how can I erase an alias without logout? [duplicate]

I had an alias in my .bashrc and I really don't want it anymore. I erased the alias, but my bash already has this alias loaded. Can I erase this alias from this bash without logging out?
1
vote
1answer
2k views

.bashrc doesn't get executed

I have a user (non-root) which has a ~/.bashrc file with some aliases in it. But it doesn't look like the file is executed at log in time. If I do source ~/.bashrc then it does what it's supposed to. ...
1
vote
2answers
37 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: ...
1
vote
1answer
318 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 ...
1
vote
1answer
300 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 ...
1
vote
1answer
129 views

What's the right way to reuse this one-liner?

I recently came up with the following one-liner: for f in *.mp3; do sha1sum $f | sed -r 's/[a-z]//g' | cut -c1-2 | awk '{ print ($1 >= 255) ? $1 - $1 + (1/3)*$1 : $1 }' | xargs -i id3v2 -T {} $f; ...
1
vote
1answer
173 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): ...
1
vote
2answers
142 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 ...
1
vote
2answers
187 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 ...
1
vote
1answer
3k 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 ...
1
vote
0answers
140 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
122 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 ...
1
vote
2answers
311 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 ...
1
vote
0answers
30 views

why bash history overlap the prompt when scroll up in the history? [duplicate]

I customized my bash prompt, PS1 value. ~/.bashrc: Color_Off='\e[0m' # Text Reset BGreen='\e[1;32m' # Green BPurple='\e[1;35m' # Purple BWhite='\e[1;37m' # White ...
1
vote
0answers
365 views

How to use history commands with readonly PROMPT_COMMAND?

I'm sometimes logged in on a host which I do not control and where PROMPT_COMMAND is readonly. Is there some way to work around this to run history commands anyway, for example using PS1? I've tried ...
0
votes
2answers
2k views

How to assign user root rights?

I have Suse Linux on my desktop. So I am root and "normal" user. Frequently e.g. to start tomcat or install/remove a program I should use sudo or switch to super user. But I have defined many aliases ...
0
votes
3answers
89 views

I need to turn a series of commands piped together into an alias in .bashrc

sudo ifconfig wlan0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}' The above command when run from terminal outputs the right "internal" ip address. When I try to pass as alias like: alias ...
0
votes
2answers
439 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 ...
0
votes
1answer
100 views

Is it possible to change shell using bashrc when assigned a nologin default shell?

i have assigned a /sbin/nologin shell to a user while creating that user (specifying -s option in useradd), if this user logs in using SFTP and changes his .bashrc file, will he be able to change his ...
0
votes
2answers
51 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. [ ...
0
votes
2answers
120 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 ...
0
votes
2answers
138 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 ...
0
votes
1answer
39 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, ...
0
votes
1answer
498 views

Login script for bash not loading

I am very confused about the login script for bash. I have always used ~/.bash_profile to configure my bash shell. Now I am on a new system just as a user: I am not root. This system was originally ...
0
votes
3answers
108 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 ...
0
votes
1answer
215 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
1answer
464 views

Bash script for Angstrom

I have written a bash script to automate cross-compiling an OpenCV program: echo "Compiling started for: $1" if [[ $1 == *.c ]] then gcc -ggdb `pkg-config --cflags opencv` -o `basename $1 .c` $1 ...
0
votes
1answer
219 views

Fedora 7 server export in .bashrc not getting set [duplicate]

I'm trying to set the JAVA_HOME environment variable in my .bashrc but every time I log back in it gets unset again to its original value, below is my .bashrc file # .bashrc # User specific aliases ...
0
votes
1answer
102 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 ...
0
votes
1answer
34 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 ...
0
votes
0answers
173 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 ...