-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathloading-and-storing-user-executables-guide.txt
52 lines (37 loc) · 2.54 KB
/
loading-and-storing-user-executables-guide.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
A guide for loading and storing user executable files with the Unix methodology
===========================================================================================================
=======================================
Loading
=======================================
There are few different areas of the GNU/Linux operating system to consider when loading executable files (e.g.
scripts). These include coniguration files in /etc, /usr, systemd files, etc.
There are only two files the user should consider for loading user executable files:
1. The bash profile file (.bash_profile) - loaded for a login shell
2. The bash runtime configuration file (.bashrc) - loaded for an interactive non-login shell
The variable defined in these files that loads user executable files is the PATH environment variable. Only it,
aliases and functions are used to load user executable files.
The main difference between defining the PATH environment variable in .bash_profile and .bashrc is how the
executable files defined in it are accessible in the X Window System. Executables defined in the PATH environment
variable in .bash_profile will be available within the entire X Window System protocol (i.e. throughout the window
manager, in other applications, new processes, etc.). Executables defined in the PATH environment variable in .bashrc
will be available only in the terminal.
=======================================
Storing
=======================================
Just as there are only two files the user should consider for loading user executable files, there are only two
directories to consider for storing user executable files:
1. /usr/local
2. /home/<user>
The context level of these directories almost correspond with the context level of .bash_profile and .bashrc,
respectively. /usr/local is a system-user-wide directory just as .bash_profile is a system-user-wide file. As a
result, executable files defined in the PATH environment variable in .bash_profile should be stored in /usr/local/bin.
/home/<user> is a user-wide directory just as .bashrc is a user-wide file. As a result, executable files saved in the
PATH environment variable in .bashrc should be stored in /home/<user>/bin.
Finally, to stay completely consistent with the Unix philosophy, the user must create the following Unix directory
filesystem in /home/<user> and place files in their respective directory. This directory filesystem is as follows:
* /home/<user>/bin
* /home/<user>/tmp
* /home/<user>/var
* /home/<user>/etc
* /home/<user>/share
* /home/<user>/lib