반응형
Macbook을 새로 구입하고, .bash_profile을 작성할 때 참고하려고 작성했다.
#
# Greeting message
# 31 Red
# 32 Green
# 33 Yellow
# 34 Blue
# 35 Magenta
# 36 Cyan
# Reference: https://en.wikipedia.org/wiki/ANSI_escape_code
#
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# For Ubuntu, CentOS
#OS_DESCRIPTION=$(lsb_release -d)
# For Mac OS
OS_DESCRIPTION=$(uname -srn)
echo " "
echo " Bourne Again Shell Environment for Andrew "
echo " $OS_DESCRIPTION "
echo " "
#
# For core dumped file
#
ulimit -c unlimited
#
# Locale
#
## LC_CTYPE=ko_KR.utf8
export LC_ALL="en_US.UTF-8"
export LANGUAGE="en_US.UTF-8"
# export VIM=/usr/share/vim/vim74
export PATH=$PATH:/sbin:/usr/sbin:/usr/local/go/bin:./
export PATH=$PATH:/usr/local/Cellar/iftop/1.0pre4/sbin
export PATH=$PATH:$HOME/go/bin
export PATH=$PATH:$HOME/bin
ssh2() {
ssh -oStrictHostKeyChecking=no -p 33322 $@
}
sftp2() {
sftp -oStrictHostKeyChecking=no -P 33322 $@
}
mandump() {
man $1 | col -bx > man_page_$1.txt
}
## For docker monitoring
docker_ip() {
sudo docker inspect --format '{{ .NetworkSettings.IPAddress }}' "$@"
}
mywhile() {
while true; do date; $2; echo ""; echo ""; sleep $1; done
}
conn_vpn() {
sudo openconnect --protocol=gp $1
}
## For Mac OS
get_cpu_mac() {
# istats all
istats cpu
}
## For Raspberry PI
get_cpu_pi() {
my_cpu_temp=$(vcgencmd measure_temp)
echo " *** Execute vcgencmd *** "
echo " + CPU Temperature : $my_cpu_temp "
echo ""
echo " *** Get information from /sys/class/thermal/thermal_zone0/temp *** "
cpu=$(</sys/class/thermal/thermal_zone0/temp)
echo " + CPU Temperature : $((cpu/1000)) c "
}
## Kubernetes
kube_andrew() {
export KUBECONFIG=~/Documents/kube_config/andrew
kubectl config get-contexts
}
kube_peter() {
export KUBECONFIG=~/Documents/kube_config/peter
kubectl config get-contexts
}
## For Mac OS
export PS1="\h:\w > "
export BASH_COMPLETION_COMPAT_DIR="/usr/local/etc/bash_completion.d"
[[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh"
source <(kubectl completion bash)
alias k=kubectl
complete -F __start_kubectl k
alias ls='ls -FG'
## For Mac OS
# defaults write .GlobalPreferences com.apple.mouse.scaling -23000
# efaults write -g com.apple.mouse.scaling 5
'Ubuntu' 카테고리의 다른 글
Install BIND for name server(DNS) on Ubuntu 22.04 (0) | 2021.11.05 |
---|---|
openssl command example (0) | 2021.11.04 |
.vimrc 작성 (0) | 2021.07.22 |
iptables and netfilter (1) | 2021.07.10 |
tcpdump로 HTTP Packet Decode 하기 및 tshark 사용법 (0) | 2021.07.10 |