I downloaded flutter and Android studio on my linux machine. It is a kali linux installation. I want to add environment path variable for both android studio and flutter permanently so, who when I start a shell, I don't have to add them every time. I want to add to all users. I did some searching and found that you have to add the path in /etc/profile
if you want to do for all users. But nothing seems to be working.
The original content of the file
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
if [ "`id -u`" -eq 0 ]; then
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
fi
export PATH
if [ "${PS1-}" ]; then
if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then
# The file bash.bashrc already sets the default PS1.
# PS1='\h:\w\$ '
if [ -f /etc/bash.bashrc ]; then
. /etc/bash.bashrc
fi
else
if [ "`id -u`" -eq 0 ]; then
PS1='# '
else
PS1='$ '
fi
fi
fi
if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh; do
if [ -r $i ]; then
. $i
fi
done
unset i
fi
I added my paths using a :
to separate just after else in line 4 like this
PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/user1/Flutter/flutter/bin:/home/user1/android-studio/bin"
saved the file and restarted machine, and did
echo $PATH
in the shell but the output was just this:
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
Then I tried different method removed previous changes and added
PATH=$PATH:/home/user1/Flutter/flutter/bin:/home/user1/android-studio/bin
just before export path, saved restarted the machine and it didn't work either. The echo $PATH
command prints the same above paths.
How do I accomplish what I am trying to accomplish. I have looked at several similar questions on this site and most suggest what I have done above. Am I doing anything wrong?
EDIT
This the contents of .profile
in my user directory. I have only one user.
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
fi
PATH
variable? What shell are you using?https://www.kali.org
: Kali Linux is an open-source, Debian-based Linux distribution geared towards various information security tasks, such as Penetration Testing, Security Research, Computer Forensics and Reverse Engineering. ) as a general purpose Linux system. This is unwise. Rather, install a supported Ubuntu release. You can build or install any of the tools.