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?
Oldest 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.I'm not the biggest fan of aliases because if you move to a different workspace you're going to have to use the original command and you might forget it
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.
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
Useful git history (I absolutely ❤️ this one):
Clean up stray docker containers/images (it's a personal script not an alias):
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!)alias dc="docker-compose"
alias c=clear
alias b=cd..
alias zshrc='vim. zshrc && source ~/. zshrc'
alias ypx='yarn run'
FYI, you can use Ctrl+L in most shells to handle screen clearing, and would allow you to free up 'c' for another action. Also doesn't require an enter key press!
I don't use many aliases, but I have replaced ls with exa. It's got saner defaults and great options for neat behaviour like grouping directories first, changing sorting mode, and respecting .gitignore and showing git status in long-form mode.
I use ‘lan’
ifconfig | grep ‘inet ‘
To get my ip address
ip a | grep ‘inet ‘
On latest debian releases
function rm --description 'alias rm rm -rf'
command rm -rf $argv;
end
Wouldn't recommend it to anyone though.
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