add utility aliases
This commit is contained in:
parent
2fee647a56
commit
c80bc6d86d
2 changed files with 104 additions and 23 deletions
|
@ -1,23 +1,48 @@
|
|||
Utility
|
||||
=======
|
||||
|
||||
Adds utility aliases and functions.
|
||||
Utility aliases and functions.
|
||||
|
||||
Adds colour to `ls` and `grep`.
|
||||
|
||||
Aliases
|
||||
-------
|
||||
|
||||
### General
|
||||
### ls
|
||||
|
||||
| alias | command | description |
|
||||
| ----- | ------- | ----------- |
|
||||
| `ls` | `ls --group-directories-first --color=auto` | directories first, use color (applies to all ls aliases) |
|
||||
| `l` | `ls -lAh` | all files, human-readable sizes |
|
||||
| `lm` | `l \| ${PAGER}` | all files, human-readable sizes, use pager |
|
||||
| `ll` | `ls -lh` | human-readable sizes |
|
||||
| `lr` | `ll -R` | human-readable sizes, recursive |
|
||||
| `lx` | `ll -XB` | human-readable sizes, sort by extension (GNU only) |
|
||||
| `lk` | `ll -Sr` | human-readable sizes, largest last |
|
||||
| `lt` | `ll -tr` | human-readable sizes, most recent last |
|
||||
| `lc` | `lt -c` | human-readable sizes, most recent last, change time |
|
||||
|
||||
### File Downloads
|
||||
|
||||
Aliases `get` to ( `aria2c` || `axel` || `wget` || `curl` ).
|
||||
|
||||
### Resource Usage
|
||||
|
||||
| alias | command |
|
||||
| ----- | ------- |
|
||||
| `df` | `df -kh` |
|
||||
| `du` | `du -kh` |
|
||||
|
||||
### Condoms
|
||||
|
||||
| alias | command |
|
||||
| ----- | ------- |
|
||||
| `chmod` | `chmod --preserve-root -v` |
|
||||
| `chown` | `chown --preserve-root -v` |
|
||||
| `df` | `df -kh` |
|
||||
| `du` | `du -kh` |
|
||||
| `rm` | if available, `safe-rm` |
|
||||
|
||||
### ls
|
||||
### Misc
|
||||
|
||||
| alias | command |
|
||||
| ----- | ------- |
|
||||
| `ls` | `ls --group-directories-first --color=auto` |
|
||||
| `l` | `ls -lAh` |
|
||||
| alias | description |
|
||||
| ----- | ----------- |
|
||||
| `mkcd` | mkdir and cd |
|
||||
|
|
|
@ -1,23 +1,13 @@
|
|||
#
|
||||
# utility functions and options
|
||||
# Utility Functions and Options
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# general aliases
|
||||
# ls Colours
|
||||
#
|
||||
|
||||
alias chmod='chmod --preserve-root -v'
|
||||
alias chown='chown --preserve-root -v'
|
||||
alias df='df -kh'
|
||||
alias du='du -kh'
|
||||
|
||||
|
||||
#
|
||||
# ls
|
||||
#
|
||||
|
||||
if [[ dircolors ]]; then
|
||||
if (( ${+commands[dircolors]} )); then
|
||||
if [[ -s ${HOME}/.dir_colors ]]; then
|
||||
eval "$(dircolors --sh ${HOME}/.dir_colors)"
|
||||
else
|
||||
|
@ -33,4 +23,70 @@ else
|
|||
alias ls='ls --group-directories-first -G'
|
||||
fi
|
||||
|
||||
alias l='ls -lAh' # one column, all files, human-readable sizes
|
||||
|
||||
#
|
||||
# grep Colours
|
||||
#
|
||||
|
||||
export GREP_COLOR='37;45' #BSD
|
||||
export GREP_COLORS="mt=${GREP_COLOR}" #GNU
|
||||
alias grep='grep --color=auto'
|
||||
|
||||
|
||||
#
|
||||
# ls Aliases
|
||||
#
|
||||
|
||||
alias l='ls -lAh' # all files, human-readable sizes
|
||||
alias lm="l | ${PAGER}" # all files, human-readable sizes, use pager
|
||||
alias ll='ls -lh' # human-readable sizes
|
||||
alias lr='ll -R' # human-readable sizes, recursive
|
||||
alias lx='ll -XB' # human-readable sizes, sort by extension (GNU only)
|
||||
alias lk='ll -Sr' # human-readable sizes, largest last
|
||||
alias lt='ll -tr' # human-readable sizes, most recent last
|
||||
alias lc='lt -c' # human-readable sizes, most recent last, change time
|
||||
|
||||
|
||||
#
|
||||
# File Downloads
|
||||
#
|
||||
|
||||
if (( ${+commands[aria2c]} )); then
|
||||
alias get='aria2c --max-connections-per-sever=5 --continue'
|
||||
elif (( ${+commands[axel]} )); then
|
||||
alias get='axel --num-connections=5 --alternate'
|
||||
elif (( ${+commands[wget]} )); then
|
||||
alias get='wget --continue --progress=bar --timestamping'
|
||||
elif (( ${+commands[curl]} )); then
|
||||
alias get='curl --continue-at - --location --progress-bar --remote-name --remote-time'
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Resource Usage
|
||||
#
|
||||
|
||||
alias df='df -kh'
|
||||
alias du='du -kh'
|
||||
|
||||
|
||||
#
|
||||
# Always wear a condom
|
||||
#
|
||||
|
||||
alias chmod='chmod --preserve-root -v'
|
||||
alias chown='chown --preserve-root -v'
|
||||
|
||||
# not aliasing rm -i, but if safe-rm is available, use condom.
|
||||
if (( ${+commands[safe-rm]} )); then
|
||||
alias rm='safe-rm'
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Misc
|
||||
#
|
||||
|
||||
mkcd() {
|
||||
[[ -n ${1} ]] && mkdir -p ${1} && builtin cd ${1}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue