Questions tagged [bashrc]

.bashrc is the Bash shell configuration file for a user's terminal login session.

Filter by
Sorted by
Tagged with
237 votes
6 answers
272k views

How can I shorten my command line (bash) prompt?

Currently it is: michael@Castle2012-Ubuntu-laptop01:~/Dropnot/webs/rails_v3/linker/spec/controllers$ Outside of renaming my machine and directory structure... How could I make it be something more ...
Michael Durrant's user avatar
112 votes
4 answers
282k views

How do I restore .bashrc to its default? [duplicate]

I've been trying to install Android developer tools on Eclipse, and I followed the information in this video. Like the video said, I added the following two lines of code to the .bashrc file: export ...
nanananana's user avatar
  • 1,235
140 votes
5 answers
208k views

Changing colors for user, host, directory information in terminal command prompt

Is it possible to change the colors in the command prompt for the user@computer, as well as the the current directory and command parts of the prompt display? I've already seen something like this ...
Luiz Rodrigo's user avatar
  • 1,749
53 votes
3 answers
54k views

Sequence of scripts sourced upon login

I would like to concentrate all my login config in my ~/.bash_profile. There was a ~/.bashrc there by default but I replaced it with a ~/.bash_profile. However, when I log in, something before my ~/....
amphibient's user avatar
  • 1,257
44 votes
5 answers
67k views

How to restore .bashrc file?

The terminal shows this when it opens: bash: /home/atlas/.bashrc: line 73: syntax error near unexpected token `[' bash: /home/atlas/.bashrc: line 73: `if [ -x /usr/bin/dircolors ] ; then ' I've ...
Miranda Webb's user avatar
248 votes
7 answers
435k views

Why ~/.bash_profile is not getting sourced when opening a terminal?

Problem I have an Ubuntu 11.04 Virtual Machine and I wanted to set up my Java development environment. I did as follows sudo apt-get install openjdk-6-jdk Added the following entries to ~/....
Viriato's user avatar
  • 2,591
51 votes
8 answers
115k views

How to add an alias to a command in terminal?

By typing a manually specified command in terminal I want to execute some other command. How could add an alias to a command? Can i do that with the help of the terminal or should I edit some kind of ...
Rootical V.'s user avatar
  • 1,135
14 votes
1 answer
20k views

Terminal splash screen with Weather, Calendar, Time & Sysinfo?

I saw a Ubuntu Bash under Windows 10 terminal splash screen here: Windows Subsystem for Linux display Linux distribution? How can I change my ~/.bashrc to get a similar splash screen in regular ...
WinEunuuchs2Unix's user avatar
229 votes
7 answers
149k views

Bash history search, partial + up-arrow

I have searched, but not found anything on this. I am looking for a functionality in bash, using a terminal. Way back when, I had a user on a debian system, and a friend set me up with a convenient ...
TLP's user avatar
  • 3,241
22 votes
1 answer
8k views

At what point is the ~/.bashrc file created?

For instance, if I were to run the command adduser test, is the .bashrc created automatically upon creation of the home directory for the user test? If it's not created upon user creation, under what ...
Michael's user avatar
  • 533
84 votes
6 answers
137k views

Cannot successfully source .bashrc from a shell script

Normally we can source ~/.bashrc file using this command source ~/.bashrc but if I write this in a shell script and execute it, nothing happens. Why? Is there any way to do this? My script: #!/bin/...
shantanu's user avatar
  • 8,609
79 votes
2 answers
80k views

Why isn't .profile sourced when opening a terminal?

Just installed Ubuntu 14.04.1 LTS. According to .profile, # ~/.profile: executed by the command interpreter for login shells. # This file is not read by bash, if ~/.bash_profile or ~/.bash_login ...
B Seven's user avatar
  • 1,039
248 votes
7 answers
433k views

Why does "(base)" appear in front of my terminal prompt?

I'm wondering why I have (base) on the left of my terminal prompt. If I run source ~/.profile in the terminal, it disappears. If I close that terminal and reopen a new terminal, (base) is there ...
Jimmy's user avatar
  • 2,583
150 votes
4 answers
53k views

What does "${debian_chroot:+($debian_chroot)}" do in my terminal prompt?

In my terminal prompt definition in my .bashrc file, among other things, I have this snippet of code: ${debian_chroot:+($debian_chroot)} What does this do, and do I need it?
fouric's user avatar
  • 4,588
81 votes
4 answers
258k views

Permanent PATH variable

How will I make this /media/De Soft/mongodb/bin PATH variable permanent? Everyone is saying "export PATH=$PATH:media/De\ Soft/mongodb/bin to your ~/.profile, or .bashrc, or .zshenv depending on your ...
Towhid's user avatar
  • 4,035
33 votes
2 answers
14k views

Why does Ubuntu's default ~/.profile source ~/.bashrc?

