If I do not edit the .bashrc or other config files, the environment variables that I've setted are gone when I logout, or turn off the terminal.   What I'm curious is, where are those 'temporary' env vars saved in?   As I guess, they might be in the memory. That makes sense because they will disappear when the terminal is turned off(equals the terminal I was using is gone from the memory). Am I correct?
124266
I know that VARIABLE=value creates an environment variable, and export VARIABLE=value makes it available to processes created by the current shell. env shows the current environment variables, but where do they live? What comprises an environment variable (or an environment, for that matter)?
9099
I have no clue, but lately I've been having this problem. After running my workstation suddenly something destroys PATH and lots of stuff stops working. Initially, my path had MANY directories listed (I use Windows 7 as a development box) and after some time, I only had 3-4 directories listed in my path left.  I can't even open the System Properties dialog where I can see environment variables (because it uses shell variables to start it and it doesn't work). In short, I reboot every time.   Any ideas what might cause that problem? I didn't run anything new/unusual lately. Only VmWare (but I've been using it in the past and didn't have that problem back then).  I just checked, even %WINDIR% is not defined. WTF?!
61566
I've had an interesting terminal session in , and I'd like to save the terminal output (commands and all) to a file - how can I do that?  According to the :     Ctrl-a ~ - Save the current window's scrollback buffer   This may indeed be doing something, but I've found no indication of where and under what name it might be saved.
47053
Some context about the bug:      Bash supports exporting not just shell variables, but also shell   functions to other bash instances, via the process environment to   (indirect) child processes.  Current bash versions use an environment   variable named by the function name, and a function definition   starting with “() {” in the variable value to propagate function   definitions through the environment.  The vulnerability occurs because   bash does not stop after processing the function definition; it   continues to parse and execute shell commands following the function   definition.  For example, an environment variable setting of    VAR=() { ignored; }; /bin/id       will execute /bin/id when the environment is imported into the bash   process.   Source:   When was the bug introduced, and what is the patch that fully fixes it? (See )  What are the vulnerable versions beyond noted in the CVE (initially) (3.{0..2} and 4.{0..3})?  Has the buggy source code been reused in other projects?  Additional information is desirable.    Related:
43909
I found a lot of people figuring out why instruction similar to this :   Put X to your ~/.bashrc and you can do Y    don't work.  It always turns out that Mac OS X's bash's startup files (or Mac's Bash itself) doesn't source ~/.bashrc file, either in the login shell, or in a shell spawned from window system - like Terminal app in Mac OS X)  Why is this, when all other Unix-like systems with Bash I've worked with before have done this?  PS:  I found what Bash itself says about startup files (which could be helpful) :     When Bash is invoked as an interactive login shell, or as a   non-interactive shell with the --login option, it first reads and   executes commands from the file /etc/profile, if that file exists.   After reading that file, it looks for ~/.bash_profile, ~/.bash_login,   and ~/.profile, in that order, and reads and executes commands from   the first one that exists and is readable. The --noprofile option may   be used when the shell is started to inhibit this behavior.   Source :
37477
There're way too many articles/resources on the web that teaches people HOW to set the environment variable PATH so that they can use the short hand of java or python etc instead of the absolute path in command line interface.  What I'm interested to know is that what's behind the scene when we type in the command and hit enter (similar to ).  Here is my guess:   read the command (parse/preprocess stdin to get the right arguments $@) command lookup command execution (program started, consume memory, stdout/stderr to shell) re-render the emulator by relevant environment variables (e.g. $PS#, $PROMPT, etc)   The part I want to figure out most is the command lookup. Obviously, the $PATH is consumed by some background function and separated by : / ;as delimiters, then what happened? Do we use a hash table (key: basename of the file, value: absolute dirname of the file) to store the binary files under those PATHs, or some other hooks?   NOTE: I originally thought it was hash table as I can use [ -z hash [command] ] to check if a command is available in current env, but when I use hash | grep python I get nothing from the output while which python works as anticipated. (I think the mechanism might be shell specific, but I want to get more insights into it.)
43537
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 exists.   There is no ~/.bash_profile or ~/.bash_login.  It does not seem to source .profile when opening a terminal.   Why doesn't it source .profile when opening a terminal? Why is .profile there if it is not sourced? How do I know/control what is sourced when a new terminal is opened? When a new terminal is opened, does it do a "login"? Where is a good place to add $HOME/bin to my path? .bashrc? Will that cause a problem because .profile has the same code?
87892
What's the difference between .bashrc and .bash_profile and which one should I use?
97625
Answers to the questions on  and , along with poking through (and reading headers of) $HOME and /etc/, indicate a number of files that can be used to set environment variables, including:   ~/.profile  ~/.bashrc  ~/.bash_profile  ~/.gnomerc ~/.Rprofile  /etc/bash_bashrc  /etc/profile /etc/screenrc    I gather that files in /etc/ work for all users whereas files in $HOME are user-specific. I also gather that .profile is loaded at login whereas .bashrc loaded when /bin/bash is executed. I also understand that different programs have different settings files (e.g. .Rprofile for R). But I would appreciate some clarification:   Are *rc and *profile files fundamentally different? What is the scope of such files (e.g. which files are are commonly used with Linux) Is there a hierarchy (e.g. .bashrc overwrites variables set in .settings) What is a good reference for this class of files? For the options in these files?   Linked questions
50462
I want to add a directory to search my search path. I know I have to modify the PATH environment variable. However, I want the change to be permanent, so that it is always in effect, for every Terminal (bash) window I open.  There is an overload of confusing and possibly conflicting information in   I am using Ubuntu 10.04. Suppose I want to add /usr/local/foo to my PATH. Which file (.bashrc, .profile, .bash_login, etc...) should I modify and what should the new line(s) look like?
64038
I have a user that has made no modifications to the $PATH in any dot-files: it is exactly the system default setting. From a login shell:  $ ssh example.com user@example.com:~$ cat /tmp/hello.hs #!/bin/bash  echo "$SHELL" echo "$PATH"  user@example.com:~$ /tmp/hello.hs /bin/bash /usr/local/bin:/usr/bin:/bin   Exactly as specified in /etc/profile. This I find rather unexpected:  $ ssh example.com '/tmp/hello.sh' /bin/bash        /usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games   Like I said, there's no modification of $PATH in ~/.bashrc, nor in /etc/bash.bashrc. No ~/.ssh/environment either. The ssh(1) declares that the environment variable PATH is     Set to the default PATH, as specified when compiling ssh.   but  from StackOverflow and this  article suggest that I should be able to influence the $PATH for a given command simply by modifying /etc/profile, one of the shell startup files, etc.   What's going on here?
30719
Is there any way to exclude commands like rm -rf, svn revert from being getting stored in bash history? Actually I, by mistake, have issued them a number of times even though I have no intent to do, just because I am doing things quickly and it happened. Hence results in lost of lots of work I have did so far.
51057
It's sunday and I left an instance of R running in the office. The script finished running, and I would like to save my workspace without going to the office. I can ssh to the computer, but I have not run the program into screen.  Is there a way, over ssh, to disown the process (I don't have access to jobsid of the terminal the program is running on!) and reattach it with say, reptyr? Reptyr and reptyr -T don't work without previously disowning the process  28845 3diag       20   0  139.3m  10.4m   0.0  0.1   0:12.06 S  `- urxvtd                                                                                        5327 3diag       20   0   16.4m   4.6m   0.0  0.1   0:00.02 S      `- bash                                                                                      5335 3diag       20   0 3499.3m 3.244g   0.0 43.3 171:57.89 S          `- R    The unique part of my question is that I explicitly require to detach a program without having access to the terminal in which it was created.
52065
I've been trying to install Android developer tools on Eclipse, and I followed the information in .  Like the video said, I added the following two lines of code to the .bashrc file:  export PATH=$(PATH):-/android-sdk/tools/ export PATH=$(PATH):-/android-sdk/platform-tools/   It seems, however, that this did not help me to install the Android files on Eclipse, as I am still having problems with that. What's more, it seems that I can't make any command in the terminal without getting a major error now! Every time I try to make a command in the terminal I get the following message:     The command could not be located because '/usr/bin' is not included in   the PATH environment variable.   Is there away to restore .bashrc to its default?
48730
..and then still be able to return to the same session/screen after restarting the terminal machine. I've tried screen but once I restarted my computer screen -d showed no sessions. Nohup seems to be what I want, but then I lose the ability to see the output later on, other than by saving it to a file. Cannot I pretend more?
43701
How can I hide username and computer in terminal command prompt?   In Terminal it says  Last login: Mon Jan 13 00:00:14 on ttys000 Whatever:~ UserName$    Is it possible to show just the current folder and $ sign?
119848
I am looking for a convenient way to add and/or modify and/or delete an environment variable from the command line. Particularly, I find myself at times in situations when I have to add a few variables in cmd.exe.  I'd be grateful if someone showed me a non-GUI way to modify (that is: to add a new directory to) the %PATH% variable.  The change should be be permanent, not just for duration of the cmd session.