Quite a garden path of issue depth discussion and attempts to try and reveal better code. " As the various distro take on their on affect " much is consider to be linux environment 101. Yet as some create distro /etc/environment with the system path being set.
there is an /etc/bash.bashrc as a pre-Set config as well as user environment check addin and tag on to the all system path statement.
Customization at one time sourced ~/.profile with a follow up to customization also at the ~/.bashrc as to being the personalized to custom path for personal check this that at a find and or execution of script. Habit for some cd to development directories
or ~/.bin or ~/.local/bin view the .profile carefully this checks if personalize add to default being the " bin " folder and its personal placement this code can be changed to fit if desire. Some might create a myScripts devo directory in another place of
/home/meUser has been odd time if one just encrypts their home folder can get locked out of their account (hence some create test accounts and or back account) some encrypt Crypto-LUKS the whole drive. in form does not really matter you unlock the whole drive at system boot. Still vulnerable.
Not to go off course 1st off again so much is done in Shell. or choice of shell each also have their attribute to getting it straight and correct per how one may customize their Rig and desktop experience. Bash does cover environment but ....
Code: Select all
open a shell xfce4-terminal or what ever flavor I install Konsole is one my more fav. Type
echo $PATH - this will reveal the all inclusive path of system and personal set environment directory PATH all to find things. When you open a shell or terminal app.
PATH=$PATH:/dir1:/dir2 .... to all to add too this best place in my honest placement is in ~/.bashrc Can do it again you have to look at the code and see pretty much in the middle of the ~/.bashrc is
echo $PATH | grep -Eq "(^|:)/sbin(:|)" || PATH=$PATH:/sbin
echo $PATH | grep -Eq "(^|:)/usr/sbin(:|)" || PATH=$PATH:/usr/sbin
if [ -f ~/.bash_aliases ]; then
source ~/.bash_aliases
export PATH="$PATH:/home/$USER:/myDir1:/mDir2:/myLive"
OR
export PATH="$PATH:/home/atomick/myDri1:/myDir2:/bin/.local/bin2/scripts;/myBigDrvE/scripts " #my customized, Note I can add any directory label I wish to my home there are Butts! myBigDrvE is a m2 mount point for perma access.
fi
I changed my own personal simply to show this is taken out of .bashrc one major caveat for hack is and was at one time to end the PATH="$PATH:/home/atomick:/.local/myscripts:/media/atomick/myLive: " followed up with
export $PATH
Note what I was going to express is DO NOT end the statement with a Colon : see I let a pluggable device I may use labeled myLive which I pop in an out of a USB port when UDEV detects so , it shall be avail to a search and my custom.
Aliases can be a super benefit this is also done in a section ~/.bashrc as well or can be a single additional file ~/.bash_aliases
here I can set an alias to a specific even soft link it so when its plugged in an out I can cd to it when.
Code: Select all
alias mS='cd /media/atomick/myLive/myscripts;pwd'
# once set I do not req reboot nor logout write out changes and resource it via your .bashrc
source .bashrc
and now
cd /mS
I am there.
This example Note /media is for portable plugin devices only create a mount point if it is a special SSD you use, again practice and research
https://www.gnu.org/software/bash/ # check here for other resources , the primary bash.doc should be included yet are not so here check search Bash Environment or all out Browser search "best practice setting bash environment"
or "setting bash PATH" "customizing bash environment" a great deal can be learned if so desire to patiently do so. use of an alias statement can make this process of speed value.
if using a special SSD on say a USB sata adaptor - this leads to setting a mount point and learning to mount and umount device - note not "un-mount" the n is not there for dismounting a device. This can provide security for your self doing this.
ie: reason "antiX" is another trim down flavor of linux Run as MX can also Run if installed to a large Flash Drive. Few installs allow to FLASH oppose to just Spinner/ssd/m2.nvme type drives. setting a script to mount and also adding to PATH
same time can be rewarding.
Advance Bash Scripting Guide can also provide more to what is missing per, without going to vast detail remember the PWD / pwd command line Present Working Directory
to know command line in Linux / *NIX is so very powerful odd 1, 2 cmd can reap what 1000s of code lines to create "Those Windows Like Gui's " and can be your friend as to learn yes tad steep learn curve get to know Web searching can tackle many a question. Best to try cd to your correct location where pwd copy this path and add it to the ~/.bashrc as shown one last you can add it direct to the PATH statement and test it. log out or Reboot will lose this entry
Code: Select all
echo $PATH
PATH="$PATH:/media/mrUser/myLive/myarchive;/myBigDrv/Pics:/myBigDrv/Games"
export $PATH
pwd #check and see if all match your good. suggest yes you can work it at /etc/environment or /etc/bash.bashrc copy them prior edit or only do it in your own .bashrc .zshrc .fishrc as few exampe Fish really has another method
hope to share some hints tips and queues. Cheers.