As a pentester, I have to deal with many different custom scripts I write, my coworkers write, that I get off Github. Remembering where scripts/tools are when you may only ever touch something very rarely can become very annoying to manage. I've come up with a system that works very well for me. Perhaps it will work for you as well.
~/projects/
- My overall projects folder that contains both git repos as well as temporary project ideas that may turn into something later. Contains many different directories that are project or task focused.
- For example, ~/projects/python-code/ is where I store my one-off Python code snippets to experiment and remind myself of concepts.
- This is also where I store project directories that don't have corresponding git repos. Zips, tars, etc from directly downloaded servers.
~/projects/git/
- If it has a repo, this is where it's cloned. Whether it's personal git repo or other's repo, any and all git repos go here. This makes it easier to remember what I got from where, and run a quick git pull.
- This is also where I initialize any repo I plan on adding to my github account
~/scripts/
- These are almost all one-off scripts used for various tasks, or to glue some disparate tools together.
- For example, it contains scripts that parse output from one tool and pass it to another. Nothing groundbreaking here, just saves time typing.
- Most importantly, this directory is added to my path so every script/symlink can easily be accessed at the command line.
- This is where I symlink all my git tools so I don't have to supply full paths to reach them
~/tmp/
- Yes, it's a temp folder off my home directory, I know how weird that sounds.
- It's specifically for files I need very temporarily but I don't want to lose them if my machine crashes. It's mostly used for debugging/troublshooting scripts or testing shell functionality.
- I go through it about once a month and remove anything I can't remember.
This setup has served me very well. I'd say the biggest paradigm shift for myself was to get in the habit of symlinking certain git tools and project scripts in the ~/scripts directory which is in my path; the integration of repo -> my machine is seamless.
Caveat:
If someone writes a shitty script that breaks if you call it from another directory then I just write a quick one-line script to call it instead of a simple symlink. Still, fairly seamless.
Bonus Tip:
I also can't stress enough the benefits of backing up everything to a drive and then wiping out your box and starting from scratch. Yes it's annoying to reinstall so many applications, but things run smoother with fewer errors because many superfluous packages/configs are gone. You won't lose any files since you can just browse them from your backup drive.