What is the appropriate directory to store scripts and their output?

1.8k Views Asked by At

What is the most appropriate folder to store both scripts and their output (some txt files) on linux os? The scripts and their directory need to have 755 permission.

Is there an appropriate directory, that already exists, for that purpose or where should I create one?

2

There are 2 best solutions below

0
On

The typical directory for the scripts is ~/bin, which needs to be created. Do not mix scripts and output! The output files should be stored separately, in directories named according to the naming convention that suits your work best. Often, these directories are named per project, and there is more than one such directory. The directories can be named, for example, ~/prj_name/in and ~/prj_name/out for input and output, respectively. But there is no convention for those.

0
On

$HOME/.local/share is the right place for data according to the XDG Base Directory Specification:

$XDG_DATA_HOME defines the base directory relative to which user specific data files should be stored. If $XDG_DATA_HOME is either not set or empty, a default equal to $HOME/.local/share should be used.

I've also seen ~/.local/bin used for binaries by homebrew. I'm not sure if this is defined in a spec anywhere.