Command line tips for OS X and Linux
I have a few command line tricks that save me a lot of time that are worth sharing:
- Use a pattern like history | grep rsync to quickly find recent commands. Much better than wading through your history.
- Make aliases for accessing services on specific servers for example alias kb2_mongo='mongo xxx.xxx.xxx.xxx:11222'. By having consistent naming aliases for your servers and for running specific services like the mongo console, it is easy to both remember your aliases and use them.
- Create aliases with consistent naming conventions to ssh to all of your servers. I use different prefixes for my servers and for each of my customers.
- Create an alias like alias lh='ls -lth | head' to quickly see just the most recently modified files in a directory, most recent first.
- For your working development system create two letter aliases to get to common working directories (most recent projects, writing, top level code experiment directory, etc.). I try to be consistent and use some of the same aliases on my servers.