Skip to content

Instantly share code, notes, and snippets.

@edmangimelli
Last active July 21, 2020 13:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edmangimelli/9bbd45536fb1dddb96d5160886d3d157 to your computer and use it in GitHub Desktop.
Save edmangimelli/9bbd45536fb1dddb96d5160886d3d157 to your computer and use it in GitHub Desktop.
# ls aliases
#
# in the context of the current directory
#
# l list everything
# ld list just the directories
# lf list just the files
#
# ^^^ these can be coupled with some modifiers.
# modifier examples:
#
# lf-h "list files minus hidden ones"
#
# ldh "list directories that are hidden"
#
# you could also write:
#
# lhd "list hidden directories"
#
# l-hf "list non-hidden files"
#
# add a trailing 't' to print in table view (multiple columns)
#
# lt "list everything in table view"
#
# lhft "list hidden files in table view"
#
# ltd-h "list, in table view, directories that are not hidden"
#
#
# FAQ:
#
# Does this make the unix util `ld` inaccessible?
# -- Finally!
#
# Hey these are aliases --will they work if I pass in some args?
# -- Mostly no ;D
#
# What's the equivalent of a bare `ls` call?
# l-ht
alias l="ls -Ap1"
alias l-h="ls -p1"
alias lh="l -d .* | grep -vE '^\.\.?/$'"
alias lf="l | grep -v '/$'"
alias lf-h="lf | grep -v '^\.'"
alias l-hf="lf-h"
alias lfh="lf | grep '^\.'"
alias lhf="lfh"
alias ld-h="ls -Ad1 */"
alias l-hd="ld-h"
alias ldh="ls -Ad1 .*/ | grep -vE '^\.\.?/$'"
alias lhd="ldh"
alias ld="(ldh; ld-h)"
# table view ls commands
alias lt="l | column"
alias l-ht="l-h | column"
alias lht="lh | column"
alias lft="lf | column"
alias lf-ht="lf-h | column"
alias l-hft="l-hf | column"
alias lfht="lfh | column"
alias lhft="lhf | column"
alias ld-ht="ld-h | column"
alias l-hdt="l-hd | column"
alias ldht="ldh | column"
alias lhdt="lhd | column"
alias ldt="ld | column"
alias lt-h="l-ht"
alias lth="lht"
alias ltf="lft"
alias ltf-h="lf-ht"
alias lt-hf="l-hft"
alias ltfh="lfht"
alias lthf="lhft"
alias ltd-h="ld-ht"
alias lt-hd="l-hdt"
alias ltdh="ldht"
alias lthd="lhdt"
alias ltd="ldt"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment