LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-27-2020, 12:30 PM   #1
Arct1c_f0x
Member
 
Registered: Feb 2020
Posts: 123

Rep: Reputation: 24
Where to keep program files I append to $PATH


I know how to append programs to path:

PATH=$PATH:/directory/directory


My question is this:

By convention or best habit, what is the best place to keep the physical location of the files that you append to PATH?

For instance let's say I have the open-source Runescape program RuneLite.Appimage

I don't want this file cluttering up my home folder, so where should I keep the file location before I go and add it to my PATH?


Thanks in advance.
 
Old 07-27-2020, 12:33 PM   #2
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,311
Blog Entries: 3

Rep: Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722
There is /usr/local/bin/ or /usr/local/sbin/ if you don't want ~/bin/ in your home directory. You'll need root access to copy programs there but then once there they should be read-only and owned by root. That is so that no one else can modify them.

See "man 7 hier" for a dry overview of where things should generally go.
 
2 members found this post helpful.
Old 07-27-2020, 12:34 PM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by Arct1c_f0x View Post
I know how to append programs to path:

PATH=$PATH:/directory/directory

My question is this: By convention or best habit, what is the best place to keep the physical location of the files that you append to PATH? For instance let's say I have the open-source Runescape program RuneLite.Appimage I don't want this file cluttering up my home folder, so where should I keep the file location before I go and add it to my PATH?
No way anyone here can answer that. It's up to YOU where you want to keep things and how you want to organize your own system. Personally, I keep things in /usr/local/bin, but that is *MY* preference. They can go anywhere; you can make a bin directory in your home folder and put things there. There is no 'best' answer.
 
1 members found this post helpful.
Old 07-27-2020, 12:35 PM   #4
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,226

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
I like to keep them in ~/.local/bin.
 
2 members found this post helpful.
Old 07-27-2020, 01:11 PM   #5
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
What Turbocapitalist, TB0ne, or dugan said.

One thing which is "off" is your description, "files that you append to PATH".

You do not add files to your PATH variable, instead you add directory paths to your PATH variable.

The /usr/local tree is very much for this purpose, it typically will already be in your PATH variable. You'll just need to place your programs in there and give them the same permissions, ownership, and group, as other programs you see in that tree. Otherwise you can make a bin tree somewhere off of your login, and make sure you update your .bashrc so that it appends that directory tree to your PATH variable.

You say you don't want it cluttering up your home folder, one tact is to make the directory hidden be prefixing the name with a dot, as noted by dugan. But personally I do not feel it clutters up one's home folder, in fact I typically do establish a set of sub-directories for various purposes in my home. Some for test or sample code, some for real project work, and definitely one to hold my programs and scripts that I use regularly, and which are ones that I have developed for long term utility use.
 
1 members found this post helpful.
Old 07-27-2020, 04:16 PM   #6
Arct1c_f0x
Member
 
Registered: Feb 2020
Posts: 123

Original Poster
Rep: Reputation: 24
Talking

Quote:
Originally Posted by rtmistler View Post
What Turbocapitalist, TB0ne, or dugan said.

One thing which is "off" is your description, "files that you append to PATH".

You do not add files to your PATH variable, instead you add directory paths to your PATH variable.

The /usr/local tree is very much for this purpose, it typically will already be in your PATH variable. You'll just need to place your programs in there and give them the same permissions, ownership, and group, as other programs you see in that tree. Otherwise you can make a bin tree somewhere off of your login, and make sure you update your .bashrc so that it appends that directory tree to your PATH variable.

You say you don't want it cluttering up your home folder, one tact is to make the directory hidden be prefixing the name with a dot, as noted by dugan. But personally I do not feel it clutters up one's home folder, in fact I typically do establish a set of sub-directories for various purposes in my home. Some for test or sample code, some for real project work, and definitely one to hold my programs and scripts that I use regularly, and which are ones that I have developed for long term utility use.