These are the contents of the stock ~/.profile that came with my 13.10 (commented lines removed): if [ -n "$BASH_VERSION" ]; then if [ -f "$HOME/.bashrc" ]; then . "$HOME/.bashrc" fi fi ...
terdon's user avatar
  • 101k
5 votes
1 answer
53k views

"export PS1=" for customizing shell prompt

I wanted to customize my shell prompt to include the time. So, I did export PS1='\t\w\$'. My prompt now looks like 18:57:37~$. I don't know how to prepend it with username@hostname. Also, I don't ...
Smile's user avatar
  • 1,099
175 votes
11 answers
1.5m views

Where is .bashrc?

I feel stupid asking, but I can't seem to find the answer to this anywhere. I'm trying to follow these instructions to edit my bash prompt, but there is no .bashrc in either my user directory (~/....
JeanSibelius's user avatar
  • 3,602
126 votes
5 answers
297k views

How do I get a colored bash?

How can I get the bash to look colored like this?
daniel451's user avatar
  • 7,403
29 votes
1 answer
97k views

What is a .bashrc file and what does it do?

I can't seem to find any clear information on what the .bashrc file is and what it does exactly. Thanks for all the help so far. It seems that this script does everything from coloring, completion, ...
Justin's user avatar
  • 2,111
17 votes
1 answer
7k views

How to display random jokes from www.icndb.com in your terminal?

I already know that you can get some nice quotes/jokes using the fortune program. But I've found in this urwird script a new source of fun that I'd like to have when I open a new terminal. This time ...
Sylvain Pineau's user avatar
1 vote
1 answer
582 views

Main Terminal Window Displaying Commands Only

I often lose track of the command flow due to the long text output of some commands, so I would like to have a main terminal window where user commands are executed and other terminal windows that „...
Sandro Sivsivadzé's user avatar
0 votes
1 answer
2k views

Terminal error (some typo somewhere?) with .bashrc disables all aliases etc

I can't use any of my aliases or custom defined variables in bash. The error when I open the terminal is immediately: : command not found bash: /home/khaverim7/.bashrc: line 6: syntax error near ...
khaverim's user avatar
  • 478
70 votes
1 answer
107k views

Why is /etc/profile not invoked for non-login shells?

Login and non-login shell defined as: su - $USER # will give you a login shell bash # will give you a non-login shell /etc/profile is not invoked for non-login shells, such as when you start konsole ...
James Mitch's user avatar
32 votes
4 answers
88k views

Add a binary to my path

I have an executable. I want to execute the executable in terminal with name only like other commands. I can put my executable in /usr/local/bin or I could add its PATH to ~/.bashrc. Both will work. ...
Mohammad Reza Rezwani's user avatar
20 votes
5 answers
13k views

How (and where) can one change 'user@host $:' pattern in gnome-terminal?

When I start terminal in Ubuntu, I see: ilya@HOST:~$ I need to add a timestamp to this, something like: 2011-10-09T09:32:00 ilya@HOST:~$ How can I configure this?
Ilya Smagin's user avatar
11 votes
3 answers
10k views

Where is my PATH variable being set?

I'm trying to set my path variable to look like this: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/jgrande/android-sdk-linux/platform-tools:/usr/lib/...
user1617942's user avatar
7 votes
1 answer
3k views

.bashrc edit messes up terminal command arrow-up history print

I wanted to give my terminal prompt in Ubuntu a more personal look, and wanted to change the text prior to the '$' when writing a command. From what I've found this is done by editing the .bashrc ...
darksmurf's user avatar
  • 272
60 votes
3 answers
116k views

How to save terminal history manually?

It's my understanding that the history file is updated when the terminal exits. But sometimes my computer crashes out, and the terminal doesn't exit cleanly, and then I lose those commands from my ...
wim's user avatar
  • 12.7k
48 votes
3 answers
23k views

Write function in one line into ~/.bashrc

Why when I try to write a function just in one line into .bashrc file, list(){ ls -a } I get error? bash: /home/username/.bashrc: line num: syntax error: unexpected end of file but when I write it ...
αғsнιη's user avatar
  • 35.7k
45 votes
5 answers
54k views

difference between bash.bashrc and /etc/environment file

Till date I used to set my environment variables in the bash.bashrc file. Recently I was told to use the /etc/environment file. Well, both work fine. So, what is the difference between them? I ...
Ankur Trapasiya's user avatar
29 votes
4 answers
51k views

Configure gnome-terminal to start bash as a login shell, doesn't read .bashrc

I'm trying to integrate RVM with gnome-terminal. Per default, gnome-terminal does not start bash as a login shell. I enabled run command as a login shell as suggested in this answer about the same ...
Arturo Herrero's user avatar
15 votes
2 answers
3k views

How do I pipe each command given to the shell?

I'd like to edit my .bashrc so that every command executed on the shell is piped to something, for example: $ sudo apt update _________________ < sudo apt update > ----------------- \ ...
M. Becerra's user avatar
  • 3,448
9 votes
2 answers
19k views

How to change colours in bash prompt [duplicate]

I have followed the instructions here and in the howto link that is provided there. However nowhere does it appear to say how I can change the colours of the different parts, because currently I set ...
user avatar
4 votes
2 answers
19k views

My terminal shows only a blank screen--How can it?

I recently installed Ubuntu 13.10. in the process of editing bash.bashrc file something went wrong and all of a sudden all i'm getting when I open my terminal is a blank screen. No directory names or $...
Wally Ali's user avatar
  • 141
3 votes
4 answers
4k views

Alternative way to run a sudo command on startup

I am trying to write a script for my Ubuntu system to hibernate, whenever the amount of battery left is (say) 5%. This script will run on startup. I can get the battery left using upower -d |grep ...
viv1's user avatar
  • 55
73 votes
4 answers
126k views

How can I preset aliases for all users?

I have Ubuntu 14.04.2. I want to make it so all users automatically have a specific set of aliases. I have my aliases set in my personal .bashrc, but I don't want to have to manually copy them into ...
Brian Sizemore's user avatar
42 votes
5 answers
95k views

Specify JDK for tomcat7

I have installed tomcat7 (using apt-get install) and whenever I want to start tomcat7 it says : * no JDK found - please set JAVA_HOME I have set JAVA_HOME in my bash.bashrc and also in ~/.bashrc and ...
Hossein's user avatar
  • 1,707
35 votes
7 answers
62k views

Copy current terminal prompt to clipboard

Is there a way to copy the currently written content of the bash prompt? Say I wrote: ping www.google.com so that the lines in terminal looks like: petr@sova:~$ ping www.google.com and didn't hit ...
mreq's user avatar
  • 4,812
27 votes
2 answers
8k views

Why is my function not re-evaluated in PS1?

I'm trying to have a part of my prompt set dynamically by a function, so in my .bashrc I have: asdf () { echo -n $(pwd) } PS1="\u@\h:\w $(asdf)\$ " Opening a shell gives me what I expect at ...
darthbith's user avatar
  • 384
21 votes
4 answers
3k views

How do I teach bash in Ubuntu some curse words?

When bash encounters an unknown command(word?) it does this : The program 'hello' can be found in the following packages: * hello * hello-debhelper Try: sudo apt-get install <selected package&...
NitinAb's user avatar
  • 500
20 votes
2 answers
8k views

Can I create a separate bash history file for each terminal profile?

I use a bash script to start gnome-terminal with multiple tabs, each tab using a different profile, working directory, and in some cases executing a command within the tab. In this situation, I'd ...
Inkayacu's user avatar
  • 815
15 votes
3 answers
9k views

.desktop file with .bashrc environment

I am using IntelliJ IDEA, and it uses some of the environment variables defined in the .bashrc script. If I run its shell script from the terminal everything works fine but if I create a .desktop ...
Guy Marom's user avatar
  • 173
15 votes
2 answers
32k views

I think I accidently deleted the PATH variable

Whatever I try to run, I get the error: The command could not be located because '/usr/bin' is not included in the PATH environment variable. I had some modification in my .bashrc file but then ...
yayu's user avatar
  • 3,381
11 votes
3 answers
2k views

Why does my ssh login include what looks like a promotion for a TechRepublic article?

When I ssh into my Ubuntu box I see the output below. I was surprised to see the quote and the link to the TechRepublic article. Is that an advertisement? Anyone know where that is coming from? Is ...
Ben Riga's user avatar
  • 233
10 votes
2 answers
2k views

Reverse-search in CLI: messed up output afterwards [duplicate]

See my edit below, this is not totally a duplicate of Shell prompt customization and cmd behavior My reverse-search function in the CLI is broken and I don't know how to fix it back... When I hit ...
MrYoshiji's user avatar
  • 203
9 votes
6 answers
18k views

Where I can find the contents of the default /etc/bash.bashrc file?

I accidentally overwrote the /etc/bash.bashrc file. Please give me the default content in that file to restore, or the file itself.
ANANTHAGANESH's user avatar
7 votes
3 answers
4k views

gnome-terminal does not allow changing the title

I've selected "Replace initial title" setting in gnome-terminal's preferences, but it just shows the default title "Terminal". After reading this answer, I added this to my .bashrc: PROMPT_COMMAND='...
galymzhan's user avatar
  • 123
7 votes
2 answers
3k views

Where is bash's "shopt extglob" turned on for my interactive shell?

I see that extglob is on but I'd like to know where this is set. $ shopt extglob extglob on $ Didn't find it in these files. ~/.bashrc ~/.bash_profile ~/.profile /etc/bashrc (no such file) /...
JohnMudd's user avatar
  • 137
5 votes
5 answers
26k views

Editing .bashrc in WSL safely

How do I edit the .bashrc file in Windows Subsystem for Linux safely? This article warns to never edit files stored in the WSL AppData folder using Windows tools. But then how do you edit files like ....
doko's user avatar
  • 59