Ask HN: (2018) What are some of your favorite Unix command line aliases?

2 points by natch ↗ HN
By which I mean either aliases or short bash functions.

Examples:

# download a video from YouTube or other major sites, recoding if needed into .mp4 format

  alias yt='youtube-dl --recode-video mp4'
# empty the pasteboard (macOS only) [edit: fixed description]

  alias pbclear='echo "" | pbcopy'
# remove formatting from text in pasteboard (macOS only)

  alias pbclean='pbpaste | pbcopy'
# remove a directory even if it contains .DS_Store files (macOS specific)

  function rmdir() {
      [[ -e "$@/.DS_Store" ]] && /bin/rm "$@/.DS_Store"
      /bin/rmdir "$@"
  }
# go to the "Feeling Lucky" result for a Google search

  lucky () { open "http://www.google.com/search?hl=en&q=`echo $* | sed "s/ /%20/g"`&btnI"; }

2 comments

[ 3.0 ms ] story [ 18.4 ms ] thread
some small ones I use.

alias x="xdg-open"

alias update="sudo apt-get update; sudo apt-get upgrade"