Questions tagged [bashrc]

.bashrc is one of the scripts the Bash shell reads and executes when started as an interactive (but not login) shell.

Filter by
Sorted by
Tagged with
0
votes
0answers
14 views

Change settings switched between laptop as standalone vs docked

Ubuntu 18.04.2 Displaylink Lenovo Yoga 11 Trying to figure out how to write an alias that automatically sets a large monitor on my desk as the primary with proper zoom upon attachment and when woken ...
1
vote
0answers
39 views

Can't Run bash file inside ZSH

I've placed a bash file inside .zshrc and tried all different ways to run it every time I open a new terminal window or source .zshrc but no luck. FYI: it was working fine on .bashrc here is .zshrc ...
2
votes
0answers
39 views

Slow midnight commander startup

OS: Ubuntu 18.04. I'm midnight commander user. When i starts terminal and then type "mc", it starts immediately. But i don't want to type it every time i open terminal. So i added "mc" to end of ....
0
votes
1answer
19 views

What args should be used to make ls group file in such a way?

I'd like to list files grouped in such a sequence: ALL hidden files, directories, and the rest sorted by extension. So I made an alias in .bashrc like this: alias ll="LC_COLLATE=C ls -AlhF --sort=...
0
votes
2answers
39 views

Injecting sudo su with aliases

I'm wondering if there is a way to inject alias when you switch to root profile with sudo. What I have in mind is this: sshLogin@linuxVM /home/sshLoginUser/> sudo su -x "alias goHome='cd /home/...
0
votes
0answers
90 views

source ~/.bashrc or ~/.profile or ~/.bash_profile stalling terminal

Below I am displaying the structure of my files, some of the code in each, and what I do to try and get it all sourced and ready to do. STRUCTURE ~/ .bash_profile .bashrc .profile .bashrc #--...
0
votes
2answers
35 views

Is there a way to edit bashrc without loging into a user account

I have a probpem with Manjaro Linux. I worked with Android Studio and I added some lines to bashrc file. Now. Every time I try to login into that user it is stuck after I enter valid password. When I ...
3
votes
2answers
171 views

Configure .bashrc to save all commands and output

For a new project we are setting up a Linux box that will run several processes. To be better able to backtrack or rollback configurations we'd like to keep a persistent history of all commands ...
0
votes
0answers
161 views

Reload .bashrc by GNOME, not by terminal

I've changed $PATH in .bashrc and would like the Ubuntu command launcher (opened by Alt+F2) to search for commands in the updated $PATH. Is it possible to do without restarting the GUI session?
1
vote
1answer
21 views

ssh hostname cmd isn't loading .bashrc

So, I'm trying to run a command from a linux machine on my WSL desktop and the environment is all wrong and thus, the command won't run. I was under the impression that .bashrc would be loaded if it ...
0
votes
2answers
328 views

how to get bash and zsh setup correctly on macOS mojave

I'm running macOS (Mojave.) I'm wanting to make the switch from default bash to zsh/oh-my-zsh. Everything I install assumes I'm going to be editing my .bash_profile (or .bashrc.) I'm not 100% on how ...
0
votes
1answer
54 views

Use output text from a command as filename

curl http://v6.ipv6-test.com/api/myip.php returns me my current IPv6 addr. I'd like to use this string as part of a filename to be created, followed by timestamp of when the script ran. Any idea how ...
2
votes
1answer
223 views

How to show git status and conda environment in command prompt?

I am using the git-prompt.sh script to show the git status at the bash command prompt. Using the PROMPT_COMMAND method to also have colors: .bashrc : source ~/.bash.d/git-prompt.sh # Show git ...
0
votes
1answer
101 views

Customize Bash Prompt and apply the modification for all logged users

