Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [bashrc]

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

0
votes
1answer
32 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
29 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
34 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
0answers
33 views

Move back from zsh to bash and ignoring duplicates in history

I'm trying to move back from zsh to bash. There is a problem relating to bash_history. I want not duplicates inside my history. For that I have these in my .bashrc: # HIST* are bash-only variables, ...
0
votes
1answer
52 views

Move from zsh to bash and history substring search

I've been meaning to move back from zsh to bash. I want 2 things in my bash one of which is ignore case and I know how to do that. Another is history substring search in zsh provided by oh-my-zsh ...
0
votes
1answer
276 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 ...
0
votes
2answers
968 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
83 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 ...
1
vote
0answers
75 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
45 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
118 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
211 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
34 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
122 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/...
1
vote
2answers
491 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 ...
0
votes
1answer
1k 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
59 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
2k 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
212 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 ...
10
votes
3answers
2k 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 ...
0
votes
1answer
986 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
66 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 ...
0
votes
1answer
2k 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?
18
votes
1answer
4k 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
500 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
198 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 ...
0
votes
1answer
43 views

Turn off the touchpad every time I start linux

Im running a "bastard hodge-podge" Debian (sort of) linux based originally on pratham OS with quite a few things I had to build and install to get running Simply need to turn off the infernal ...
8
votes
2answers
570 views

Can I make bash stop parsing and validating a certain alias?

I'm using Fedora 25, and have added the following alias to my bash profile: alias releasenotes="dnf updateinfo --refresh info `dnf check-update | cut -d '.' -f 1 | xargs` | less" (I can't use ...
0
votes
1answer
84 views

How to change environment variable when user change?

I have portable terminal with bash shell on usb drive, and I want to load different environment variables every time I change computer, users are different on other machines. How to setup .bashrc file ...
-2
votes
2answers
592 views

.bash_profile: line 260: syntax error near unexpected token `('

I have bash function: WORKING_REACT_EXAMPLES="$HOME/tutorials/javascript/react/working-react-examples" dualpush() { cd $WORKING_REACT_EXAMPLES; cmpushall "$1"; cd ..; cmpushall $1; cd $...
0
votes
1answer
441 views

syntax error near unexpected token `(' bash

I am working on helpers to open my project when I get to work. I have so far: alias cdsloadmin="cd $SLO_ADMIN_SUITE_PATH; workon slo-admin-suite; atom $SLO_ADMIN_SUITE_PATH" runsloadmin() { ...
5
votes
2answers
12k views

Bash if on single line

I would like to know how can I write if conditions inside a bash script on a single line. For example, how can I write this on a single line, and then put another one just like it on the next? if [ -...
3
votes
2answers
1k views

SSH Login “clear screen” before MOTD is displayed

I'm trying to clear the screen contents before the MOTD is displayed so that when you SSH onto the server the MOTD header is at the top of your screen, not the previous commands ran on your local ...
0
votes
3answers
134 views

Enable confirmation for rm command 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 ...
0
votes
1answer
95 views

How can I alias a binary dependent on the machine I am on

I work on different machines, some as centos7, some are centos6, I build a binary tmux with a different version on each 'type' as the same version cannot runn both. How can I tell my .bashrc to ...
1
vote
2answers
85 views

bashrc substitute in Windows for making auto execution of CMD commands in each bootstrapping?

I want that each time I start the Windows CMD, a certain command will run. In Nix systems like Ubuntu or Centos, I would just add the desired command to /etc/bash.bashrc or /home/USERNAME/.bashrc ......
0
votes
1answer
45 views

How to complete an alias

I'm using git bash on my Windows and I've set up this alias: alias ccd='cd ~/PhpstormProjects' I can use it normally, but is there a way to make this command work? ccd /project1
1
vote
1answer
387 views

line 63: syntax error near unexpected token `;' in bashrc

I have bash function of: myworkhomebrewapp(){ atom $HOMEBREW_FRONTEND; atom $HOMEBREW_BACKEND; workon homebrew_server; cd $HOMEBREW_BACKEND; python manage.py runserver & ; /usr/bin/open -a "/...
1
vote
1answer
79 views

Logged in to “-bash”, not to “bash”. And what is the difference?

I logged in via ssh to a remote Ubuntu-Machine. By default I'm in a terminal called -bash (note the hyphen). This bash does not load/use my ~/.bashrc. When entering bash into the terminal, I get to ...
1
vote
3answers
132 views

Want to prevent accidental shutdowns, reboot, etc by aliasing commands such as shutdown

I am trying to alias commands such as shutdown, reboot, etc. I am aware that this is not a fool proof way to block access, however this is just to prevent accidental execution. I have looked at ...
1
vote
1answer
99 views

How to have bash write two bash history files without changing bash source code?

I want to have bash_history content duplicated in another file. Why? Because a malicious user can edit his own bash_history file. I know that that is not what bash_history is there for. So, is there a ...
2
votes
1answer
302 views

How to load Bash with .bash_profile from different folder

I have a shell script project where I want to load the .*rc from the project folder. In zsh I can achieve this by ZDOTDIR=$PWD zsh which will load the .zshrc from the current folder. How can I do ...
0
votes
1answer
383 views

Linux (basics) - How to use conditional on command in bashrc depending how terminal is spawned?

I am using Guake Terminal in Ubuntu. I have added the following line to my bashrc: guake -e "cd /home/jasoons/Documents/Termainal" -r launch This opens a tab called 'launch' in that directory ...
12
votes
4answers
3k views

Bash prompt to change color when I am logged into a server

Is there a way to make the bash prompt dynamic, so that it changes color when logged into a server? So I want the like the color to be green when on my system and change to red when connected to ...
2
votes
1answer
435 views

PYTHONPATH Getting set in Bash Shell to incorrect value

OS: macOS Sierra Beta 6 Python: 2.7 Shell: Fish I am having issues with my PYTHONPATH environmental variable being set correctly. In my fish_config file, I have this line setting up PYTHONPATH: set ...
0
votes
1answer
220 views

How to add alias to .bashrc via shell script?

I would like to append a command alias to a .bashrc file via script. However, I got confused when it comes to escaping it. The alias is simple: logtee() { tee -a "${SCENARIO_LOG_FOLDER:?'...
1
vote
1answer
610 views

Bash-Completion Does not work for Apt

I am running a minimal Debian installation that comes with practically nothing installed. I am trying to get bash auto-complete working. I have looked over all the questions on this subject in ...
0
votes
1answer
666 views

Not able to run fio bechmark as a root

I'm not able to run fio benchmark as a root user. Normal mode: Command 1: which fio Output 1: /usr/local/bin/fio Command 2: fio Output 2: No jobs(s) defined fio-2.12 fio [options] [job ...
0
votes
3answers
1k views

How do you re-source the environment variables in a command prompt in Windows?

In a bash shell, you can edit your environment variables, run source ./.bashrc and refresh the values of environment variables in an already open shell. Does Windows have a similar command that you ...
2
votes
3answers
2k views

How to execute command on urxvt startup

Urxvt doesn't support using an I bar as the cursor. One of the ways i've found to get around this is to send the command echo -n -e "\033[6 q". This works as long as I send the command every time I ...