Skip to content

Instantly share code, notes, and snippets.

@Adophilus
Last active July 16, 2022 10:36
Show Gist options
  • Save Adophilus/40e97e7344ee9b96ec89293da6bd6b25 to your computer and use it in GitHub Desktop.
Save Adophilus/40e97e7344ee9b96ec89293da6bd6b25 to your computer and use it in GitHub Desktop.
My Linux Commands Cheatsheet
#! /usr/bin/env bash
# compresses a file/folder to a tape archive (.tar) file
tar -cvf <compressed-name>.tar <file/folder-to-compress>
# decompresses a tape archive (.tar) file to a file/folder
tar -xvf <compressed-name>.tar <file/folder-to-decompress>
# uploads a file to a remote ssh host
scp <local-file> <remote-ssh-host>
# uploads a file to a remote ssh host (in a specific path)
scp <local-file> <remote-ssh-host>:/path/to/upload
# downloads a file from a remote ssh host
scp <remote-ssh-host> <local-file>
# downloads a file from a remote ssh host (from a specific path)
scp <remote-ssh-host>:/path/to/file <local-file>
# lists out tmux sessions
tmux ls
# attach to the only tmux sesssion
tmux attach
# attach to a specific tmux sesssion
tmux attach-session -t <session-id>
# switch user (as root)
su <username>
# switch user (as any sudo user)
sudo su <username>
# switch to (user's) home folder
cd
cd ~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment