Basic command line productivity tricks and learning experiences
2016-04-06
- dd deletes line in vim
- Ctrl+d scrolls down in vim
- Learn to love your package manager. Homebrew, NPM, gem, cpanm, gvm/sdkman,
etc. these all do amazing things
- Once you learn bash, try zsh and oh-my-zsh, they have things like
case-insensitive tab completion
- Don't make scripts that hardcode paths, make reusable command line scripts.
Use bash as your "REPL", not R.
- git log -p helps analyze your log files in full details (make sure
autocoloring is turned on in your terminal)
- There are keys to jump forward and backwards on the command line text editor,
learn them...don't scroll one char at a time
- Learn how "PATH" works. Generally it is just a set of directories connected by
":" separators. You can add things to the path by saying "export
PATH=$PATH:/new/directory/to/add" and you can add this to ~/.bashrc for
example
- When your install process for a command line tool seems like nonsense, try
homebrew instead. barring that, learn PATH, and how to run "make install",
etc. Most of your headbashing from installing programs is 90% can be explained
by not understanding how the developer is intending it to be used, 10% of the
tool's install process being wrong
- Get a static analyzer and basic tests going on your codebase and run it on
travis-ci. Getting started with travis-ci is kind of a learning curve, but it
is worth it
- Use cpanm instead of cpan for package management
- Vocabulary learning curve: catalina is the same thing as tomcat. CATALINA_HOME
is the same thing as the tomcat folder
- alias ll="ls -l", because I type "ll" hundreds of times a day.
- For irc productivity, run irssi on a server in a "screen" e.g. "screen irssi"
and then you can come back to conversations later by just logging into the
server with ssh
- Edit ~/.ssh/config to include your hostnames so you don't have to type out
long ssh commands
http://nerderati.com/2011/03/17/simplify-your-life-with-an-ssh-config-file/
- Use spaces instead of tabs in your source code (>:( yes I think this is the
one true way)
- Try out nodejs and browserify in your spare time to make a "npm" based app in
the browser. it's fun.
- Similarly, try making a simple "api" endpoint on the server side with
express.js or similar. can get started very quickly.
- Learn how to get a mindset of writing tests. You can write tests proactively
(i.e. Test driven development), but you can also write them "reactively" too
(i.e. if have a bug that you fix, you can make a test to make sure this
doesn't happen anymore)
- Similar to above, tests in this sense are more "sanity checks" than they are
formal proofs. Take "assert" logic and "debugging" code out of main codebase
and put them in tests
- Minimize comments in your code, and also don't comment out code and leave it
present. Find a way to delete it and move on!
- When you have a bunch of .orig files after doing a git merge, just use git
clean -f to get rid of them. Similarly, to get rid of everything, including
things in your gitignore file (i.e. a super clean) use git clean -fdx. It has
a --exclude argument too