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

learn more… | top users | synonyms

2
votes
2answers
40 views

How can Bash determine if it is running due to an rsync over ssh?

I need my Bash init scripts to be able to distinguish between having been invoked like ssh me@host /some/complicated/operation, and having been invoked like rsync -e ssh /src me@host:/dest In the ...
2
votes
2answers
183 views

Bash: #: command not found

I just moved to Arch Linux with KDE a week ago. Everything worked well until I installed ibus-unikey and ibus-qt, after that, whenever I open konsole, this error appears: bash: #: command not found ...
2
votes
1answer
72 views

make sudoers use their own history file

I just can't seem to get a simple answer to this one. All I am trying to do is get a sudoers to use their own history file, but if I set the history var in the .bashrc for root with $user, the $user ...
2
votes
3answers
1k 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/ i-have-names-that-are-too-long-to-...
2
votes
3answers
108 views

Trying to understand .bashrc, env, and export

Disclaimer: Using bash. I just need some confirmation / correction on my understanding of these things: env is basically displaying the current environmental variables that are accessible to my ...
2
votes
2answers
143 views

Separate bashrc file for ssh sessions to avoid Unison Errors

Recently my Unison started throwing up some strange error whenever I tried to sync between my laptop and my PC. I realized that I had added a line in bashrc that would print my pending tasks whenever ...
2
votes
3answers
2k 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 ...
2
votes
1answer
929 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 ...
2
votes
2answers
492 views

How do I get ~/.bashrc to execute all scripts in my ~/Shell directory using a loop?

I have shell scripts in my ~/Shell directory that I want to be run whenever Bash is started up as my usual user account. So what I have done is added the following to ~/.bashrc: for i in `find ~/...
2
votes
1answer
711 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 ...
2
votes
2answers
217 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
2k 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
328 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
379 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
43 views

building code from source and adding them to your path

Typically on Debian when you install things from the repository, they just work. It sets up things just fine and life is good. This is great for things that are up to date in the repository. I am ...
2
votes
1answer
292 views

Extract hostnames from non-hashed ssh known_hosts

I would like to extract hostnames/ips from .ssh/known_hosts file in all (known) format conditions: Hostname only hostname pubkey Hostname with ip: hostname,1.1.1.1 pubkey Hostname with ip that is ...
2
votes
1answer
203 views

change terminal appearance according to server

I have 2 different serves (all running Linux) to which I connect via ssh . After login all terminal background looks same. I want to have different color theme or background for different servers. For ...
2
votes
1answer
76 views

bashrc behaviour differs when opening a session or opening a terminal

I'm using RHEL 6.6. I got a problem configuring my .bashrc file. I have a sudo su - dummy followed by an exit in it. When I open a terminal, the current user is changes to dummy. If I type exit, I go ...
2
votes
1answer
352 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 ...
2
votes
1answer
209 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
1answer
98 views

Bash autocompletion for an alias

This is in my .bashrc: alias p='sudo apt-get'; complete -F _apt_get p I've found the autocompletion only works if I've used autocompletion for apt-get at least once before trying to use it with the ...
2
votes
1answer
6k views

When I run “sudo su” I get --bash: command not found for everything

I'm not good with command lines or servers. But I needed to configure for work a AMI of EC2 AWS with LINUX So I've installed a lot of stuff, moved a lot of stuff around and then I realized that sudo ...
2
votes
1answer
734 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 ...
2
votes
1answer
3k 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 modified/source-...
2
votes
3answers
98 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 exec()...
2
votes
1answer
451 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 ...
2
votes
2answers
167 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
1answer
506 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 ...
2
votes
1answer
39 views

Can I use an environment variable to define an alias?

I'm using an automation engine to run perl scripts. script_X requires a wrapper script so it's run like: wrapper_script script_X --parameters But the automation engine can't understand that ...
2
votes
1answer
30 views

What controls the home directory in applications like Geeqie and Thunar?

I have a line in my .bashrc that cd's to a specific directory. For as long as I can remember, this only changed the directory in which terminal sessions began. But then at some point recently, GUI ...
2
votes
0answers
35 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 BIBlue='\e[1;...
2
votes
1answer
474 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 written to gather this information are too slow. I'd like to make ...
1
vote
4answers
15k views

Where is .bashrc file found in Linux?

I am not finding my .bash_login and .bash_profile root@linux:~# locate .bash* /etc/bash.bashrc /etc/skel/.bashrc /etc/skel/.bashrc.original /home/noroot/.bashrc /home/noroot/.bashrc.original /root/....
1
vote
3answers
131 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 ...
1
vote
5answers
54 views

remove an added path from PATH?

in my ~/.bashrc in Linux , I have a line that adds some paths to PATH, something like: PATH=~/mydoc:~/mypython:"$PATH" The purpose of adding ~/mypython is to use my self-installed python, rather ...
1
vote
2answers
505 views

.bashrc file syntax error near unexpected token `('

I have been using the following lines in my bashrc file for quite some time now and suddenly now I have an error. Here are the lines: make() { /usr/bin/make "$@" 2>&1 | sed -E -e "s/...
1
vote
1answer
187 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 "...
1
vote
2answers
314 views

bash - Why does type -a execute “$(printf 'a')” and is it possible to get back the original alias? [duplicate]

After i ask this question 2 days ago, i decided to make this alias in my ~/.bashrc: alias catvu="LC_ALL=C sed \"$(printf 's/[^\t -\176\200-\377]/^&/g')\"|LC_ALL=C tr '\0-\10\13-\37\177' '@-...
1
vote
1answer
552 views

How can I set a bash_logout for all users?

I've run into an issue trying to set up a little bit of ASCII art to display upon connection and on logout. I can do this for one user with .bashrc and with .bash_logout, and set a login MOTD by ...
1
vote
4answers
6k 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 ...
1
vote
2answers
162 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
2answers
1k 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 ...
1
vote
1answer
970 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
154 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
48 views

Debian : Setting path for Node with root accessible globally

I have downloaded NodeJS setup and have it inside at /home/deploy/nodejs. I am trying to set its path, but it's not working out. I am logged in as root, and I would like to access nodejs and npm ...
1
vote
1answer
187 views

Why doesn't my bash terminal recognize any command in the shell? [closed]

Upon the request of some users, I decided to add all the intermediate steps and results to my initial post so that users can better walk me through a solution. This is added under the headline ...
1
vote
1answer
39 views

A command that takes a single numeric argument and prints out the day of the week based on the formula

days=('Sunday''Monday') days=('Tuesday''Wednesday') days=('Thursday''Friday') days=('Saturday') for numbers in "S@"; do if [ $numbers -ge 0 ]; then result=$(($numbers ...
1
vote
1answer
99 views

How can I use debian_chroot in bashrc to identify the chroot env?

I see the following in ~/.bashrc : if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then debian_chroot=$(cat /etc/debian_chroot) fi which means if the variable is ...
1
vote
2answers
127 views

How do I make a BASH loop

I'm very new to bash and Linux and I was wondering how I could make a bash loop so that when it runs, it will ask you how many times to run, and it will run that many times. I did it in LUA but I ...
1
vote
2answers
23 views

Append a “finished” command after a specific command is used

I'm using Bash. I have a build command that I run a few times a day. I also have a command called "beep" that I use to alert me when a command finishes. So normally I do "build arg1 arg2; beep" and it'...