What are your favorite bash aliases?
I use a lot of bash aliases on a daily basis! I love the fact that you can bundle commands and actions behind a single alias and improve your productivity with such simple steps!
Here are my favorites:
# ------------- MAINTENANCE ALIASES ---------------- alias update='sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get dist-upgrade -y && sudo apt autoremove -y' # --------------- PHP/NPM ALIASES ------------------ alias artisan='php artisan' alias serve='php artisan serve' alias unit='./vendor/bin/phpunit' alias unitwatch='./vendor/bin/phpunit-watcher watch' alias coverage='php -d pcov.enabled=1 ./vendor/bin/phpunit --coverage-html coverage' alias cov-watcher='php -d pcov.enabled=1 ./vendor/bin/phpunit-watcher watch --coverage-html coverage' alias prod='npm run prod' alias dev='npm run dev' alias watch='npm run watch' # ----------------- GIT ALIASES -------------------- alias status='git status' alias add-all='git add .' alias gpm='git pull origin master' alias push='git push origin' alias pull='git pull origin' alias switch='git checkout' alias remove='git branch -d' alias branches='git branch' alias tags='git tag' alias create-tag='git tag -a' # ----------------- FILE ALIASES ------------------- alias editrc='nano ~/.bashrc' alias applyrc='source ~/.bashrc'
What are yours?
Top comments (26)
I use Ubuntu -- I have a
~/scriptsdirectory, where I put useful scripts. I then alias these for quick use.
Here's a shortcut to open any VSCode workspace saved in
I also have a git-versioned folder for notes in markdown. I like to create a file for daily notes, so I have
notealias and script to create/open that file:
That's definitely something I should do! Such great ideas, thank you for these!
This one is my favorite. I use conda environments and switch between them many times per day. It pipes a list of available environments into fzf, trims out just the name then runs source activate on it.
Good topic Roelof!
I've got some similar ones, with one minor difference:
This makes it so that my
.bashrcis sourced right after I finish editing it!
I've also got a few convenience functions for common operations:
And some conda specific ones:
Oh I'm definitely adding those first three! They cover about 99% of my manual actions automatically, great aliases!
The tab completion I'm not familiar with, but that does look like some amazing productivity hacks!
Not too many, as I move around between systems quite a lot. The couple I can't do without are:
And to help with finding large directories/files:
100% adding those to my list!!
git-amna lot to reword the last commit or append some hunks
My favourite function which I use a few times a year to study codebases for fun and profit 😉
I'm adding that amend alias to my list too, that's great! That method is really cool and takes care of so much manual work! Productivity 😅
Some generic aliases I use often
For updating xrdb resource definitions quickly
For navigating to common directories
For quickly editing configs I touch frequently
Those are different than mine, but definitely have the same idea! I haven't posted them here, but I have a lot of "cd" like aliases and "edit file" commands in there as well! Very useful aliases, nice!
alias? I use bash files to run commands like alias.
sudo chmod +x hello
And these're my fav:
That's a good idea as well! Perhaps a cleaner solution as well. I like aliases because I can add them to my setup bash script for new systems, append them to the .bashrc, source it and I'm good to go! I'll definitely look into your solution though, because that sounds very clean and allows for much more complex workflows as well.
I have replaced a few of my aliases with forgit. a package of several really good fuzzy git commands.
ga -> git add
That's a cool solution! I've seen many people use the ga command as well and always assumed it was manually done through aliases. This takes the manual work out of it, very exciting!
I actually had a set of fzf commands that I had made personally that this replaces as it is way more engineered and robust than what I came up with.
Your idea for alias sharing is great! Thank you all of you!
I personally use:
Nice shirt ones! Probably helps a lot with your productivity as well!
Made this repo,few months ago.
Wow that is amazing! So clean and well documented, great job!
to launch my Angular local dev server. 😄
Short but sweet, I love it!