Skip to content

Instantly share code, notes, and snippets.

@fcoclavero
Last active July 15, 2024 23:49
Show Gist options
  • Save fcoclavero/415e16b98233028c0ae9798bdb9541e0 to your computer and use it in GitHub Desktop.
Save fcoclavero/415e16b98233028c0ae9798bdb9541e0 to your computer and use it in GitHub Desktop.
Linux cheatsheet
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
# Open a screen session, create a new window, and start a shell in that window:
screen
# Start named session:
screen -S session_name
# Reattach screen:
screen -r $SCREEN_ID
# List running screens:
screen -ls
# Shortcuts:
# `Ctrl+a ?` List screen commands
# `Ctrl+a c` Create a new window (with shell)
# `Ctrl+a "` List all window
# `Ctrl+a 0` Switch to window 0 (by number)
# `Ctrl+a A` Rename the current window
# `Ctrl+a S` Split current region horizontally into two regions
# `Ctrl+a |` Split current region vertically into two regions
# `Ctrl+a tab` Switch the input focus to the next region
# `Ctrl+a` Toggle between the current and previous region
# `Ctrl+a Q` Close all regions but the current one
# `Ctrl+a X` Close the current region
# `Ctrl+a d` Detach screen
# Check disk usage per use
sudo du -sh /home/* | sort -h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment