All things bash: some of my most used alias 

Published 2018-02-26 on flowinho.io

category | code programming macos linux terminal git bash

Since starting my work as a professional iOS developer i’ve become more and more fond with just using the terminal. Wether it’s a ninety-days git-via-terminal challenge or simply trying to become a keyboard-ninja: there are things only the terminal can do.

In 2016 i’ve open-sourced my bash-config and i want to use this opportunity to highlight some of the commands inside it.


Quickly toggle hidden-files visibility in finder

# macOS Control
alias show_hidden_files='defaults write com.apple.finder AppleShowAllFiles YES && killall Finder'
alias hide_hidden_files='defaults write com.apple.finder AppleShowAllFiles NO && killall Finder'

Every so-often you’ll need access to some hidden files not inside the terminal, but inside finder. However some of macOS commands are just plan hard to remember and googling this things every time i needed this toggle just made things unnecessary hard.


Rapid archive + sync

# Archiving
alias tarball='tar -cvf' # outputfilename + directory to tar
alias sync='rsync -azvhW --progress'

Since i replaced public clouds with physical drives and Seafile Pro i ran into the task of quickly moving and/or synching large directories between multiple sources and destinations. These (chainable) commands speed things up a bit.


Quickly exhanging an AES 256 encrypted file with someone else

alias encryptFile='gpg --symmetric --cipher-algo aes256 --digest-algo sha256 --compress-algo none -z 0 --armour' # file name need to be specified

“Please send me that sensitive file via Slack.”   Note: Requires GPG Tools to be installed.


Gimme a 3GB ramdisk

alias ramdisk='read -p "GB size for RAMdisk: " answer && sudo diskutil erasevolume HFS+ "ramdisk" `hdiutil attach -nomount ram://$(( $answer * 2097152))`'

Some file-r/w actions just should not happen on a physical disk. This alias prompts for a ramdisk size in GB, formats and mounts it.


All things GIT

## GIT Command substitution
alias gBranch='git branch -a -v -v'
alias gFetch='git fetch && git branch -a -v -v'
alias gTree='git log --graph --oneline'
alias gTreeFancy='git log --graph --pretty=format:"%C(yellow)%h %Cred%ad %Cblue%an %Cgreen%d %Creset%s" --date=short'
alias gListTags='git log --date-order --graph --tags --simplify-by-decoration --pretty=format:"%ai %h %d"'

GIT command-line syntax is just stupid. And sometimes, i need a colorful network-list of all commits in the repo. :)

A gift from my side: .vimrc

syn on
set incsearch
set tabstop=4
set showmatch
set autoindent
set nocindent
set backspace=2

If you got any additional ideas on awesome terminal alias, feel free to reach out to me! I’m happy to learn.
{"cc_re__cc_re__cc_by_sa_4_0": ["  my professional life, summarized\n                  </div>\n        <div class=\"post-stub\">\n          <a href=\"https://myscotty.com\">myScotty</a>,\n          cross-plattform mobility-sharing\n        </div>\n\n        <div class=\"post-stub\">\n          <a href=\"http://audiodump.de\">Audiodump</a>,\n          a podcast about Apple, tech and philosphical questions of all kind\n        </div>\n\n        <h3>License & Legal</h3>\n        <p style=\"font-size: 10pt\">\n        The content for this site is\n        <a href=\"http://creativecommons.org/licenses/by-sa/4.0/\">CC-BY-SA 4.0</a>.\n        The <a href=\"https://github.com/flowinho/flowinho.com\">code</a> for this site is\n        <a href=\"https://github.com/flowinho/flowinho.com/blob/master/LICENSE\">GPL3</a>.  <br />Share-buttons are\n        implemented using <a href=\"https://github.com/heiseonline/shariff\">Shariff</a>.\n        <br /><br />\n        <a href=\"https://flowinho.io/imprint/\">Imprint</a>\n        <br />\n        <a href=\"https://flowinho.io/data-policy/\">Data policy</a>\n        </p>\n        <p style"], "copyright__copyright__copyright": ["lue%an %Cgreen%d %Creset%s\" --date=short'\nalias gListTags='git log --date-order --graph --tags --simplify-by-decoration --pretty=format:\"%ai %h %d\"'\n\nGIT command-line syntax is just stupid. And sometimes, i need a colorful network-list of all commits in the repo. :)\n\nA gift from my side: .vimrc\n\nsyn on\nset incsearch\nset tabstop=4\nset showmatch\nset autoindent\nset nocindent\nset backspace=2\n\nIf you got any additional ideas on awesome terminal alias, feel free to reach out to me! I\u2019m happy to learn."]}