Last active
January 9, 2024 20:49
-
-
Save cam8001/92c0264c5938d90a44d399cf45817e3c to your computer and use it in GitHub Desktop.
Customise AWS cloudshell or Amazon Linux 2 with nice utilities
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
echo 'alias l="ls -lash"' >> ~/.zshrc | |
# 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/z-shell/F-Sy-H.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/F-Sy-H | |
sed -i 's#plugins=(#plugins=(F-Sy-H #' ~/.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 tldr | |
wget https://github.com/dbrgn/tealdeer/releases/download/v1.4.1/tldr-linux-x86_64-musl | |
chmod +x tldr-linux-x86_64-musl | |
mv tldr-linux-x86_64-musl $HOME/bin/ | |
ln -s $HOME/bin/tldr-linux-x86_64-musl $HOME/bin/tldr | |
tldr --update | |
# rg - maybe not in cloudshell (because sudo?) | |
sudo yum-config-manager --add-repo=https://copr.fedorainfracloud.org/coprs/carlwgeorge/ripgrep/repo/epel-7/carlwgeorge-ripgrep-epel-7.repo | |
sudo yum install ripgrep | |
# fzf | |
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf | |
~/.fzf/install | |
# 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 | |
echo "alias gn='git-number'" >> ~/.zshrc | |
echo "alias l='ls -lashF'" >> ~/.zshrc | |
echo "Now run zsh to get to your new shell :) chsh if you like it" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Paste/userdata this to install (as
ec2-user
/cloudshell-user
):