News for hackers. Stuff that matters.
Re:Ask HN: Best things in your bash_profile/aliases? by the_jeremy on Monday January 14, 2019 @12:07PM (#18904469)

    #~/.inputrc is for nerds who don't want 1000-line bashrcs
    #C-w deletes previous word (by spaces) by default
    #bind C-q to delete previous word-segment instead of "start(?) term output"
    stty -ixon
    bind '"\C-q": backward-kill-word'
    #bind C-s to move cursor to previous [:space:] instead of "stop(?) term output"
    bind -r '\C-s'
    bind '"\C-s": shell-backward-word'
    #bind C-d to go forword, not crush the shell
    set -o ignoreeof
    bind '"\C-d": shell-forward-word'
    #miscellaneous useful inputrc binds
    #bind shift-tab to 'see how the next autocomplete option would look on the cmd line'
    bind '"\e[Z": menu-complete'
    #don't make me hit tab twice to see multiple completion options
    bind "set show-all-if-ambiguous on"
    bind "set show-all-if-unmodified on"
    #multi-complete shows filetypes by colors
    bind "set colored-stats on"
    #ellipsis at 3+ common characters with multi-complete
    bind "set completion-prefix-display-length 3"
    if [[ "$__os" == "mac" ]]; then
        #tab complete is no longer case-sensitive? interesting...
        bind "set completion-ignore-case on"
        #tab complete is not -_ sensitive.
        bind "set completion-map-case on"
    fi
    #vim mode is actually a super pain compared to emacs on the command line.
    set -o emacs
    #C-n/p now do double duty, so this is like the best of all 3 worlds? I'll take it
    bind '"\C-p":history-search-backward'
    bind '"\C-n":history-search-forward'
    

    #makes aliases work with sudo
    alias sudo='sudo '
    #use sudo -i to become root and keep your bashrc & vimrc
    alias -- -i='-E bash --rcfile $HOME/.bashrc'
    #can't get it to work when becoming other users. sucks to suck.
    alias apt-get='sudo apt-get'
    alias systemctl='sudo systemctl'
    alias sc='sudo systemctl'
    alias scr='sudo systemctl restart'
    alias firewall='sudo firewall-cmd'
    alias fw='sudo firewall-cmd'
    alias yum='sudo yum'
    alias yumy='sudo yum install -y'
    alias py='python'
    # b/c sed needs i with an empty string on Mac to properly in-place
    alias sd='sed -i"" -e'
    #alias ugh = sudo !!
    alias ugh='sudo $(history -p !!)'
    # -a: dotfiles. -I: not those dotfiles. -C: color.
    alias tree='tree -a -C -I ".git"'
    #tries to force color: (G):BSD; (--color):GNU, adds / after dirs, * after execs, etc (F);
    #and human readable sizes (h)
    alias ls='ls --color -GFh'
    alias la='ls --color -GFhla'
    alias cd.='cd ../'
    alias cd..='cd ../../'
    alias cd...='cd ../../../'
    alias cd....='cd ../../../../'
    #is it running? sometimes you need all the args (i.e., for java processes) to fully grep
    psg() {
        ps -ef | grep -i $* | grep -v grep || \
        ps -efwww | grep -i $* | grep -v grep
    }
    alias g.='grep '\''.'\'' -IrnHe'
    alias f.='find . -name'
Re:Ask HN: Best things in your bash_profile/aliases? by axelrosen on Tuesday January 15, 2019 @09:02AM (#18911139)
I'll just add two more systemctl aliases I got

  alias scs='systemctl status'
  alias jc='journalctl --unit'