Your /home should be on a different partition then your system partition and so should you /tmp so you dont get system locked if you accidentally forget to cleanup docker.
Always create "root" folders in your home directory that reflect the domain your code is uploaded to (ie. github.com, etc).
- For local development just create a folder that's
~/$USER.dev
or similar. - For tests just use
~/$USER.dev/lab
In your home directory create a ~/.tools
directory and place any sort of tooling, install scripts and so forth there.
It's not always simple but its very convenient to just stick anything you might need in it whenever you need it.
- eg. need to install pnpm? createa a
~/.tools/install/pnpm
script and run it, that way you never have to worry about it - eg. need to authenthicate with some complicated k8s thing? create a
~/.tools/kubectl/connect/the-name-of-the-thing
This simple form of organizing will make it very intuitive to find things since things will be organized by their origin and not just stuck on the system randomly, it also makes it easier to figure out "where you are" since if you open a project and the root of the project is github.com then you're likely looking at a github hosted project.
It's not recommended to necesarily follow the folder structure of the source after that, instead try to create a short as possible path structure. It's just not feasible to keep the source path structure intact and it also changes over time so it's just all demerits and no benefits. Also deep hirarchies are hard to manage and reason.
Create a ~/.bashrc.$USER
and place all your settings there instead of in the global .bashrc
; just remember to add
a source ~/.bashrc.$USER
to your global file.
In your ~/.bashrc
file have something like this at the end:
##################################################################################
# include our own settings
source ~/.bashrc.$USER
source ~/.bashrc.containers
##################################################################################
Why this verbose? Because a lot of things will concatenate on this file so it's better to know what is system default and what is random nonsense other installers added, and of course, what is your own stuff.
Some useful settings to have:
PATH=$PATH:~/.local/bin
# double line terminal
PS1='📑 \[\e[0;32m\]\w\[\e[m\]$(__git_ps1)\n\[\e[0;33m\]\u\[\e[m\] @ \[\e[0;31m\]\t\[\e[m\] → '
# human usable ls
alias ls="ls --color=auto -h --group-directories-first"
# human usable tree command
alias tree="tree -C -A --dirsfirst"
# sane looking tabs
alias nano="nano -c -T 4"
export KUBE_EDITOR="nano -c -T 4"
# git shortcuts
alias gits="git status -s"
alias gitd="git diff"
alias gitds="git diff --staged"
alias gitdc="git diff --staged"
alias gitl="git log --oneline --stat"
# optouts
DOTNET_CLI_TELEMETRY_OPTOUT=1
You can just as easily create a ~/.bashrc.containers
file and stick in it anything you wish to run as container in the system.
## MySQL
## =====
# start mysql
docker start mysql57 &>/dev/null
# mysql shortcuts
alias mysql="docker exec -it mysql57 mysql"
# start phpmyadmin
docker start phpmyadmin &>/dev/null
## ScyllaDB
## ========
# start scylla
docker start scylla &>/dev/null
# scylla shortcuts
alias nodetool="docker exec -it scylla nodetool"
alias cqlsh="docker exec -it scylla cqlsh"
## Memcached
## =========
# start memcached
docker start memcached &>/dev/null
It's much better however if projects you work on have these as part of the project features (ie. helper dev scripts) rather then relying on your system since a project for example might use mysql8 and another might use postgres and another might use mysql57.