I realized that I have a bunch of CLI go to commands and aliases that speed up my productivity and was wondering what others use.
A few of my favs:
-
history | grep 'something'
- for finding a command I ran in the past -
zz
- opens up ~/.zshrc for editing -
wpd
- uses my local PHP version to run WP CLI so I can use XDEBUG on the CLI
What are your aliases and CLI goto productivity commands?
Top comments (24)
For a more compact git history:
To easily pipe into and out of my clipboard on the terminal:
I actually use this a lot to pipe, for example, GPG output directly into the clipboard and then paste it into some GUI application.
pstree -s $$
to show me the path from PID 1 to my current shell. This is really useful when you often start shells from within shells to manage context.I also have aliases like
This way I only have to type
server
and I get a persistent serssion that lasts until server restart, that I can detatch from easily with Ctrl+D and reattach by just callingserver
again.Other than that, I have more than 1k lines in my .vimrc, so I will just leave a link to that instead of telling you about everything it does ;)
I use
tmux new-session -A -s session-name
. It will create the session if it doesn't exist and reattach if it does exist.Instead of
history | grep 'something'
, you can just use Ctrl+R to search your history. I use zsh + prezto which adds sub-string search.+1. Also, when you've narrowed the search, you can continue hitting Ctrl+R to navigate backward in time, through all the commands that match.
I'm sold if you can tell me a way to get back to exactly where I was when I started after I find what I need.
IIRC, you can press tab and that will dump your cursor at the end of the line, once you've found the command you want.
npr
: Run Node scripts in package.jsonvi-s
: As inVim session
to resume my work on a project using neovim.pomd
: Starts a tmux session named pomodoro or creates one if it doesn't. I used it to track the time on my working session.pmd-start
: Is what start the working session using this handy tool.dcc-up
: Starts docker compose in detach mode.dcc-down
: Stops docker compose.Another handy tool for searching that I recommend is fzf.
ripgrep + fzf + Ctrl-R to search is the bee's knees.
Awesome find with
gone
. I'm gonna have to add that to my arsenal (no more browser tab pomodoro!)Some of my
.bashrc
aliases:The git shorthands above are actually kind of a lie; I actually have a (probably unnecessarily) complicated couple of bash functions, supported by a python script that parses
git status
output and assigns a number to each changed file, to allow easier shorthands.gs
showsgit status
with the numbers inline before each file, thenga
andgd
will accept those numbers as arguments, so I can doga 3
to stage the 3rd modified file for commit orgd 3
to show the diff for that file. Maybe I'll write a post about those functions at some point so someone can show me how to improve them...Which roughly translates to
pt
= Integration + Unit Tests,dt
= tests that uses a real browser (IDK the correct term for this) andtest
= run the whole suite.I use
i3wm
andfish-shell
, so I aliased:So that VSCode opens up immediately to edit those files whenever I need.
I also really like the Git-bare approach to syncing Config-files, so I have
I'm using macOS, not sure if things work in other UNIX environments (esp.
pbcopy
/pbpaste
are macOS-specific), and some commands require external tools like Node.js or PHP to be installed.At the beginning of the year I broke my arm and was forced to type one handed for 3 weeks. It was ROUGH but because of it I now have a list of super simple 2 letter aliases which I still use :D
Useful git history (I absolutely ❤️ this one):
Clean up stray docker containers/images (it's a personal script not an alias):