Last active
November 13, 2020 23:09
-
-
Save guzmonne/90a05ec0c9c9437921913f6e7d4f61aa to your computer and use it in GitHub Desktop.
Useful bash tips
This file contains hidden or 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
# Fix locale error | |
# Put this into /etc/environment | |
LC_ALL=en_US.UTF-8 | |
LANG=en_US.UTF-8 | |
# SSH agent | |
eval `ssh-agent -s` | |
# Add a key to the keychain | |
ssh-add ~/.ssh/id_rsa | |
# Use SSH Agent | |
ssh -A [email protected] | |
# Adding a line after the bash prompt | |
export PS1="$PS1\n> " | |
# Add this line to .bashrc | |
echo "export PS1=\"$PS1\\n> \"" >> .bashrc; source .bashrc | |
# Simple Bash Prompt | |
export PS1="\[\e[34m\]\u\[\e[m\]\[\e[31m\]@\[\e[m\]\[\e[34m\]\h\[\e[m\]\[\e[32m\][\[\e[m\]\w\[\e[32m\]]\[\e[m\]\n$ " | |
# Run command through SSH | |
ssh USER@HOST 'COMMAND' | |
# Accept all keys | |
ssh -oStrictHostKeyChecking=no | |
# Align tmux windows evenly | |
# This commands must be entered after pressing ctrl+b+: | |
# Vertically | |
select-layout even-vertical | |
# Horizontally | |
select-layout even-horizontal | |
# Install docker on Ubuntu | |
sudo apt-get remove docker docker-engine docker.io containerd runc | |
sudo apt-get update | |
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
sudo apt-key fingerprint 0EBFCD88 | |
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | |
sudo apt-get update | |
sudo apt-get install -y docker-ce docker-ce-cli containerd.io | |
sudo groupadd docker | |
sudo usermod -aG docker $USER | |
newgrp docker | |
docker run hello-world | |
# Custom aliases | |
alias ll="ls -al --color=auto" | |
alias cls=clear | |
alias cd..="cd .." | |
alias python=python3 | |
alias pip=pip3 | |
# Update Yum | |
yum update -y | |
# Install docker on Amazon Linux 2 | |
amazon-linux-extras install docker -y | |
service docker start | |
usermod -a -G docker ec2-user | |
chkconfig docker on | |
yum install -y git | |
curl -L https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose | |
chmod +x /usr/local/bin/docker-compose | |
# Install Ansible | |
yum install -y python3-pip | |
pip3 install pip --upgrade | |
pip3 install ansible |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment