50 lines
1.2 KiB
Bash
50 lines
1.2 KiB
Bash
#
|
|
# ~/.bashrc
|
|
#
|
|
|
|
# If not running interactively, don't do anything
|
|
[[ $- != *i* ]] && return
|
|
|
|
alias ls='ls --color=auto'
|
|
PS1='[\u@\h \W]\$ '
|
|
|
|
# Execute tmux in Alacritty
|
|
if [ "$TERM" == "alacritty" ]; then
|
|
exec tmux
|
|
fi
|
|
|
|
# Set TERM to screen-256color inside tmux
|
|
# (Needs tmux.conf changes)
|
|
[[ $TMUX != "" ]] && export TERM="screen-256color"
|
|
|
|
# SSH without checking or adding host keys to known_hosts
|
|
# Useful for cloud server rescue environment & installation
|
|
alias sshtmp="ssh -o 'UserKnownHostsFile /dev/null' -o 'StrictHostKeyChecking no'"
|
|
alias moshtmp="mosh --ssh=\"ssh -o 'UserKnownHostsFile /dev/null' -o 'StrictHostKeyChecking no'\""
|
|
|
|
# SSH with automatic "screen"
|
|
function sshscr() {
|
|
ssh -t $@ screen -RR -d
|
|
}
|
|
|
|
function moshscr() {
|
|
mosh $@ -- screen -RR -d
|
|
}
|
|
|
|
# Alternative SSH session for unlocking remote encrypted servers
|
|
# This requires a standalone known hosts file
|
|
function sshunlock() {
|
|
set -o pipefail
|
|
pass show "Misc/$2" | wl-copy
|
|
if [ $? -ne 0 ]; then
|
|
echo "key not found"
|
|
return
|
|
fi
|
|
ssh -o UserKnownHostsFile=~/.ssh/known_hosts_unlock root@$1 -t "zfsunlock"
|
|
echo "" | wl-copy
|
|
set +o pipefail
|
|
}
|
|
|
|
# Add local to path
|
|
export PATH="$PATH:~/.local/bin"
|