I have this line in my
alias cdtmp='cd `mktemp -d /tmp/frantic-XXXXXX`'
It’s a super simple alias that creates a temporary directory and then jumps into it. Here are a few examples of what I use it for:
- Clone a random interesting git repo to experiment with
- Fiddle with Flow:
cdtmp && flow initand I have a working environment to narrow down a bug
- Play with unfamiliar node modules:
cdtmp && yarn add xyz && node
cdtmp is partially a mental trick I use to reduce the barrier for trying new things and experimenting. I no longer need to make a name for my project or decide which folder to create it in. I also don’t have to deal with it later if I consider it not worth paying attention to anymore – the OS will clean it up at some point automatically.