hey everyone
I want to change some environment variables , but I can't find the .bashrc file were I can change them, so can anyone tell me how to change environment variables in linux mint 14

Dani AI

Generated

As asked about making environment changes permanent, and as and started to point out, the right place depends on where you need the variables to appear (interactive terminal, login shell, graphical desktop, or system-wide). A brief, practical summary and safe steps follow.

Which file to edit

  • Per-user, available to GUI sessions and login shells: use ~/.profile (display managers generally source this at session start).
  • Per-user, for interactive shells opened in a terminal: use ~/.bashrc.
  • If you create ~/.bash_profile, bash will read that instead of ~/.profile for login shells—either put exports in ~/.profile or make ~/.bash_profile explicitly source ~/.profile.
  • System-wide: use /etc/environment for simple KEY="value" entries (no shell expansion), or put a shell script that exports variables into /etc/profile.d/ (for login shells).

Example (per-user, put into ~/.profile)

# add to ~/.profile
export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"
export PATH="$JAVA_HOME/bin:$HOME/bin:$PATH"

Notes and troubleshooting

  • After editing, log out and log back in for GUI sessions (or reboot) so the display manager picks up changes. For the current terminal, run source ~/.profile or start a new login shell with exec bash -l.
  • Verify with echo $JAVA_HOME or env | grep JAVA_HOME.
  • Be careful with syntax: a broken profile can affect logins. Test edits in a terminal first; if you lock yourself out of the desktop, switch to a TTY (Ctrl+Alt+F1) to fix files.
  • Prefer ~/.profile for Mint/Ubuntu desktop use; only use ~/.bashrc for shell-only tweaks and /etc/environment or /etc/profile.d/ for system-wide settings.

Recommended Answers

All 2 Replies

Do you want to change the environment variables for all users, or just your own account? Files that start with a dot are not visible. If you want to see them, run the command "ls -a ~". You should see all the files and directories, including the dotted ones, in your home directory. In any case, don't make the changes in .bashrc - it is better to set them in .bash_profile.

Rubberman is correct. /home/username/.bash_profile is the place to set it.

Sample

cat .bash_profile 
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.