Skip to content

Instantly share code, notes, and snippets.

@cam8001
Last active August 31, 2025 22:31
Show Gist options
  • Save cam8001/92c0264c5938d90a44d399cf45817e3c to your computer and use it in GitHub Desktop.
Save cam8001/92c0264c5938d90a44d399cf45817e3c to your computer and use it in GitHub Desktop.
Customise AWS cloudshell or Amazon Linux 2 with nice utilities
# Note for Cloudshell, only stuff in your home directory is saved.
# But, Cloudshell already has git and zsh available. So we just install custom binaries to ~/bin and update our path.
# you can whoami == cloudshell-user or $AWS_EXECUTION_ENV==CloudShell to detect cloudshell
# Start zsh on startup. No chsh :(
[[ $AWS_EXECUTION_ENV == "CloudShell" ]] && echo "In CloudShell, no need to install git/zsh" || sudo yum -y install git zsh && echo zsh >> ~/.bashrc
# Install oh-my-zsh
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
# Install powelevel10k
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k &&
sed -i 's/robbyrussell/powerlevel10k\/powerlevel10k/' ~/.zshrc &&
. ~/.zshrc
# Add git-number
# Add zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
sed -i 's#plugins=(#plugins=(zsh-autosuggestions #' ~/.zshrc
# Add fast-syntax-highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
#git clone https://github.com/z-shell/F-Sy-H.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/F-Sy-H
sed -i 's#plugins=(#plugins=(zsh-syntax-highlighting #' ~/.zshrc
mkdir ~/bin
# Update the standard oh-my-zsh .zshrc to include the local path
sed -i 's/# export PATH/export PATH/g' ~/.zshrc
# Add git-number
curl https://raw.githubusercontent.com/holygeek/git-number/master/git-id > ~/bin/git-id && chmod 0755 ~/bin/git-id
curl https://raw.githubusercontent.com/holygeek/git-number/master/git-list > ~/bin/git-list && chmod 0755 ~/bin/git-list
curl https://raw.githubusercontent.com/holygeek/git-number/master/git-number > ~/bin/git-number && chmod 0755 ~/bin/git-number
# Use brew to install deece stuff, Amazon Linux 2023 doesn't have much
# Note non-interactive, as we have passwordless sudo by default
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo >> /home/ec2-user/.zshrc
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /home/ec2-user/.zshrc
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
# Install dev tools
sudo dnf groupinstall "Development Tools"
# now the good stuff
brew install ripgrep bat fzf tldr eza
touch ~/.alias
echo 'alias l="eza -la --icons=always"' >> ~/.alias
echo "alias gn='git-number'" >> ~/.alias
echo "alias l='ls -lashF'" >> ~/.alias
echo "source ~/.alias" >> ~/.zshrc
echo "Now run zsh to get to your new shell :) chsh if you like it"
@cam8001
Copy link
Author

cam8001 commented May 31, 2021

Paste/userdata this to install (as ec2-user/cloudshell-user):

sh -c "$(curl -fsSL https://gist.githubusercontent.com/cam8001/92c0264c5938d90a44d399cf45817e3c/raw/31e77d2f87b9e7cf58b19a40b90e1fc93c924df3/shell-setup.sh)"

@cam8001
Copy link
Author

cam8001 commented Nov 17, 2024

@cam8001
Copy link
Author

cam8001 commented Jun 22, 2025

todo:

  • add advcpmv
  • add eza
  • add bat

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