tags:

views:

1833

answers:

7

In the linux file system, where should user scripts be placed?

I'm thinking specifically python scripts to be called by cron.

+10  A: 

If you're talking about scripts created by a user that will be run from that users crontab, I typically put those in either a bin or scripts folder in the home directory, or if they're intended to be shared between users, a /usr/local/scripts directory.

Matt McMinn
+3  A: 

I'm a strong beleiver that if a file is made by a user, it goes in his user directory (/home/username) if he didn't make it then it gets more complicated. I have in the past just put them in either /usr/local/bin, /bin, or /usr/local/scripts, I'm not sure about etch, but you need to check to make sure that /usr/local/scripts is actually in Cron's $PATH.

icco
A: 

You can also add paths to your crontab file as shown in a previous cron-related question.

Judge Maygarden
+1  A: 

How about /home/username/bin?

Add ~/bin to $PATH and make the script executable with chmod +x filename.

Peter Stuifzand
+1  A: 

personally I prefer

/home/username/.bin

This way the bin folder is hidden but you can still add it to the PATH and execute all scripts with the x-bit inside.

I like my home directory to be clean (at first glance) with very few folders.

Mo
+2  A: 

For whom it interests, the Filesystem Hierarchy Standard (FHS) is a standards document and still a very good read. I describes the foundation for almost any Linux distribution and is officially endorsed e.g. by Debian and the Linux Standards Base (LSB).

You won't find any positive answer for that question, though, since ... it's not defined ;-). Only thing I can say: Don't put in /bin (neither in /usr/bin). /usr/local/scripts is unusual as well. $HOME/bin seems to be an acceptable place, iff the script is only used by this single user.

flight
+1  A: 

This response is a little late; however the Debian guide is quite useful when it comes to Ubuntu.

"Normally, programs install themselves in the /usr/local subdirectories. But, Debian packages must not use that directory, since it is reserved for system administrator's (or user's) private use"

http://www.debian.org/doc/maint-guide/ch-modify.en.html

/usr/local/bin seems to be acceptable according to debian's guide.

Personally I put my scripts in $HOME/.scripts

I wish that LSB would specifically address the parent posters question.

pete