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 the primary configuration file for the bash shell.

2
votes
2answers
102 views

Set last command exit code to bash prompt

I am running Ubuntu 18.04, and I would like to set my bash prompt so it reads like below: user:~/Documents [14:22:07] 1 $ My PS1 is as follows: ALERT_COLOR="$(tput setaf 1)" # Display unsuccessful ...
0
votes
1answer
17 views

Matlab application command alias creation error in Ubuntu 18.04

I had installed MATLAB 2017b in my Ubuntu 18.04 PC and am able to execute it as : sudo /usr/local/MATLAB/R2017b/bin/matlab -desktop I intend to install another version sometime in the future as well....
0
votes
0answers
10 views

Exporting Ruby Gems to $PATH

I am trying to run some ruby gems from my terminal, but I am getting the following error: You don't have /Users/developer/.gem/ruby/2.3.0/bin in your PATH, gem executables will not run. I added ...
0
votes
2answers
39 views

To create an alias for grep and to exclude svn directory

To create an alias for grep and to exclude svn directory (currently no questions cover this) on bash env I did: $ function gp {grep -rnIi --exclude-dir='.svn';} However, I get error bash: syntax ...
1
vote
2answers
24 views

How can I customize $PROMPT_COMMAND without overwriting the default (if present)?

Mac's Terminal comes with a default PROMPT_COMMAND that checks the history and updates the current working directory (title of the tab): Add echo $PROMPT_COMMAND to the top of your .bash_profile and ...
0
votes
0answers
13 views

Redirecting /var/log/appname to a more accessible location

I have a dev server at work that's decently locked down. However, the application mean to be debugged here only logs to /var/log/appname/[objecttarget]. The object target can change regularly, so I ...
0
votes
2answers
35 views

Setting an alias when double quotes and single quotes both fail

This question is not a duplicate of Why alias behave different than running bash command directly? because I have tried that solution and it hasn't worked. I replaced all my single quotes with double ...
0
votes
0answers
7 views

Export vars env to tmux's window/session/pane's env

Is there any way to export/upgrade list of variable env from a file or something to tmux's window/session/pane? Here I have to manually source .bashrc to update new var env to each tmux's pane.
0
votes
3answers
50 views

My MacOSX terminal doesn't show the current directory

No matter what directory I enter, the terminal always shows me the root directory which is "Nidas-MBP" Nidas-MBP% cd Projects Nidas-MBP% ls 09-Selector-Exercise-Starter.zip My Little Form ...
1
vote
1answer
27 views

Conditional env proxy?

I have the following proxy info in my bash_profile: export http_proxy=http://work.proxy.address.com:8080 export https_proxy=$http_proxy export no_proxy="localhost,.workURL.com" This allows me to run ...
1
vote
2answers
51 views

what might be defining the $PATH variable? [duplicate]

I'm currently exploring and experimenting with my linux just for fun and educational purposes. I have deleted the content of the /etc/bash.bashrc and /etc/profile and I don't have any configuration ...
10
votes
4answers
1k views

Purpose of [ -n “$PS1” ] in bashrc

What purpose does the [ -n "$PS1" ] in [ -n "$PS1" ] && source ~/.bash_profile; serve? This line is included in a .bashrc of a dotfiles repo.
0
votes
1answer
15 views

Multi-line commands are messed up in my PS1

declare __host='\[\e[30;102m\] \h \[\e[0m\]'; declare __dir='\[\e[1;97;44m\] \w \[\e[22m\]'; declare __arrow='\[\e[1m\]▸ \[\e[0m\]'; function __git_status() { local info; info=$(__git_info) &&...
1
vote
3answers
48 views

How to tell what method was used to log in (Password vs. Keyfile) from the bashrc

Is there a way how you can check what auth method the user which just logged in to an account were using? I like to print out a warning after login if someone is using a password instead of a keyfile....
0
votes
1answer
48 views

/etc/bashrc overrides my settings in home .bashrc

i have the following code for my prompt in .bashrc in home dir: PS1_TIME='\033[01;31m\]\t \033[01;32m\]' PS1_USERNAME='\[\e[1;36m\]\u\e[1;37m\]@\e[1;32m\]\h\[\033[00m\]' PS1_LOCATION='\[\033[01;34m\]\...
0
votes
1answer
33 views

Shell Script To CD and Run a Python Script

OK, I know that there is a lot like this question but I literally get nothing. The thing i need is a script that cd's to /home/project then runs python3 pyscript.py I created an alias to cd alias name=...
4
votes
2answers
971 views

Making alias of rm command [duplicate]

Making alias of rm command so that when rm command is executed it will first copy file to /tmp/recycle_bin and then remove the file. But I'm getting issue in the process. Need help from experts as I'm ...
0
votes
2answers
42 views

.bashrc is causing git push to fail

I'm trying to push code using git to my remote server, but I get the error: fatal: protocol error: bad line length character: 8 I researched this bug and it turns out my .bashrc file that echos ...
2
votes
0answers
42 views

xmodmap key bindings reset when I open a new tab in the shell

When I open a shell in ranger with shift-s, open vim and then open a shell with :sh or open a new shell tab with ctrl-shift-t, my xmodmap keybindings (swapped caps lock and escape keys) are reset. ...
0
votes
0answers
25 views

Directory Not Accessible As User Sudoing [duplicate]

I'm not entirely sure I follow what is going on here. I've written a function to pull real traffic to my site and placed that function in /etc/bashrc file: traffic() { sudo zgrep " $1" /var/log/httpd/...
2
votes
1answer
153 views

How evil is this: echo bash >> .bashrc

I was thinking of playing a prank on someone by running one of the following commands: echo bash >> .bashrc or echo source .bashrc >> .bashrc If someone did this to you, what could you ...
1
vote
1answer
56 views

creating alias in bashrc in wsl [duplicate]

I'm trying to create alias for for cd command to AppData and %programdata% folders but I got path not found while if I write manual it works, here is what I'm doing: In .bashrc I do alias client= '...
0
votes
2answers
39 views

Executing remote command just before remote server terminates connection

So I have searched for this but I didn't find anything which addresses this. I frequently connect to a remote server through ssh on which I don't have sudo permissions. Let's say the connection gets ...
0
votes
0answers
102 views

How to set environment variables to path so it can be read from GUI and command line from the same program?

I installed texlive and I want to add it as an environment variable to my Path so that Emacs AucTeX can read it when I start emacs from the GUI or from the command line. So far I've read that emacs ...
0
votes
2answers
213 views

Refresh .profile and .bashrc

I've split up my .profile and .bashrc files like so based on various advice I've read. I have an alias bin which I use to refresh my environment after changing .profile and .bashrc to avoid exiting ...
2
votes
1answer
45 views

bashrc not activated

I have installed the Anaconda data science package on my Ubuntu 16.04 server. To make it work (I think this means adding Anaconda to the path), I must enter, every time after I log in to the server ...
1
vote
0answers
20 views

Display not working for any user except root on tool vnc for Os Suselinux

I was trying to install SAP Hana Data provisioning agent for which SAP Note said that we need a non-root user who should have read/write access to /usr/sap folder and display access. So I started ...
1
vote
0answers
41 views

How to run vim with a color file from an uncommon place?

I try to make a bash alias like this : alias vi='vim -u /path/to/conf/.vimrc' It works well, but if I add the color file, it failed : vim -u /path/to/conf/.vimrc -S /path/to/conf/colors/foobar.vim :...
1
vote
2answers
277 views

Date & Time loop in bash

I am trying to download the yesterday logs through an external API, For API I need to provide a date range from & to as input parameters. From API I can download 1 hour log max for each call. ...
1
vote
2answers
36 views

How do I make a working emacs alias function?

In an attempt to go around an annoying aspect of tmux, I have the following code in my .bashrc file: alias emcs="command emacs" # Fix emacs in tmux emacs () { if [ $TERM != "xterm" ] then ...
0
votes
0answers
16 views

Refresh command output in alias [duplicate]

When I set in .bashrc something like: alias="docker stop $(docker ps -aq)" or alias="echo $(ls -l ~)" obviously never refreshes the command output in $(), so is an string... So, my question is, ...
0
votes
2answers
97 views

Can you make the `dd` command safe?

We all have (or know someone who has) unintentionally misused the destroy-disk (dd) command. What ways exist (if any) to change the command in the following or a similar way: If /dev/sda is given as ...
-1
votes
1answer
118 views

Debian 9.4— .profile not read on bash login

The .profile file includes a statement to add the $HOME/bin directory to the PATH (if that bin directory exists). This is not being executed on my bash login. If I manually load the .profile file . ...
1
vote
1answer
50 views

“Cloud” Alias File

I quite frequently will nano ~/.bashrc and add small little alias here and there on one of my boxes. The issue being, often I'll go to use this alias on another one of my PCs and it not be found. I ...
3
votes
2answers
685 views

/etc/profile not sourced for users

In the ubuntu server I run, I added customisations in /etc/bash.bashrc and as .sh files in /etc/profile.d, to add some useful aliases and functionalities for my users. All of them run correctly for my ...
1
vote
1answer
80 views

Set the environment variable in bashrc for preferred PDF viewer

I am currently remoted into my linux workstation's command line environment (bash shell) using SSH with X11 forwarding enabled. I am using the mendeley citation manager's desktop application to ...
0
votes
1answer
45 views

Is there a way to bind a key to a control-sequence in bash?

In my .bashrc file I'm trying to bind a custom escape-sequence key to a control-sequence. What I have is: bind -x '"\eJD0C": "^C"' And it does not execute the shell control-sequence ^C which ...
0
votes
1answer
66 views

How to avoid creating an infinite loop when calling bash inside of bashrc with BASH_ENV set?

Inside of ~/.bashrc, I run a bash script (a script with #!/usr/bin/env bash at the top). I have found that when BASH_ENV is set to my ~/.bashrc that this sets up an infinite loop when a bash command ...
0
votes
0answers
178 views

CentOS 7 XFCE Desktop does not run executable programs

I have a Qt application that I want to run from Desktop. I put the binary itself, created a launcher, created a symbolic link but nothing worked. Nothing shows up like I did not even double click. The ...
0
votes
0answers
31 views

Starting Script at FTP login

I run a vsftp server on Debian and connecting with FTP over TLS. all allowed users are jailed in a chroot after login. Now i want to mount different folders inside the users chroot. For every single ...
1
vote
1answer
39 views

Is it a good practice to make different configuration files as symlinks to some scripts under the same directory?

I was wondering if it is a good practice to make the following configuration files as symlinks to some scripts under a directory e.g. ~/program_files/configurations/. The scripts /etc/rc.local, /...
2
votes
1answer
71 views

Using local system's .bash_profile and .vimrc on remote systems

Risking asking a possibly duplicate here but could not get any relevant answers. I wish to use my local system's .bash_profile and .vimrc on all the remote hosts I log in to. Is there an easy way to ...
0
votes
1answer
47 views

opening vim with custom location for .vimrc

I have my .vimrc file in a custom location (~/dotfiles/vim/.vimrc). When I type i: vim 'filename' I would like to execute the command: vim -u ~/dotfiles/vim/.vimrc 'filename' I put this function ...
1
vote
1answer
113 views

Adding anaconda path to .bashrc running on Redhat 7 breaks x2go login

I am using x2go to connect to a remote Redhat 7 server running the MATE desktop. The problem I am having is when I add export PATH="/opt/apps/anaconda2/5.0.1/bin:$PATH" to my .bashrc it completely ...
0
votes
1answer
54 views

What's the best, secure way to share some .bashrc source between users and root?

How's the best, secure way to have /root/.bashrc and /home/user/.bashrc include a common .bash.shared file? In other words like this: /root/.bashrc --sources--> .bash.shared <--sources-- /...
0
votes
3answers
63 views

command not available in bash script

My company has a custom tool we install in Linux to upload files to a server (among other things) called oTools. When I open a new Terminal, I can run (from any folder) oTools upload file and file is ...
0
votes
2answers
245 views

Why no such non-interactive version of bashrc?

From what I understanding, a daemon is a background process, but daemon requires unique config file to set the environment variable. E.g. Hadoop daemon require hadoop-env.sh to set environment ...
2
votes
2answers
367 views

Avoid sourcing scripts multiple times

At the moment, when I open a terminal on my Mac, it automatically calls: source ~/.bash_profile. What bemuses me, however, is that my shell does not seem to inherit any of the content from ~/.bashrc ...
0
votes
1answer
54 views

Launching GNU screen when opening terminal

I want that every opened terminal would be launched with screen session. Actually what I want is simply accomplished with following steps: 1. win+enter (open terminal in i3wm) 2. $ screen I wanted ...
2
votes
1answer
410 views

What's the difference between .bashrc and .inputrc

I am new to the unix system, and find it interesting to create customized functions and configurations in the setting files like .bashrc and .inputrc. However, I don't understand the differences ...