Ask DN: Favorite bash_profile aliases?

over 1 year ago from , UI Developer

would love to see em! As always, thx DN :)

27 comments

  • Matt SistoMatt Sisto, over 1 year ago (edited over 1 year ago )

    the ones i use the most:

    gs = git status

    git c = git commit -m

    be = bundle exec

    npmsucks = rm -rf node_modules/ && npm install

    21 points
  • Joe BlauJoe Blau, over 1 year ago (edited over 1 year ago )

    This is for Friday when it's time to go home.

    alias gityolo='git commit -am "DEAL WITH IT" && 
      git push -f origin master'
    
    6 points
  • Daryl GinnDaryl Ginn, over 1 year ago (edited over 1 year ago )

    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.

    5 points
  • Matthew CriderMatthew Crider, over 1 year ago (edited over 1 year ago )

    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)

    4 points
  • Dominik SchmidtDominik Schmidt, over 1 year ago

    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.

    3 points
  • Jonathan SimcoeJonathan Simcoe, over 1 year ago

    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.

    1 point
  • Laurens SpangenbergLaurens Spangenberg, over 1 year ago (edited over 1 year ago )

    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

    1 point
  • Stephen WayStephen Way, over 1 year ago

    I'll link to my bashrc for anyone looking at how to setup some of this stuff.

    My top 5 are

    • gs for a pretty version of git status
    • gc for quick committing with git
    • .. to quickly back out of the directory your in
    • z for quick directory traversal with fasd
    • up 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.
    0 points
  • Juan OlveraJuan Olvera, over 1 year ago (edited over 1 year ago )

    be nice

    alias please=sudoalias 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"

    0 points
  • Charlton Roberts, over 1 year ago (edited over 1 year ago )
    # 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'
    
    0 points
  • Dan Charlesworth, over 1 year ago
    fucking = sudo
    
    0 points
  • Conlin DurbinConlin Durbin, over 1 year ago

    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'''
    
    0 points
  • David M, over 1 year ago

    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)

    0 points
  • Razvan HRazvan H, over 1 year ago

    A lot of good ones in here: https://github.com/mathiasbynens/dotfiles and extra goodies, such as better bash prompt and some neat functions.

    0 points
  • Karthik KKarthik K, over 1 year ago

    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.

    0 points
  • DC Crowley, over 1 year ago (edited over 1 year ago )

    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

    0 points