Skip to content

Instantly share code, notes, and snippets.

@killshot13
Last active June 21, 2021 21:27
Show Gist options
  • Save killshot13/7f4d23c65970d24eee7e93b25404ecf4 to your computer and use it in GitHub Desktop.
Save killshot13/7f4d23c65970d24eee7e93b25404ecf4 to your computer and use it in GitHub Desktop.
Linux Terminal Snippets (randomCollection)

Linux Terminal Snippets

one-liners

(randomCollection)


Reference Guide 2 $ymbols / -root directory ~ -home directory $ -normal user # -admin (root user) % -used in C shell . -current directory .. -parent directory ? -wildcard for 1 char * -wildcard for 'chars' [] -wildcard for 1 'chars' ; -cmd sep (seq will run) && -cmd sep (seq won't run) & -cmd sep (line return) < -input from file > -output to file | -cmd chaining ! -rerun (follow w/ num) !! -rerun previous


Serves as a quick reference to view/copypasta common Linux terminal commands.

For a full cheatsheet check out Jure Šorn's downloadable Comprehensive Linux Cheatsheet.


1). Kill process LISTEN on a given port (in this case 8000):

sudo kill -9 $(lsof -t -i:8000 -sTCP:LISTEN)

2). View process running on a given port (in this case 5000):

sudo lsof -t -i:5000

3). Generate an ssh key using your email address:

ssh-keygen -t rsa -b 4096 -C your_email@example.com

4). Check which directories are currently in PATH:

echo $PATH

5). Add a directory to PATH (in this case /home/.linuxbrew/lib/ruby/gems/3.0.0/bin):

export PATH="$HOME/.linuxbrew/lib/ruby/gems/3.0.0/bin"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment