xxwhirlpool
·
2026-03-26
.bashrc-laptop
1#!/bin/bash
2# ~/.bashrc: executed by bash(1) for non-login shells.
3# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
4# for examples
5
6######################################
7# default stuff i'm scared to change
8######################################
9
10# If not running interactively, don't do anything
11case $- in
12 *i*) ;;
13 *) return;;
14esac
15
16HISTCONTROL=ignoreboth
17
18# append to the history file, don't overwrite it
19shopt -s histappend
20
21HISTSIZE=1000
22HISTFILESIZE=2000
23
24# check the window size after each command and, if necessary,
25# update the values of LINES and COLUMNS.
26shopt -s checkwinsize
27
28# make less more friendly for non-text input files, see lesspipe(1)
29[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
30
31# set variable identifying the chroot you work in (used in the prompt below)
32if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
33 debian_chroot=$(cat /etc/debian_chroot)
34fi
35
36# set a fancy prompt (non-color, unless we know we "want" color)
37case "$TERM" in
38 xterm-color|*-256color) color_prompt=yes;;
39esac
40
41if [ -n "$force_color_prompt" ]; then
42 if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
43 color_prompt=yes
44 else
45 color_prompt=
46 fi
47fi
48
49if [ "$color_prompt" = yes ]; then
50 PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
51else
52 PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
53fi
54unset color_prompt force_color_prompt
55
56# If this is an xterm set the title to user@host:dir
57case "$TERM" in
58xterm*|rxvt*)
59 PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
60 ;;
61*)
62 ;;
63esac
64
65# enable color support of ls and also add handy aliases
66if [ -x /usr/bin/dircolors ]; then
67 test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
68 alias ls='ls --color=auto'
69 alias grep='grep --color=auto'
70fi
71
72# enable programmable completion features (you don't need to enable
73# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
74# sources /etc/bash.bashrc).
75if ! shopt -oq posix; then
76 if [ -f /usr/share/bash-completion/bash_completion ]; then
77 . /usr/share/bash-completion/bash_completion
78 elif [ -f /etc/bash_completion ]; then
79 . /etc/bash_completion
80 fi
81fi
82
83######################################
84# aliases
85######################################
86
87# general
88
89alias icat="kitten icat"
90alias fd="fdfind"
91alias neofetch="hyfetch"
92alias fastfetch="hyfetch"
93alias bat="batcat"
94alias cat="bat --paging=never"
95alias rced="micro ~/.bashrc && source ~/.bashrc"
96alias ps="ps auxww"
97alias dd="askdd"
98alias copy="xclip -sel clipboard"
99alias open="xdg-open"
100alias c="clear"
101alias updupgr="sudo apt update && sudo apt upgrade"
102alias freeze="freeze -c user"
103alias glow="glow -p"
104
105# some cd bookmarks
106alias dotf="cd /home/kat/dotfiles"
107alias gmine="cd /home/kat/Documents/Git/-mine"
108
109# weather stuff
110alias wttr="curl https://wttr.in/nyc?F0ASu"
111alias weather=wttr
112alias wttrlg="curl https://wttr.in/nyc?F1uq"
113alias weatherlg=wttrlg
114alias sun="daylight --short --timezone='America/New_York' | lolcat"
115
116# git
117alias gitall="git remote | xargs -L1 git push --all"
118alias gyolo="git add . && git commit -m 'yolo'"
119alias gitd="git diff --staged"
120alias gitlc="git diff HEAD~"
121alias gdiff="gitd"
122alias gits="git status"
123alias gita="git add ."
124alias pusheu="git push bytes main && cd /home/kat/Documents/Git/-mine/eunoia-astro/src/utils && node git-changelog.js && cd ../../"
125
126# dev
127alias irb="rv run irb"
128alias ipy="python3 -i"
129
130# vpn split tunnel aliases based on a small script @ ~/.local/bin/mvpn
131alias mftp="mvpn filezilla"
132alias mterm="mvpn kitty"
133
134# servers
135alias fujo="kitty +kitten ssh fujo"
136alias fujobuild="kitty +kitten ssh fujobuild"
137alias fujohost="kitty +kitten ssh fujohost"
138alias fujoat="kitty +kitten ssh fujoat"
139alias goldstar="kitty +kitten ssh goldstar"
140alias ncc="kitty +kitten ssh ncc1701"
141
142######################################
143# variables
144######################################
145
146export PATH=$PATH:/usr/local/go/bin
147
148export NVM_DIR="$HOME/.config/nvm"
149[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
150[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
151
152# set truecolor
153export COLORTERM=truecolor
154export MICRO_TRUECOLOR=1
155
156# catppuccin colors for fzf
157export FZF_DEFAULT_OPTS=" \
158--color=spinner:#F2D5CF,hl:#E78284 \
159--color=fg:#C6D0F5,header:#E78284,info:#CA9EE6,pointer:#F2D5CF \
160--color=marker:#BABBF1,fg+:#C6D0F5,prompt:#CA9EE6,hl+:#E78284 \
161--color=border:#414559,label:#C6D0F5"
162
163export LEDGER_FILE=~/.config/hledger/katmoney.journal
164
165######################################
166# functions
167######################################
168
169# get a random free port. this is useful for my
170# insane sysadmin website woman adventures
171portfree() {
172 while
173 port=$(shuf -n 1 -i 1024-65535)
174 netstat -atun | grep -q "$port"
175 do
176 continue
177 done
178 echo "$port"
179}
180
181# print internal & external IPs
182whatip() {
183 # internal
184 echo -n "internal IP: " | lolcat -p 0.7
185 hostname -I | awk '{print $1}'
186
187 # external
188 echo -n "external IP: " | lolcat -p 0.7
189 curl -4 icanhazip.com
190}
191
192# password generator. takes input for password length by number
193passgen() {
194 PASSLENGTH=$(gum input --placeholder "type a number")
195 date +%s | sha256sum | base64 | head -c "$PASSLENGTH"; echo
196}
197
198cdmess() {
199 # from this blog post:
200 # https://blog.larah.me/mess-directory/
201 today_tmpdir="${TMPDIR-/tmp}/${USER}_mess/$(date +%F)"
202 mkdir -p "$today_tmpdir"
203 cd "$(mktemp -d -p "${today_tmpdir}" XXXX)" || exit 1
204}
205
206# to get quick notifs
207# after long commands
208notif() {
209 notify-send "done!"
210 paplay /usr/share/sounds/sound-icons/start
211 spd-say -t female3 -r +25 "done!"
212}
213
214# make & cd into a folder
215mkcd() {
216 mkdir -p "$@" && cd "$_" || exit 1;
217}
218
219# shamelessly stolen from evan hahn:
220# https://evanhahn.com/scripts-i-wrote-that-i-use-all-the-time/#audio-and-video-and-pictures
221boop() {
222 local last="$?"
223 if [[ "$last" == "0" ]]; then
224 sfx chime
225 else
226 sfx bad
227 fi
228 eval "$(exit "$last")"
229}
230
231######################################
232# misc
233######################################
234
235eval "$(starship init bash)"
236eval "$(fzf --bash)"
237eval "$(batman --export-env)"
238. "/home/kat/.deno/env"