I have a linux with dynamic IP address. I would like to change the bash prompt according to the current IP. A python script is responsible for this connection and his launched at boot. os.system('...
0
votes
1answer
14 views

Print time after command has been entered

Is there a way to concatenate time after command has been entered? Example: user@machine$ date 11:50:41 Tue Jun 25 11:50:41 EEST 2019 Current workaround is to add \t\n to PS1 before the username but ...
0
votes
1answer
38 views

Shell prompt: \W shown as '\w', left puzzled

TL;DR: PS1 is not as it's supposed to be. PS1="\W" shows as \w█ the block being the blinking cursor. The folder name will appear only after directory change. OS is Debian 9.9 Stretch. I'm not quite ...
0
votes
1answer
71 views

Unable to use `read` command in .ssh/rc

I want to read input from keyboard when SSH connection established. So I edited .ssh/rc file and used read command, just like: #!/bin/sh read -p "input: " something echo $something But the output ...
0
votes
2answers
167 views

Two .bashrc files in my home dir

I'm using Ubuntu on Windows and I was attempting to modify my .bashrc file to add a directory to my PATH variable. I used redirection to do it like so: pwd >> ~/.bashrc Now I have two .bashrc ...
3
votes
3answers
356 views

Alias to source .bashrc after it's been edited?

I would like to add an alias (for convenience sake) that would allow me to edit my bashrc, and if changes were made, source it, but if no changes were made, don't source (in case I changed my mind). ...
0
votes
1answer
59 views

Correct syntax in a script to append to .bashrc for root

I'm trying to script some things and cannot figure out the correct syntax to append to root's .bashrc file. For this script, I'm just trying to get it to display the hostname in red when we ssh into ...
8
votes
1answer
1k views

Does .bashrc contain syntax errors?

In the Ubuntu 18.04 LT .bashrc file there is the following: # set a fancy prompt (non-color, unless we know we "want" color) case "$TERM" in xterm-color) color_prompt=yes;; esac Isn't xterm-...
0
votes
1answer
53 views

How to escape this command to add alias in .bashrc?

I want add alias command to .bashrc. the command like this : xev | awk -F'[ )]+' '/^KeyPress/ { a[NR+2] } NR in a { printf "%-3s %s\n", $5, $8 }' I am confused to escape character from that command. ...
0
votes
1answer
26 views

Setting and MSYS Home and abbrviating the directory in the prompt line

I run Msys specifically for running OMNETpp - a simulation library. I modified the mingw environment setup scripts in order to get it to start with my home directory, ~/, by setting up HOME. Example ...
0
votes
1answer
86 views

How do I make bash completion behave like this?

I’m not sure if what I’m asking is possible, but what I would like bash to do on tab presses is this: On the first tab press, expand a common prefix (skip/beep and do nothing, I don’t really mind, if ...
0
votes
1answer
29 views

How do I provide an environment to a script started like bash -c bla.sh

I noticed that e.g. ~/.bashrc is not sourced when starting a script with bash -c bla.sh. So how else can I provide environment variables? Preferably without explicitly setting them in the invocation.
0
votes
2answers
266 views

No value for $TERM and no -T specified Ubuntu LTS 18.04

I edited my .bashrc and .bash_profile files in the home directory for both the user and root. Everything works perfectly. About a week later, upon reboot I get this error, but everything still works ...
0
votes
1answer
40 views

Why file content is not remain after unmount a drive in linux?

I wrote a script on bashrc.cmd from my windows 10 to activate my virtual environment automatically. I pointed the path of bashrc.cmd into AutoRun according to this post. bashrc.cmd @echo off CD dev-...
0
votes
1answer
70 views

How to automatically add characters to the user input before command execution

I love reading on the terminal - it focuses my attention and lets me read twice the amount I used to read on browsers, etc. I wrote a script using alias for bash.bashrc that changes the working ...
0
votes
0answers
37 views

Execute `ls` whenever user does a `cd` on terminal [duplicate]

I know bashrc is executed on terminal startup. But my use case is something like this, To execute a specific command, say ls, whenever user executes another specific command, say cd, on the ...
0
votes
1answer
2k views

How to automatically close the ssh-agent along with closing Cygwin?

I am on Windows 10 Pro. I have added the following lines to my Cygwin (fully up-to-date) ~/.bashrc file: eval $(ssh-agent) > /dev/null ssh-add > /dev/null 2>&1 in order for me not to ...
3
votes
2answers
5k views

Bash on Ubuntu on Windows gives error “-bash: /home/user/.bashrc: Permission denied” on startup

So I was working with Bash on Unbuntu on Windows in order to learn Linux, so I attempted to edit the .bashrc file as a way of learning. To do this I went into the root folder in my C: drive and opened ...
1
vote
1answer
336 views

Ctrl D not exiting bash after sourcing bashrc

The bashrc was not written by me, and sources a lot of different configuration files. Upon sourcing it, I can't exit bash with Ctrl+D anymore. I found this related question about zsh, and I would ...
3
votes
0answers
202 views

Is there a way to enable fuzzy Bash auto-completion like Intellij has?

I use Intellij a lot, and one of the features I love is the auto-completion. Notice how you can skip letters in your input and it guesses what you want based on those letters: Is there a way to ...
0
votes
1answer
159 views

Bashrc unexpected EOF Error

I am pretty new to all this so apologies if i am asking an easy question.. I need to update my .bashrc file which is a hidden file in home directory. İ opened it using gedit and overwrite it with my ...
0
votes
1answer
1k views

How to bring bash history to default in CentOS 7

$ set -o | grep history history on $ echo $HISTFILE /root/.bash_history $ echo $HISTSIZE 1000 $ echo $HISTFILESIZE 1000 I ran following command and ...
0
votes
2answers
475 views

Linux: bashrc. How to load bashrc content from another file?

I occasionally have to re-install operating systems on the various linux machines which I manage. Every time I do this, I have to copy the .bashrc file to a USB drive before wiping the old system, and ...
2
votes
1answer
58 views

Automatically list contents of directory when changing to it

I am a huge fan of the ~/.bash_aliases file and I am trying to get the cd command to automatically list the contents of a directory when I change to it. In my .bash_aliases file, I put alias cd='cd $...
0
votes
1answer
216 views

Cygwin bashrc package install error

Cygwin was unable to install a package. Is anyone able to advise with the details below? Nisarg.Rajput ~ apt-cyg install bashrc --2018-01-01 11:42:57-- http://ftp.ntu.edu.tw/pub/cygwin//x86_64/...
3
votes
2answers
3k views

Activate virtualenv using alias

I can activate my python virtual environment from it's folder by entering . bin/activate. I'd like to instead type a single word alias, such as shazam, from the home folder (or anywhere else) that ...
2
votes
1answer
4k views

How to add all subfolders a folder to PYTHONPATH

All of my Python module sources are in the folder /src/*: /src/module1 /src/module2 ... /src/modules100 If I want to add all of these modules to my PYTHONPATH, I need to add them individually in ...
3
votes
1answer
66 views

Bash macro that does not let me “git push” after 3am

Alright, so basically I've managed to cause problems by pushing very late at night. How could I change git push (without forcefully changing git write-protected files) to need "Are you sure?" dialog ...
1
vote
1answer
3k views

How to edit a new .bashrc file in a Mac to set the python path?

I have been trying to open a new file .bashrc wit TextEdit on a Mac (which I am not used to work with). How to open such a new file and set the python path? I did a touch .bashrc and a /Applications/...
0
votes
1answer
360 views

What does bashrc PS1 check [ “$PS1” = “\\s-\\v\\\$ ” ] mean?

In bashrc file in Fedora/Red Hat I see following line: [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ " What is the check being done in [ "$PS1" = "\\s-\\v\\\$ " ] and why is PS1 set only ...
12
votes
3answers
4k views

`ssh <host>` is a login shell, but `ssh <host> <command>` is not?

I've noticed that when I run a command directly on an SSH host using the ssh <host> <command> syntax, I see the output of .bashrc but not the output of .bash_profile (or .profile). For ...
1
vote
1answer
2k views

.bashrc not automatically initalising?

When opening a new terminal, I need to do source ~/.bashrc or source ~./bash_profile before my $PATH variable is initalised. I thought .bashrc did this automatically? How do I make it so I don't need ...
1
vote
2answers
96 views

emacs-style partial directory path completion in bash

In emacs, when entering a file path, I can do something like: ~/c/s/h/npu2-o.c<TAB> and have it expand to ~/code/skiboot/hw/npu2-opencapi.c Is there any way to get similar path expansion in ...
1
vote
1answer
7k views

How can I add password of user as alias in bashrc file?

I have created alias for username and it works fine alias yb="ssh name@hostname" It works fine, but I also want to create alias for password, Can anyone help how can I do this?
19
votes
1answer
6k views

Bash is slow to start because of this line in .bashrc. What could cause this?

My .bashrc file contains a line to this effect: alias prog="/path/to/script.sh $(find $(pwd) -name prog)" When I comment out this line, Bash starts almost instantly when I open a new terminal. With ...
3
votes
1answer
2k views

Which bash rc files are run on non-interactive/non-login shells?

My Understanding there are no rc files called for non-interactive/non-login shells; for example, those run by cron (I don't know this for certain and would lean on the community's expertise) non-...
0
votes
1answer
391 views

How to check where my PATH is modified?

I have in my PATH a folder destination included which does not exist any more. Still I just can't find in which file is it set. I checked for .bashrc, .profile, .bash_profile does not exist. Is there ...