That is amazing point that for some reason I did not consider or did not think was possible. Thanks Rtmistler, and thanks, dugan! What I'll do is create a hidden directory in the home folder and append that directory to path.

Now I have one more question.


1. Any idea what I should call that hidden directory? Names are important and I want to name things in a standardized and methodical way. How things are done by the Linux community at large is important to me.
 
Old 07-27-2020, 04:17 PM   #7
Arct1c_f0x
Member
 
Registered: Feb 2020
Posts: 123

Original Poster
Rep: Reputation: 24
Quote:
Originally Posted by Turbocapitalist View Post
There is /usr/local/bin/ or /usr/local/sbin/ if you don't want ~/bin/ in your home directory. You'll need root access to copy programs there but then once there they should be read-only and owned by root. That is so that no one else can modify them.

See "man 7 hier" for a dry overview of where things should generally go.
Thanks Turbocapitalist! man hier is a very useful manual page and I will be accessing it frequently until I absorb the majority of its info.
 
Old 07-27-2020, 06:02 PM   #8
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,803

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
IMHO, "$HOME/bin" isn't exactly "clutter" and it's an oft-encountered standard location that many sites I've worked on include in a user's PATH by default. So it certainly wouldn't be weird to go with that location. (You want to see clutter? Try issuing "cd; ls -a" to see all the subdirectories and files that applications automatically put in your home directory.)

"$HOME/.local" on my desktop system already exists and seems to contain a LOT of things that aren't my script/programs but things that other software has placed there. "$HOME/.local/bin" contains Python3-related things and "$HOME/.local/share" (share? Sharing with who?) has a TON of things under it that appear to be state information used by a slew of applications ("recently used files", that sort of thing)---not a place where I'd want my software to reside -- and in my PATH -- where a typo could cause something I'm not even aware exists to be executed and do $DIETY-only-knows what.

When doing backups, there's much under "$HOME/.local" I'd prefer to not be backing up as I'm reasonably certain it's not being terribly critical. "$HOME/bin" on the other hand... that where the good stuff is located.

Just someone's US$0.02. Cheers...
 
Old 07-27-2020, 06:15 PM   #9
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,727

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
I keep shell scripts in ~/bin. Some are in /root/bin
Web scripts are in directories in the DocumentRoot, of course...but they don't need to be included in PATH...
 
Old 07-27-2020, 07:27 PM   #10
igadoter
Senior Member
 
Registered: Sep 2006
Location: wroclaw, poland
Distribution: many, primary Slackware
Posts: 2,717
Blog Entries: 1

Rep: Reputation: 625Reputation: 625Reputation: 625Reputation: 625Reputation: 625Reputation: 625
Quote:
Originally Posted by Arct1c_f0x View Post
Code:
PATH=$PATH:/directory/directory
My remark. It is good practice to protect variables in substitutions with double quotes. Perhaps you know. As for me it is every day routine.
 
Old 07-27-2020, 09:48 PM   #11
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Quote:
Originally Posted by Arct1c_f0x View Post
Now I have one more question.

1. Any idea what I should call that hidden directory? Names are important and I want to name things in a standardized and methodical way. How things are done by the Linux community at large is important to me.
Name it as you wish.

The more standard thing is for people to have a bin sub directory off their home, named "bin", and $HOME/bin is included in their PATH.

This seems to be too much concern about how to manage your personal scripts and programs. One is never perfect at the outset, you'll likely devise another scheme as you move forwards in how you set up your systems. Do what works for you and don't worry about what everyone else does.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
C program: append variable in middle of string justwantin Programming 3 02-17-2020 09:26 AM
Append directory path to FNs over entire directory structure ericlindellnyc Linux - Newbie 16 10-29-2019 09:43 PM
os.path and sys.path.append vysero Programming 4 06-12-2018 07:27 PM
script to change unix path to windows path in all files csross Programming 8 04-29-2006 01:05 PM
Append the windows path with Samba login script ?? amitsharma_26 Linux - Networking 2 09-29-2005 10:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration