---
# System prepended metadata

title: bashrc
tags: [public]

---

- ./bashrc
```sh=

# sudoedit
export VISUAL="vim"
export EDITOR="$VISUAL"

alias ll='ls -l'
alias la='ll -a'
alias l='ls -CF'
alias ld='ls -ld -- */'
alias lf='ls -lp | grep -v /'

# alias vi='busybox vi'
alias als='vim ~/.bashrc'
alias vrc='vim ~/.vimrc'
alias re='source ~/.bashrc'
alias bn='basename'
alias cl='clear'
alias v='vim'
# alias ll='pwd && ls -la'
alias lt='ls -ltr'
alias lt1='ls -1tr'
alias s='find $PWD -name 2>/dev/null'
alias sd='find $PWD -type d -name 2>/dev/null'
alias jl='jobs -l'
alias v='vim'
alias sv='sudoedit'
alias hosts='sudoedit /etc/hosts'

alias j1='fg %1'
alias j2='fg %2'
alias j3='fg %3'
alias j4='fg %4'
alias j5='fg %5'
alias j6='fg %6'
alias j7='fg %7'
alias j8='fg %8'
alias j9='fg %9'

alias dssh='docker exec -it d2 /etc/init.d/ssh restart'
alias dkssh='docker start bf'

bind -m vi-command 'z: clear-screen'
bind -m vi-insert 'Control-l: clear-screen'

bind '"\C-p":history-search-backward'
bind '"\C-n":history-search-forward'
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'

j() {
  fg %$1
}

cd() {
  #builtin cd $@
  command cd $@ && echo " " && ll
}

pt(){
  export whoami=whoami
  PS1="$(whoami)@\${PWD##*/}\> "
}
# 當前目錄 顯示多個檔名的路徑(包含檔名)
sf(){
  for file in "$@"; do
    s $(basename $file)
    #basename $file
    #dirname $(s $(basename $file))
  done
}

# 當前目錄 顯示多個檔名的路徑(不包含檔名)
sfd(){
  echo " "
  for file in "$@"; do
    basename $file
    s $(basename $file) | xargs -I {} dirname {}
  done
}

# 當前目錄 依據檔名備份多個檔
# search & bak
# args[]: multiple filenames, seperate by spaces
sbak(){
  for file in "$@"; do
    bakDate=$(date "+%Y-%m-%d_%H%M%S")
    targetPath=$(s $(basename $file))
    echo $targetPath.bak@$bakDate
    cp $targetPath $targetPath.bak@$bakDate
  done
}

# 當前目錄 依據檔名取代多個檔
srep(){
  for file in "$@"; do
    targetPath=$(s $(basename $file))
    echo $targetPath
    cp $file $targetPath
  done
}

# find
# args: date, filename
fb () {
  find $PWD -type f ! -newermt "$2" -name "$1" -printf "%T@ %Tc %p\n" | sort -n
}

# find & rm before date
# args: date, filename
frmb () {
  find $PWD -type f ! -newermt "$2" -name "$1" -printf "%T@ %Tc %p\n" | sort -n && find . -type f ! -newermt "$2" -name "$1" -exec rm -f {} \;
}

function mkdir
{
  command mkdir -p $1 && cd $1
}

readline-brackets() {
    READLINE_LINE="${READLINE_LINE:0:$READLINE_POINT}${1}${READLINE_LINE:$READLINE_POINT}"
    ((READLINE_POINT+=1))
}

bind -m vi-insert -x '"\"" : "readline-brackets \"\""'
bind -m vi-insert -x $'"\047" : "readline-brackets \\\047\\\047"' # SINGLE QUOTE
bind -m vi-insert -x '"(" : "readline-brackets \(\)"'
bind -m vi-insert -x '"[" : "readline-brackets []"'
bind -m vi-insert -x '"{" : "readline-brackets {}"'

p () {
    bind -m vi-insert -x '"\"" : "readline-brackets \""'
    bind -m vi-insert -x $'"\047" : "readline-brackets \\\047"' # SINGLE QUOTE
    bind -m vi-insert -x '"(" : "readline-brackets \("'
    bind -m vi-insert -x '"[" : "readline-brackets ["'
    bind -m vi-insert -x '"{" : "readline-brackets {"'
}

np () {
    bind -m vi-insert -x '"\"" : "readline-brackets \"\""'
    bind -m vi-insert -x $'"\047" : "readline-brackets \\\047\\\047"' # SINGLE QUOTE
    bind -m vi-insert -x '"(" : "readline-brackets \(\)"'
    bind -m vi-insert -x '"[" : "readline-brackets []"'
    bind -m vi-insert -x '"{" : "readline-brackets {}"'
}



```

# python
```sh=
ipython profile create 
ipython locate profile
```