Finally got properly settled in Hải Phòng a few months ago — new apartment, new desk, new everything. The one thing that always takes longest to feel like home is the terminal. Fresh machine, and suddenly none of my muscle memory works because half my aliases are gone.
So this weekend I sat down and rebuilt my dotfiles from scratch, and cleaned them up while I was at it. Posting the useful bits here, partly so future-me has a copy, partly in case anyone finds a shortcut worth stealing.
Nothing exotic — just a .bashrc, a .gitconfig, and a couple of helper functions I use every day. Full versions live in my dotfiles repo on GitHub if you want the lot.
---- history ----
stop bash forgetting things the moment I need them
HISTSIZE=50000
HISTFILESIZE=100000
HISTCONTROL=ignoreboth:erasedups # no dupes, no leading-space commands
shopt -s histappend # append, don't overwrite, on exit
PROMPT_COMMAND='history -a' # write after every command, not just logout
---- quality of life ----
shopt -s checkwinsize # keep $LINES/$COLUMNS right after resizing
shopt -s cdspell # fix small typos in cd paths
shopt -s autocd 2>/dev/null || true # type a dir name, cd into it
---- prompt: user@host, cwd, git branch, all on one line ----
parse_git_branch() {
git branch 2>/dev/null | sed -n 's/^* (.*)/ (\1)/p'
}
PS1='[\e[32m]\u@\h[\e[0m]:[\e[34m]\w[\e[33m]$(parse_git_branch)[\e[0m]\$ '
---- aliases ----
alias ll='ls -lah'
alias la='ls -A'
alias ..='cd ..'
alias ...='cd ../..'
alias grep='grep --color=auto'
alias ports='ss -tulpn'
alias myip='curl -s ifconfig.me; echo'
alias serve='python3 -m http.server 8000'
---- timezone sanity ----
server logs are UTC, I am not. this one line has saved me
more debugging pain than anything else in this file.
export TZ='Asia/Ho_Chi_Minh' # UTC+7
Top comments (0)