Skip to content

Instantly share code, notes, and snippets.

@chatziiola
Last active May 5, 2026 09:31
Show Gist options
  • Select an option

  • Save chatziiola/4960b0bd6d0f323c2d79432216cb8b87 to your computer and use it in GitHub Desktop.

Select an option

Save chatziiola/4960b0bd6d0f323c2d79432216cb8b87 to your computer and use it in GitHub Desktop.
[HtB Academy] Proper Setup
# TLDR: this is a basic configuration gist for htb academy: responsible for zsh, tmux
# feel free to use it yourself, but try to make your own copy: this one might be changed ?
# Use with curl -L <link> | bash
# zsh <(curl -fsSL 'https://gist.githubusercontent.com/chatziiola/4960b0bd6d0f323c2d79432216cb8b87/raw/htbacad_setup.sh')
echo "Creating zshrc"
cat << 'END' > "$HOME/.zshrc"
autoload -Uz compinit
compinit -d ~/.cache/zcompdump
# Custom prompt
setopt PROMPT_SUBST
# Function to display Python virtual environment if active
venv_prompt() {
if [[ -n "$VIRTUAL_ENV" ]]; then
echo "($(basename $VIRTUAL_ENV))"
fi
}
unset VIRTUAL_ENV_DISABLE_PROMPT
# Main prompt
PROMPT='%F{red}[ %~ ]%f (%?%)
%F{green}$(venv_prompt)%f -> '
bindkey -v
alias cll='clear && ls -l'
alias cl='clear'
END
echo "Now tmux"
cat << 'END' > "$HOME/.tmux.conf"
# Src: https://stackoverflow.com/questions/51639540/tmux-scroll-mode-vim-keybindings
set-option -g default-shell /usr/bin/zsh
set-window-option -g mode-keys vi
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip -selection c"
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -in -selection clipboard"
set-option -g set-titles on
set-option -g set-clipboard on
## Vi Keybindings
set-window-option -g mode-keys vi
bind-key -T copy-mode-vi v send -X begin-selection
bind-key -T copy-mode-vi V send -X select-line
bind-key -T copy-mode-vi y send -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Src: https://gist.github.com/william8th/faf23d311fc842be698a1d80737d9631
bind c new-window -c "#{pane_current_path}"
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
setw -g mouse on
END
@chatziiola
Copy link
Copy Markdown
Author

Initially the gist contained chsh as well. But, I found myself repeatedly just failing PAM Authentication (spamming Enter), since I only live within a tmux session:

echo "Setting user shell to zsh"
chsh -s $(which zsh) $(whoami) 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment