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
3
votes
1 answer

Scripts in /etc/profile.d are being executed twice on login

Background Info: I am trying to configure a Linux server running CentOS 7 for multiple users. After installing java I want to globally set the $JAVA_HOME environment variable for all users and add it to the $PATH. To do this I went to the…
tjwrona1992
  • 131
  • 1
  • 4
3
votes
2 answers

Running a bash script from systemd as if I logged in

I have a service implemented as a Bash script. Inside it's actually a node.js application, but it could be anything for the purposes of this question. The basic use case is that we develop/debug the script in an interactive shell, then enable it as…
Jim B.
  • 131
  • 1
  • 1
  • 2
3
votes
1 answer

Can't use functions exported from .bashrc in a bash script

My .bashrc file exports a function called lookup: lookup() { grep -r -ne "$1" * | grep -v "TAGS:" | grep -v "tags:" } export -f lookup I can use that function in a shell. But if I put it in a script like this: #!/bin/bash lookup "foo" and run…
Jan Stolarek
  • 255
  • 1
  • 3
  • 8
3
votes
2 answers

Using Linux autocompletion with wordlist AND files of the current directory

I have set auto-completion in my .bashrc as follows: complete -W "$(echo `cat ~/.ssh_complete`;)" scp but this ONLY used the words given in the file ~/.ssh_complete. How is it possible to extend the definition so tab-completion on scp also uses…
Alex
  • 105
  • 1
  • 2
  • 12
3
votes
2 answers

Why is my .bashrc script executing out of order / not waiting for steps to complete?

I have the need for teachers to fill in electronic registers in remote areas, and they need to be able to do it fast and with the least fuss necessary. To accomplish this I have set up netbooks with a "vanilla" Debian 6 install with nothing on it…
3
votes
1 answer

What creates ~/.bashrc

I am setting up a ubuntu web server. Id like to customize everyones bash prompt a bit. (As in $PS1) Editing /etc/bash.bashrc doesn't seem to work, I assume cause ~/.bashrc over writes it. The question is, when a new user is made, what creates its…
The Digital Ninja
  • 764
  • 4
  • 10
  • 25
2
votes
2 answers

Displaying complete host name when login to linux

How can I display hostname along with user when I login to Linux machine? Now I can see only part of host name where I could not able to identify the server name. would like to display as below; For example: [centos@yourfullhostname]$ if changed to…
guru
  • 33
  • 3
2
votes
3 answers

Bash commands not found after syntax error

I'm running into an issue where running common bash commands (e.g. ls, mv, rsync, vi) on an Ubuntu 14.04.5 LTS results in something like this: bash: rsync: command not found. When I ssh in I get this error (before running any commands in the…
bjnsn
  • 121
  • 2
2
votes
2 answers

Convenient date/time stamping console interaction e.g. using shell aliases?

So, I often find that I really want to know when I started a process (or script) after I discovered that it was taking ages.. meaning I couldn't pre-pend date before and after it on the command line (without interrupting something I now know takes…
user73225
  • 31
  • 2
2
votes
1 answer

How to define envrionment variables accesisble by crontab's run and bash shell

I want to define environment variables in one place which will be accessible through different user's crontabs, and from bash shell running. How can I write it once in one place to be accessible to all usages mentioned above? Until now I'm writing…
user370717
  • 151
  • 1
  • 1
  • 4
2
votes
2 answers

printing user of subshell obtaining root via su -

Can I print the username which is obtaining root access via su - on the root console upon obtaining root? user1$ su - password: obtained root via user1 #
mahatmanich
  • 2,954
  • 3
  • 22
  • 23
2
votes
2 answers

Setting systemwide environment variables which are read when a shell is started

What's the preferred way to set environment variables for all users (on Ubuntu) such that the new variables are read whenever a new shell/terminal is started? Presently, we're using a file in /etc/profile.d/ but Changes aren't picked up when a…
user317715
2
votes
0 answers

EC2 - editing .bashrc causes terminal to hang and checks to fail

I've been testing this for the past few hours with no luck. When launching an Ubuntu 12.04 EC2 micro instance, I SSH to it, create a new user and continue with installing Ruby version manger under the new user $ curl -L get.rvm.io | bash -s…
2
votes
2 answers

Added line to bashrc, now bash is not responding

I added the following line to the end of my ~/.bashrc (This is on a Linode box) and logged out of my ssh session. source ~/.profile Now when I log in, the shell is unresponsive. I never get to the prompt and entering commands does nothing. If I…
duckyfuzz
  • 149
  • 1
  • 7
2
votes
1 answer

Bash Prompt Colors Ubuntu

I am attempting to use a simple shell script on a base Ubuntu 12.04 server install to set prompt colors for users system wide. I would like to have Puppet place the file color.sh in /etc/profile.d/ -- with permission 744 but the file isn't being…
sepulworld
  • 25
  • 8