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.

109 questions
141
votes
39 answers

What useful things can one add to one's .bashrc?

Is there anything that you can't live without and will make my life SO much easier? Here are some that I use ('diskspace' & 'folders' are particularly handy). # some more ls aliases alias ll='ls -alh' alias la='ls -A' alias l='ls -CFlh' alias…
Gareth
  • 8,413
  • 13
  • 43
  • 44
103
votes
20 answers

Login without running bash_profile or bashrc

So let's say one typoed something in their .bashrc that prevents him (or her) from logging in via ssh (i.e. the ssh login exits because of the error in the file). Is there any way that person could login without executing it (or .bashrc since the…
Tom Ritter
  • 3,147
  • 5
  • 25
  • 30
81
votes
6 answers

Standard place for user defined bash_completion.d scripts?

I have user access (no root) into a Linux (Suse) machine where I developed some bash scripts and the corresponding bash autocompletion rules. Since the scripts belong only to my user and therefore I need the complete rules only "active" for me (a…
Carles Sala
  • 913
  • 1
  • 7
  • 6
60
votes
4 answers

Straight forward way to run ssh-agent and ssh-add on login via SSH?

I'm trying to have the following commands be auto-executed when I login to my server via ssh: ssh-agent /bin/bash ssh-add ~/.ssh/id_rsa My ssh key has a passphrase and I'm fine with entering it once per login. I tried putting this in my .bashrc…
Click Upvote
  • 795
  • 2
  • 7
  • 12
57
votes
1 answer

What is the difference between a 'Login' and an 'Interactive' bash shell

What is the difference between a ‘Login’ and an ‘Interactive’ bash shell? I have quoted Wikipedia below but can anybody give a better answer? EDIT: This is a community wiki so maybe rather than voting to close you could provide examples of which…
Gareth
  • 8,413
  • 13
  • 43
  • 44
31
votes
10 answers

I screwed up, exit in .bashrc

I put "exit" in my .bashrc file. I don't have physical access to the machine so to connect to it I use ssh. I don't have root privileges. Every time I connect to the server, the connection automatically closes. So far, I've tried: Overwriting…
camel_space
  • 453
  • 1
  • 4
  • 9
25
votes
6 answers

How to use a custom .bashrc file on SSH login

I've found that with the new company I'm working with I often have to access linux servers with relatively short lifetimes. On each of these servers I have an account, but whenever a new one is created, I have to go through the hassle of…
gsgx
  • 352
  • 1
  • 3
  • 6
23
votes
6 answers

Use .bashrc without breaking sftp

My problem is that I need to set a few variables, and output a few lines every time I login to the ssh shell, and at the same time I have to be able to use sftp to tarnsfer files via Filezilla. Now, as per the openssh FAQ at…
Joel G Mathew
  • 890
  • 1
  • 9
  • 18
11
votes
3 answers

.bashrc: shopt: not found

Just provisioned a new Rackspace instance with Ubuntu 12.04 and pulled down rbenv from their github and installed it. I'm getting the following errors when executing . ./~bashrc $ . ~/.bashrc sh: 18: /home/deployer/.bashrc: shopt: not found sh: 26:…
Chris
  • 213
  • 1
  • 2
  • 7
11
votes
4 answers

How can one set a terminal's title with the 'tput' command?

I discovered through this answer that I've been setting terminal colours in my prompt in a naive way for years. I've now modified my .bashrc to use 'tput' commands to colourise various elements of my prompt. The one remaining escape code I have is…
Murali Suriar
  • 10,166
  • 8
  • 40
  • 62
10
votes
4 answers

Why is my .bashrc not read under cygwin?

My .bashrc looks like this: alias name@server="ssh server sname" echo "bashrc read" The echo statement is just for checking if it is read. But the echo does nothing. I want to set an alias for a quicker ssh into a box doing a certain command which…
boutta
  • 231
  • 1
  • 3
  • 8
10
votes
6 answers

Prune duplicate entries from PATH variable

I modify my .bashrc frequently and then source it. However, when I have things like export PATH="~/bin:~/perl5/bin:$PATH" in my file, then the PATH environment variable grows every time I source the file. For example, the first time .bashrc is…
9
votes
5 answers

Where does the bash PATH on CentOS 7 get /usr/local/bin from?

I've just spun up a brand new CentOS 7 VM (bash version 4.2.46) with Vagrant using the centos/7 box, and when I'm logged in as the vagrant user, this is my…
Iain Hallam
  • 447
  • 2
  • 6
  • 21
9
votes
5 answers

How do I restore the default bashrc?

I have accidentally overwritten .bashrc. I did the following echo 'export EDITOR=/usr/bin/nano' >> /etc/bashrc Bur I accidentally typed > instead of >>. I guess, it was a bad idea. I am still able to log in by using this trick (hit Ctrl+C before the…
Nickolai Leschov
  • 457
  • 4
  • 8
  • 22
9
votes
1 answer

bash tab completion only works for root

I set up an Ubuntu 12 server (on rackspace cloud using their preconfigured image) and created a non-root user. When I log in as the standard user, pressing [TAB] at the terminal outputs an actual tab and pressing [UP] outputs ^[[A . If I log in as…
hackerhasid
  • 309
  • 1
  • 3
  • 9
1
2 3 4 5 6 7 8