text WSL Ubuntu .bash_aliases
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text WSL Ubuntu .bash_aliases相关的知识,希望对你有一定的参考价值。
# SOURCES:
# http://unix.stackexchange.com/a/122188
# https://natelandau.com/my-mac-osx-bash_profile
# https://jonsuh.com/blog/bash-command-line-shortcuts
# https://news.ycombinator.com/item?id=8159771
# .bashrc: https://gist.github.com/evdokimovm/67e4fcd938af98528aa108574626e522
# ---------------------------
# ETC
# ---------------------------
alias gam="/Users/$(whoami)/bin/gam/gam" # Google API
alias cp='cp -iv' # Preferred 'cp' implementation
alias mv='mv -iv' # Preferred 'mv' implementation
alias less='less -FSRXc' # Preferred 'less' implementation
alias cw='history -cw' # Clear terminal buffer
alias wc='echo $(ls -1 | wc -l)' # Number of files in directory
alias c='clear' # c: Clear terminal display
alias which='type -all' # which: Find executables
alias path='echo -e ${PATH//:/\\n}' # path: Echo all executable Paths
alias show_options='shopt' # Show_options: display bash options settings
alias fix_stty='stty sane' # fix_stty: Restore terminal settings when screwed up
alias f='open -a Finder ./' # f: Opens current directory in MacOS Finder
alias diff='diff -W $(( $(tput cols) - 2 ))' # Make diff Use Full Terminal Width in Side-by-Side Mode
eval $(thefuck --alias) # "Magnificent app which corrects your previous console command."
# ---------------------------
# DIRECTORIES
# ---------------------------
alias mkdir='mkdir -pv' # Preferred 'mkdir' implementation
alias ll='ls -FGlAhp' # Preferred 'ls' implementation
cd() { builtin cd "$@"; ll; } # Always list directory contents upon 'cd'
alias ..='cd ../' # Go back 1 directory level
alias ...='cd ../../' # Go back 2 directory levels
alias .3='cd ../../../' # Go back 3 directory levels
alias .4='cd ../../../../' # Go back 4 directory levels
alias .5='cd ../../../../../' # Go back 5 directory levels
alias .6='cd ../../../../../../' # Go back 6 directory levels
# cd follows aliases
function cd {
if [ ${#1} == 0 ]; then
builtin cd
elif [ -d "${1}" ]; then
builtin cd "${1}"
elif [[ -f "${1}" || -L "${1}" ]]; then
path=$(getTrueName "$1")
builtin cd "$path"
else
builtin cd "${1}"
fi
}
# do sudo, or sudo the last command if no argument given
s() {
if [[ $# == 0 ]]; then
sudo $(history -p '!!')
else
sudo "$@"
fi
}
# ---------------------------
# NETWORKING
# ---------------------------
alias ip='curl icanhazip.com' # Your public IP address
alias netCons='lsof -i' # netCons: Show all open TCP/IP sockets
alias flushdns='sudo discoveryutil udnsflushcaches' # Flush DNS (Yosemite)
alias lsock='sudo /usr/sbin/lsof -i -P' # lsock: Display open sockets
alias lsockU='sudo /usr/sbin/lsof -nP | grep UDP' # lsockU: Display only open UDP sockets
alias lsockT='sudo /usr/sbin/lsof -nP | grep TCP' # lsockT: Display only open TCP sockets
alias ipInfo0='ipconfig getpacket en0' # ipInfo0: Get info on connections for en0
alias ipInfo1='ipconfig getpacket en1' # ipInfo1: Get info on connections for en1
alias openPorts='sudo lsof -i | grep LISTEN' # openPorts: All listening connections
alias showBlocked='sudo ipfw list' # showBlocked: All ipfw rules inc/ blocked IPs
以上是关于text WSL Ubuntu .bash_aliases的主要内容,如果未能解决你的问题,请参考以下文章
Windows10 WSL2 Ubuntu / Debian # 无网络
Win10+WSL2+Ubuntu 18.04(WSL下)+VS Code(Win10下)+TexLive 2019(Ubuntu下)安装和配置