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
1
vote
2 answers

change root's .bashrc on a list of hosts

I need a way to log into a list of hostname/IPs as a user, su to root and then create/append root's .bashrc root doesn't have permission to ssh directly into the server
jag7720
  • 41
  • 2
1
vote
3 answers

Where do I put the Alias?

alias py='python' Do I put that in my .bashrc?
Alex
  • 8,471
  • 26
  • 75
  • 99
1
vote
1 answer

Why is my bash script not being sourced when opening new tmux pane?

The following logic in .bash_aliases to remove duplicate paths works fine when opening a new terminal: # prune duplicate paths PATHS=("PATH" "LD_LIBRARY_PATH" "C_INCLUDE_PATH") for P in "${PATHS[@]}"; do source $HOME/bin/prune_paths…
Jeff_V
  • 21
  • 2
1
vote
1 answer

Starting Directory for Bash

I've a Docker container running. I connect to the container using a command like: docker exec -it container_name bash This logs in as root at /var/www/html. I want to know why this directory, and how I would go about changing it. This is actually a…
Marshall Davis
  • 143
  • 1
  • 6
1
vote
3 answers

Saving the date to actual bash history file

When adding "HISTTIMEFORMAT" to bashrc, the timestamps of when a command was executed are made available when running the "history" command. But the timestamps themselves are not saved to the bash_history file (atleast not in plain text). I am…
OB7DEV
  • 125
  • 8
1
vote
3 answers

Ubuntu 20.04: su command bash-autocomplete stopped working

I am using Ubuntu 20.04. The su autocomplete stopped working. For example when I type: su TabTab It lists the files and directories of the current directory, where as it should list the available users. Bash auto-complete for other commands is…
1
vote
1 answer

Global Bash Completion Scripts

I have a Bash completion script. Is there a place I can put it on my system, so that it will be automatically source-ed for any user that uses a Bash shell? I would prefer a solution that does not require me to edit a configuration file in each…
user564147
0
votes
5 answers

bashrc problem on redhat linux

I am trying to add JAVA_HOME and an updated PATH to my .bashrc file on Redhat Enterprise Linux. My .bashrc file has only these two lines, but I get the error " : command not found " #user specific environment and startup programs export…
rich johnson
0
votes
2 answers

How to rename system commands e.g., shutdown in Ubuntu Linux

While working on redis server, I come to know there is an option to rename you scracy command to avoid accidental update. Is there any option for bash i.e., Ubuntu Linux especially shutdown, rm and reboot commands. While Googleing, I have found some…
0
votes
1 answer

Source bash.rc / aliasses from external file (LEMP)

I'm running several LEMP VMs with mostly identical setups. Each of these VMs has a /etc/profile.d/00-aliases.sh containing a bunch of aliasses and functions to run on the server. Now, whenever I make a change to those aliasses/functions I have to…
Asitis
  • 97
  • 8
0
votes
2 answers

How to export a file to another user's bash while logging in via SSH (using Putty) to RHEL?

I am running RHEL 7.3, however the procedure may be similar on other Linux systems. I have logged in as root. I have a file called openrc which is full of lines like export OS_IDENTITY_API_VERSION=3. I'd like to move this file somewhere so it gets…
Zac
  • 101
  • 2
0
votes
3 answers

Enable confirmation for commands with force flag

Is there any option to enable confirmation for the rm -rf . We had an alias setup for rm=rm -i so whenever we delete a file it asks for confirmation but when -f flag is supplied it will not asks for confirmation. So is there any option to ask…
Geo
  • 575
  • 3
  • 9
  • 23
0
votes
3 answers

RBASH how to prevent users exiting to normal bash?

I have set up some test account to beta implement rbash to limit users from doing to much on the server. Currently I am using .bash_profile to set bash -r for these profiles. But when a user types exit they drop into the normal bash shell. I…
0
votes
0 answers

Sudoers, allow user to use root alias

Actually, my root have to aliases: alias unpool='/path/to/my/scripts/unpool.sh' alias pool='/path/to/my/scripts/pool.sh' I have the same for my user in ~/.bashrc I defined my /etc/sudoers.d/user with user ALL=(root) NOPASSWD: /bin/cp user…
Bouffe
  • 283
  • 1
  • 3
  • 10
0
votes
1 answer

Bashrc function called ssh doesn't work

I created a function in my bashrc file so that when i ssh into something it automatically opens a tmux session. function ssht () { /usr/bin/ssh $@ -t 'tmux a || tmux || /bin/bash' } This works great, but i don't want to use ssht, i want to…
cwiggs
  • 69
  • 1
  • 4