Last active
October 31, 2017 00:21
-
-
Save shiopon01/8d4b009ba90c38a53d25784636db9e05 to your computer and use it in GitHub Desktop.
これからbashrc触り始める人へ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## bashrc_example for shiopon01 | |
## | |
echo " | |
SHLVL : $SHLVL | |
HOSTNAME : $HOSTNAME | |
" | |
# Aliases | |
unalias -a | |
alias 644='chmod 644' | |
alias 755='chmod 755' | |
# Functions | |
## cd | |
function .. { cd ..; } | |
function ../ { cd ..; } | |
## Command decoration | |
function ls { command ls -bF "$@"; } | |
function ll { command ls -lF "$@"; } | |
function la { command ls -Fla "$@"; } | |
function rm { command rm -i "$@"; } | |
function mv { command mv -i "$@"; } | |
function cp { command cp -i "$@"; } | |
function mkdir { command mkdir -p "$@"; } | |
function htop { command sudo htop; } | |
function p { command ping 8.8.8.8; } | |
function n { command nslookup; } | |
function j { command jobs -l; } | |
function ox { command od -Ax -tx1 "$@"; } | |
function l { if [ $# -eq 0 ]; then ${PAGER:-less}; elif [ -d "$1" ]; then ls -F "$@"; else ${PAGER:-less} "$@"; fi } | |
function f { if [ ! "$1" ]; then echo 'usage: f pattern [dir ...]'; else n="*$1*"; shift; find . "$@" -name "$n"; fi } | |
function c { command cat "$@"; } | |
function h { command head "$@"; } | |
function t { command tail "$@"; } | |
function T { command tail -f "$@"; } | |
## grep | |
function g { LC_CTYPE=C command grep -i "$@"; } | |
function r { LC_CTYPE=C command grep -ir "$@"; } | |
function G { LC_CTYPE=C command grep "$@"; } | |
function F { LC_CTYPE=C command fgrep "$@"; } | |
## #ではじまるコメントを除いて表示 | |
function V { grep -v "^\s*$" | grep -v "^\s*#"; } | |
# Prompt | |
export PS1="\n\t \u@\h \[\e[1;32m\]\w\[\e[m\] \n$ " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment