Questions tagged [bashrc]

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

Filter by
Sorted by
Tagged with
1 vote
1 answer
84 views

Bash prompt with zero width control characters

To prevent the prompt from warping around right-to-left text, I want to insert a zero width LRM into the bash prompt (U200e). Since this is a zero width character, my instinct was to wrap it with \[&...
Shachar Shemesh's user avatar
0 votes
2 answers
100 views

Why is a newly created user account using my personal bashrc?

I set up a home server running Rocky 9 with a minimal install and one user account [mine]. I then created a new user, but when I login as the new user, the bash prompt is using the custom PS1 scheme ...
BlackDiamond's user avatar
0 votes
1 answer
70 views

Activate a conda/mamba environment when cd to a specific directory

Can I automatically activate a specific environment when cd into a directory? Like if I cd into the directory my_nn_library then automatically run mamba activate nn_env. I am using Ubuntu.
Osman Mamun's user avatar
0 votes
1 answer
287 views

docker login fails when done in .bashrc

At the end of my .bashrc file I have the following: docker login -u AWS -p $(aws --region us-east-2 ecr get-login-password) 636602586062.dkr.ecr.us-east-2.amazonaws.com However, whenever I open up a ...
neubert's user avatar
  • 7,092
0 votes
1 answer
71 views

.bashrc PS1: \w for WSL

I'm using Debian on WSL. However I mostly work in the Windows path. Currently my PS1 in .bashrc looks like this: PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u\[\033[00m\]:\[\033[01;34m\]\w\[...
Nikolar's user avatar
1 vote
1 answer
311 views

The most proper place to set systemwide shell alias in a Linux system

There are many places to set an alias for all users within a Linux system, e.g. /etc/profile, /etc/profile.d/*, /etc/bash.bashrc... I'm wondering which one is the most proper/correct, in other words, ...
Leon's user avatar
  • 239
0 votes
1 answer
180 views

bash scripts not loading any of ~/.bash*

Context: M1 MacBook macOS Ventura 13.5.2 zsh as default shell GNU coreutils installed by homebrew /opt/homebrew/opt/coreutils/libexec/gnubin added to path in ~/.bashrc, ~/.bash_profile, and ~/....
ShadSterling's user avatar
  • 1,489
0 votes
0 answers
36 views

Is there a way to disable force flag in reboot command

I want to prevent execution of reboot -f, Is there any way we can either disable the force flag itself or simply ignore the force flag and redirect the usual reboot?
supercool276's user avatar
0 votes
1 answer
492 views

vscode remote environment variables don't match `.bashrc`

Let's say the $PATH variable contained /usr/bin before everything. My ~/.bashrc used to have a line like this: export PATH='/home/user/123:$PATH' Then, I changed the line to: export PATH='/home/user/...
ImACoralReef's user avatar
1 vote
0 answers
95 views

Adding color to bash right prompt causes unwanted behaviour

rightprompt() { green=$(tput setaf 156) yellow=$(tput setaf 228) red=$(tput setaf 203) printf "%*s" $COLUMNS "${green}$(date +%a), ${yellow}$(date +%b\ %d), ${red}$(date ...
Lord Royce's user avatar
0 votes
0 answers
661 views

every time i open my parrot OS terminal i get bash: ‘export: command not found

I prefer Linux. I accidentally executed a misspelled command in terminal. sudo echo 'export PATH=/home/grump/miniconda3/bin:$PATH' >> /.bashrc What can I do now that it is constantly executing ...
Girum Senay's user avatar
0 votes
0 answers
917 views

.bashrc is not sourced when open new tab in Terminal.app

When I opened new tab in Terminal.app with cmd + T, .bashrc is not sourced automatically. I had to manually run the source command. Could you please tell me why this is? environment macOS Monterey 12....
taisei's user avatar
  • 1
0 votes
1 answer
245 views

How to get full path in terminal and what PS1 cmd to use in bashrc [duplicate]

Every time I change the directory I get only current directory name but I want full path what cmd should I use in my .bashrc file ? currently, i am trying as follows export PS1="\W >" ...
Gary's user avatar
  • 1
0 votes
1 answer
684 views

Aliases from ~/.bashrc don't work until I run . ~/.bashrc

My aliases from ~/.bashrc don't work until I run . ~/.bashrc. I see alias_xxx: command not found I log in via SSH and I started a new ssh session after making changes to .bashrc. echo $SHELL returns /...
user3115655's user avatar
0 votes
0 answers
405 views

How to log Linux commands ran from a script?

I am able to log commands executed on bash shell using export PROMPT_COMMAND='history -a > ..... , but this wont log commands executed from within a shell script. Is there any way to log command ...
Harish Reddy's user avatar
2 votes
2 answers
9k views

How to properly use environment variables in crontab

I export a variable in my ~/.bashrc file (Ubuntu 20), which I'd like to use in a cron job. Searching for answers, I found two ways of doing it, but none worked for me: 12 11 * * * BASH_ENV=/home/l86/....
Leandro 86's user avatar
3 votes
1 answer
459 views

Set PATH in .bashrc depending on shell

I have a user switcher that has different use-cases. It's PATH should depend on whether the current shell is restricted or not. Thus I've added to the end of /home/switcher/.bashrc: [[ $- == *r* ]] &...
morrow's user avatar
  • 45
0 votes
1 answer
109 views

Can not open a file from .bashrc with the terminal

I saved a file.txt in my home directory and add that in .bashrc : alias tiling='clear; cat tiling-gelp.txt' And I thought if I typed tiling in my terminal, the .txt would open, but not? idea?
James78's user avatar
  • 29
0 votes
2 answers
47 views

Bash recognizes function argument as a program

I'm pretty new to the syntax of bash and I have a piece of code in my '.bash_aliases' file. It either gets an integer as an argument or the letter 'c', when it gets an integer, it puts that integer in ...
Casper2416's user avatar
0 votes
1 answer
2k views

oh-my-posh won't activate when starting up terminal, but if I refresh .bashrc it activates

Upon starting the terminal: But if I run .bashrc it works: I'm not sure why when .bashrc runs on startup it doesnt work, but if I run it myself it works. Edit : I found a solution that worked I was ...
zasc's user avatar
  • 21
0 votes
1 answer
861 views

Bashrc not able to chain commands anymore using && or ;

You guys are my last resort. I've got a bashrc file with all kinds of commands in it. A lot of them are variations to this alias test=' test1 && test2 ' alias test1=' echo "i hope&...
S.J.'s user avatar
  • 13
0 votes
1 answer
637 views

How do I make it so that I don't need to source everytime I open up my terminal?

Due to the way I downloaded a certain program [Gromacs], every time I open a terminal to use gmx, I must do the following and would like to make it so I don't need to do this every time: cd ~/...
Os GS's user avatar
  • 3
0 votes
1 answer
61 views

I am a newbie and I want to use linux bashrc

So I am a newbie in using Linux and I am following courses and blog posts related to linux to learn more and more about it. As I was searching about Linux Bashrc, what it is and how to use it, I came ...
senator217's user avatar
1 vote
1 answer
154 views

Bash script that displays time on terminal

I wanted to write a bash script that serves like a greeting and show date and time(in terminal), and I ran into some issues. I've done some digging I solved most of the issues. The one and only issue ...
black-purple's user avatar
1 vote
1 answer
440 views

Can i have a private / user-specific etc folder?

I am often fiddling about with software built from source, which i install in $HOME/.local. To make it run, i have to export various variables such as LD_LIBRARY_PATH. But i do not want to have to ...
TheEagle's user avatar
  • 113
0 votes
1 answer
380 views

Alias in bashrc returns syntax error

I am using archlinux with bash. I have been trying to create a new alias but bashrc doesn't like my curly bracket. The command down below should count the video duration length of every .mkv in my ...
Vernox Vernax's user avatar
0 votes
1 answer
217 views

Full-letter cursor in bash

I just started using Vim within a bash terminal. Often the cursor is very hard to see, it being a tiny line among hundreds of characters that are the same color. I'd like to change my cursor to be of ...
Yehuda's user avatar
  • 221
0 votes
1 answer
54 views

How do you get bash to cd to your previous session directory on login?

I would like to on ssh login, change directory to my previous one. (I'm the only user on my machine).
Quang's user avatar
  • 149
3 votes
7 answers
19k views

How to revert to one line terminal in new Kali Linux 2020.04

┌──(kali㉿kali)-[~] └─$ I want this to be in one line on terminal like it was before I updated kali. I tried changing bashrc on kali user and on root user there was no update.
yamizone's user avatar
-1 votes
1 answer
85 views

can i place all my .bash* file in to a directory?

i have quite a few .bash* file in ~/ .bash_aliases .bash_history .bash_logout .bashrc Can i put all these files in to a ~/.bash directory and if so how, or would it just break?
xXdesertwolfXx's user avatar
0 votes
0 answers
197 views

putty and remina work but telnet and ssh do not

I am connecting from a ubuntu 20.04 to a raspberry pi 4 B also on Ubuntu 20.04 telnet dies immediately ssh can be forced with ssh -T user@host however there is no prompt, the prompt can be restored by ...
marc's user avatar
  • 1
1 vote
0 answers
466 views

Is there a way to get the path to the .bashrc file that has been used by BASH?

I am logging into a server using a .bashrc file different from the one in $HOME or in ~/. Since the server is huge and there is plenty of users folders, I really don't want to use find to look for any ...
alec_djinn's user avatar
7 votes
2 answers
6k views

SSH without sourcing .bashrc

I was experimenting with my .bashrc file while remotely logged in to a server over SSH. I inadvertently left an exit in there that caused all subsequent logins to immediately disconnect. I was ...
j-hui's user avatar
  • 73
0 votes
0 answers
781 views

Adding to the PATH environment variable / editing the .bashrc file

I'm very much a newbie with Linux (coding in general really) but I've have taken the plunge and installed Mint for my coding projects. I've installed Julia, which I use to run numerical simulations ...
mark's user avatar
  • 101
8 votes
5 answers
2k views

Restoring ~/.bashrc without using bash commands

I think I had a typo when I add a path to ~/.bashrc and after I source it, I cannot use bash commands anymore. Now I want to restore a normal ~/.bashrc, however most of the discussion I found (e.g. ...
Johnny Tam's user avatar
0 votes
0 answers
255 views

How to block access to .bashrc and .profile

How can I block possibility to download .bashrc and .profile files from Debian server with Nginx? I already added this to vhosts configuration: location ~* \.(bashrc|profile)$ { deny all; } ...
Brzozova's user avatar
  • 101
0 votes
1 answer
537 views

How to get my bash alias to run when I open terminal

I setup a bash alias to run neofetch in .bash-alias but the only way to get it to run is to source it in every new terminal window. How can I get it to actually run when the terminal starts/opens? ...
bckelley's user avatar
2 votes
1 answer
2k views

OS X Catalina: update_terminal_cwd:11: unrecognized modifier `i'

In .zshrc be sure to have # .zshrc # Source global definitions if [ -f /etc/zshrc ]; then . /etc/zshrc fi instead of # .bashrc # Source global definitions if [ -f /etc/bashrc ]; then . /...
Pietro Oliva's user avatar
1 vote
0 answers
31 views

can't find bash history executed via ruby net::sh library

In the hope for getting the commands that run via ruby net::ssh tool which is described as follow: Net::SSH is a pure-Ruby implementation of the SSH2 client protocol. It allows you to write ...
medBouzid's user avatar
  • 123
2 votes
0 answers
960 views

Dash rc files for non-login non-interactive shells

Does dash have a non-interactive non-login rc file? I've read the man page, which recommends .profile for login shells and $ENV environment variable for interactive shells. Is there anything that ...
Nick Bull's user avatar
  • 133
0 votes
1 answer
1k views

Raspberri Pi 4: run an application at startup not working properly in interactive mode

I wanted to run a script when my RPi 4 boots. my application requires ~./bashrc to run beforehand, then as far as I know, I should call terminal in "interactive" mode. when I run below command in a ...
hamzee's user avatar
  • 1
0 votes
0 answers
2k 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 ...
Mohammad_Hosseini's user avatar
2 votes
1 answer
1k 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 ....
Дмитрий Куценко's user avatar
0 votes
1 answer
73 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=...
everwisher's user avatar
0 votes
2 answers
673 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/...
Fadiel's user avatar
  • 1
0 votes
0 answers
2k 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 #--...
brettwbyron's user avatar
0 votes
2 answers
2k 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 ...
Mileta Dulovic's user avatar
3 votes
2 answers
1k 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 ...
jaaq's user avatar
  • 400
0 votes
0 answers
310 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?
Student4K's user avatar
  • 127
1 vote
1 answer
66 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 ...
user632657's user avatar

1
2 3 4 5 6