Questions tagged [bashrc]

The Bashrc file is used by the Bourne Again Shell in Unix/Linux to set environment variables and run commands.

It is most often run when logging into a command-line shell or running 'su' to switch to another user. It use to set environment when user logged in.

114 questions
2
votes
2 answers

.bashrc and .ssh/ disappearing seemingly at random

I have a server that has been running Fedora 16 ( 3.1.0-7.fc16.x86_64 ) for about a month now. I only log in every few days or weeks, but when I do, sometimes files are missing from my home directory. I don't keep any documents or whatever in there,…
kaz
  • 141
  • 3
2
votes
1 answer

Bash Function to Export .bashrc to a Remote Server

I am trying to write a bash function shown below. I am trying to scp my .bashrc to the target machine. I want to do modify the following function in the below two ways. I want to enter the password only once. Can I cache the password entered for…
liv2hak
  • 303
  • 4
  • 13
  • 25
2
votes
2 answers

Solarized Colour Theme in .bashrc

I am looking to see if there is a way to implement the solarized them through just a .bashrc file. Would it be possible to do so? Has anyone tried this before? I guess I would start by modifying something similar to this: …
Ross
  • 153
  • 1
  • 1
  • 7
2
votes
2 answers

How do you run "source" when starting a shell?

In order to use rvm (https://rvm.beginrescueend.com/), I need to run source ~/.bash_profile each time when I start a new shell. How do I automatically do this when I start my computer, rather than having to type it each time? This is my…
larry
  • 4,037
  • 9
  • 36
  • 42
2
votes
4 answers

GNU Screen and .bashrc

I am trying to launch GNU Screen using my .bashrc. I'm almost there: if [ -z "$STY" ]; then exec screen -dR else exec gnome-terminal fi This is wrong though! The first case works, screen launches when I open a terminal. But the second part…
devin
  • 1,246
  • 3
  • 20
  • 27
2
votes
1 answer

sourcing environment variable in bashrc: directly vs export from file yields different result - why

I am running systemd via user (i.e. enable-linger $USER) and I interact with services via systemctl --user I noticed a strange issue. Sourcing Type 1 In order for the above systemd to work for a user, I need to add export…
Newskooler
  • 211
  • 1
  • 3
  • 14
2
votes
0 answers

How to auto init direnv on Google Cloud Shell?

my .bashrc has these lines at the bottom: if [ -f $HOME/tools/bashrc ]; then source $HOME/tools/bashrc fi and $HOME/tools/bashrc has this code at the bottom: eval "$(pyenv init -)" pyenv virtualenvwrapper_lazy eval "$(direnv hook…
1
vote
0 answers

How to tell screen use use different bash_profile?

How can I tell to screen to use different bash_profile? Problem is we use a technical user to log in, but I edited a custom PS1. Normally I login with putty like: ssh user@host -t "bash --rcfile ~/.profile.custom -i" But screen use the default…
1
vote
1 answer

How can I apply "shopt -s extdebug" to my shell by default?

I am trying to build a pre-exec checker in bash (using bash-preexec.sh) In order to fail the command when the pre-exec hook fails, I need to run shopt -s extdebug (which fails the command when trap DEBUG command returns non-zero RC). If I run shopt…
DVK
  • 151
  • 8
1
vote
0 answers

Linux environment variable setting issue in cluster from single point

I have a cluster of few machines. I have to control all configuration from single system. For that I have decided to used .bashrc in Centos 7 servers (I push same .bashrc in each system via rsync from single machine). I am facing one problem, every…
1
vote
1 answer

Logout user if they break a bashrc command

I'm running a small script when a user accesses my Linux host via SSH. This script should verify and/or set up Google Authenticator MFA access for the user. Right now it works as intended with one caveat - at any moment during the MFA configuration…
Joum
  • 151
  • 1
  • 8
1
vote
2 answers

'source .bash_profile' fails but 'source path/to/.bash_profile' works

I am trying to source my .bashrc file on remote host inside sudo-less user. I am getting following responses. sh-4.2$ source .bash_profile sh-4.2$ source: .bash_profile: file not found sh-4.2$ source ~/.bash_profile [user@hera ~]$ Why is this…
v78
  • 113
  • 6
1
vote
0 answers

Why my profile looks for /usr/local/etc/profile.global (NIS)

My Ubuntu ID is manged by NIS/yellowpage. For some reason, when I log in, I'm getting this message. cat@local:~$ ssh catserver cat@catserver's password: Welcome to Ubuntu 15.10 (GNU/Linux 4.2.0-25-generic x86_64) Last login: Thu Apr 21 11:46:22…
Nullptr
  • 111
  • 1
1
vote
3 answers

Best Practice to obscure path to keypair in bash_profile?

I have dotfiles saved in a public github repo, which include the path to my aws keys, which seems like a terrible thing waiting to happen. So it's like this: function superssh { ssh user@something -i /file/path/to/keys;} What's a better way of…
John
  • 119
  • 3
1
vote
2 answers

User created with useradd instead of adduser loads a wrong Prompt

I've designed my bash prompt like this \u@\h> When i now create the User example with adduser, my prompt looks like example@host> But when i create a User with useradd, my prompt looks like \u@\h> PS1: \[\e]0;\u@\h:…
Leon Mydla
  • 31
  • 5