1 # Aliases and similar functions which can be used by all shells (supporting
4 # Copyright (C) 2011-2014 Simon Ruderich
6 # This file is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This file is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this file. If not, see <http://www.gnu.org/licenses/>.
20 # Shortcuts for often used programs.
27 alias p=less # p for pager
30 # Shortcuts for a little less used programs.
34 unalias mv cp 2> /dev/null
35 # Ask for confirmation before overwriting files. Especially useful when moving
36 # to a different directory. No alias for `rm` because I specify the files to
37 # remove directly, so I know what will happen.
39 # Additionally preserve all file attributes when copying, this includes
40 # copying symbolic links as is without dereferencing them.
44 # Make sure there is no alias named ls as it causes problems with the
45 # following ls function on (at least) bash 4.0.35.
46 unalias ls 2>/dev/null
47 # Improved ls which displays the files in columns (-C), visualizes
48 # directories, links and other special files (-F) and pages everything through
51 # If available use GNU ls with colorized output. If it isn't available try
52 # normal ls which needs CLICOLOR_FORCE so it displays colors when used with a
53 # pager. If none work no colors are used.
55 # See `setup.sh` for details. LS_ENV and LS_COLOR are replaced with the
56 # correct values when this file is generated.
58 LS_ENV command ls LS_COLOR -C -F "$@" 2>&1 | less
61 unalias ll lt la lal lat 2>/dev/null
62 # List the files in list format with access rights, etc.
64 # List the files sorted by last modification date.
68 # List all files in list format with access rights, etc.
70 # List all files sorted by last modification date.
74 # Make going up directories simple.
77 alias ....='cd ../../..'
78 alias .....='cd ../../../..'
80 # I sometimes confuse editor and shell, print a warning to prevent I exit the
82 alias :q='echo "This is not Vim!" >&2'
84 # Automatically use unified diffs.
87 # COLUMN is set to `| column -t` if it's available, empty otherwise.
89 # Display all files (-s), use human readable sizes (-h) and display the
92 # Use human readable sizes and format it nicely, thanks to climagic
93 # (http://twitter.com/climagic/status/49623386762129408).
95 command df -hP "$@" COLUMN
98 # Highlight matched strings. Doesn't work with a pager!
99 alias grep='grep --color=auto'
101 # Pipe output through less.
103 command tree -C "$@" | less
106 # Better viewer for info pages .. just pipe everything into less.
108 command info "$@" 2>/dev/null | less