Ask DN: Favorite bash_profile aliases?
over 7 years ago from David M, UI Developer
would love to see em! As always, thx DN :)
over 7 years ago from David M, UI Developer
would love to see em! As always, thx DN :)
the ones i use the most:
gs = git status
git c = git commit -m
be = bundle exec
npmsucks = rm -rf node_modules/ && npm install
npmsucks = rm -rf node_modules/ && npm install
this is the best
hahaha...I definitely used "rm -rf node_modules/ && npm install" too many times.
+1 for that last alias hahaha
npmsucks Hahahahaha
Second that gs = git status one! Easily my most used alias
This is for Friday when it's time to go home.
alias gityolo='git commit -am "DEAL WITH IT" && git push -f origin master'
Not an alias, but I find it super useful and some of you may too. When you run a command that requires sudo and you forgot to add it, you can simply do this:
sudo !!
It will prepend sudo to your last command.
Some context - The !!
is replaced with the previous command.
alias g="git"
alias ls="ls -Glaph" (I forget what all the options are but makes it more human-readable and one of the options lets syntax highlighting come through)
This is bomb!
Oh, wow. Thank you so much for ls -Glaph. I didn't know it could do that.
I’ve got the same, with an additional benefit:
ls -GlaphO
This includes a column showing file attributes like Hidden, Restricted, etc
I'm using oh-my-zsh
with plugins like rails, brew, git and so on, but I am using rs
(For rails server) the most. After that: bi
For bundle install.
This is one of my favorites. It is a bash function that will Base64 encode any image and copy it to the clipboard:
function base() { base64 -o ~/Desktop/base64.txt -i "$@" pbcopy < ~/Desktop/base64.txt rm -Rf ~/Desktop/base64.txt }
To run the command do this: base ~/path/to/file.jpg
. Will Base64 encode JPG, PNG, and SVG.
Surely you could just use this?
function base() { base64 -i "$@" | pbcopy }
LOL. Probably. Good call.
alias f*cking="sudo" alias mfind="spotlight" alias webserver="ifconfig | grep inet; python -m SimpleHTTPServer" alias quicklook="qlmanage -p" alias f*ckoff="killall -9"
</code
not an alias but I use ls -lrt a lot to see last added files lls = ls -l |awk '{print $9}' // prints a straight file list
lls > filelist.txt
A lot of good ones in here: https://github.com/mathiasbynens/dotfiles and extra goodies, such as better bash prompt and some neat functions.
Wow...had no clue I would get such a great amount of responses! Thank yall so much...good to see this community is still very much alive (and full of funny, good people)
be nice
alias please=sudo
alias hosts='sudo $EDITOR /etc/hosts'
list only directories
alias lsd='ls -l | grep "^d"'
cat
with beautiful colors. requires Pygments installed
alias c='pygmentize -0 style=monokai -f console256 -g'
undo a git push
alias undopush="git push -f origin HEAD^:master"
fucking = sudo
Some of my favorites:
_=sudo biggest='find -type f -printf ''\''%s %p\n''\'' | sort -nr | head -n 40 | gawk ''{ print $1/1000000 " " $2 " " $3 " " $4 " " $5 " " $6 " " $7 " " $8 " " $9 }''' cdf='cd "$(pfd)"'
pdf is:
pfd () { osascript 2> /dev/null <<EOF tell application "Finder" return POSIX path of (target of first window as text) end tell EOF } pumpitup='osascript -e ''set volume 10''' sl=ls stfu='osascript -e ''set volume output muted true'''
# when bluetooth randomly stops working alias f*ckbluetooth='sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport && sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport' # current git branch alias currentbranch='git symbolic-ref --short HEAD'
I'll link to my bashrc for anyone looking at how to setup some of this stuff.
gs
for a pretty version of git status
gc
for quick committing with git..
to quickly back out of the directory your inz
for quick directory traversal with fasdup
which updates various things that I do not care to remember to update like homebrew, npm, vim-plug, etc. Check out the link above or look at line 116 as it shows the meta part of it.The first thing I do when I move to a new Mac is to install Prezto. Always felt it to be easier than oh-my-zsh. Comes with a lot of plugins and modules.
Designer News
Where the design community meets.
Designer News is a large, global community of people working or interested in design and technology.
Have feedback?
Login to Comment
You'll need to log in before you can leave a comment.
LoginRegister Today
New accounts can leave comments immediately, and gain full permissions after one week.
Register now