<commit_before># Terminal
This is an assortment of quick references to speed up your Terminal skills!
- [Basics](#basics)
- [Listing and Navigating](#listing-and-navigating)
- [Users](#users)
- [Permissions](#permissions)
- [OS Details](#os-details)
    - [Operating System](#operating-system)
    - [CPU Info](#cpu-info)
    - [Usage Info](#usage-info)
    - [Disk Space](#disk-space)
    - [System Processes](#system-processes)
    - [GUI Processes](#gui-processes)
- [List all Keybindings](#list-all-keybindings)
    - [See Keypressed](#see-keypressed)
- [OS Shutdown](#os-shutdown)
- [Crontab](#crontab)
- [Services](#services)
- [System State](#system-state)
- [Processes](#processes)
- [Bash](#bash)
    - [Bash Paths](#bash-paths)
    - [Add to Path](#add-to-path) 
    - [Bash Completions](#bash-completions)
    - [Fix Broken Bash Completions](#fix-broken-bash-completions)
    - [Log Script from Bash](#log-script-from-bash)
- [Finding Files](#finding-files)
- [Find in Files (GREP)](#find-in-files-grep)
    - [Pipe Grep](#pipe-grep)
- [Reading Files](#reading-files)
- [Downloading Files](#downloading-files)
    - [Using Wget](#using-wget)
    - [Using cURL](#using-curl)
- [Compressing and Uncompressing Files](#compressing-and-uncompressing-files)
    - [Compressing Files](#compressing-files)
    - [Decompressing Files](#decompressing-files)
- [SCP](#scp)
    - [Download from server to local](#download-from-server-to-local)
    - [Upload from local to server](#upload-from-local-to-server)
- [SSH](#ssh)
    - [Connecting to a server](#connecting-to-a-server)
    - [SSH Permissions](#ssh-permissions)
    - [Using the Config](#using-the-config)
- [Firewall](#firewall)
    - [UFW Status](#ufw-status)
    - [UFW Enable/Disable](#ufw-enabledisable)
    - [UFW Example Customization](#ufw-example-customization)
    - [UFW More Options](#ufw-more-options)
    - [UFW Deleting Rules](#ufw-deleting-rules)
    - [UFW Reset Rules](#ufw-reset-rules)
- [MySQL](#mysql)
    - [Connecting](#connecting)
    - [Exporting Database to SQL](#exporting-database-to-sql)
    - [Importing SQL Files](#importing-sql-files)
    - [Exporting Compressed Database](#exporting-compressed-database)
    - [Importing Compressed Database](#importing-compressed-database)
- [Git](#git)
    - [Populate a Repository](#populate-a-repository)
    - [Add or Remove Files](#add-or-remove-files)
    - [Ignoring files](#ignoring-files)
    - [Create a Branch](#create-a-branch)
    - [Switch Branches](#switch-branches)
    - [Create a Tag](#create-a-tag)
    - [Remove a Tag](#remove-a-tag)
    - [Clone a Respository](#clone-a-repository)
    - [Current Status](#current-status)
    - [Commit Log and Show](#commit-log-and-show)
    - [Reset Hard](#reset-hard)
    - [Prune](#prune)

## Basics
***
[(Back to Top)](#terminal)
```
whereis bash (find absolute location of bash, or any file)
whatis ls (tells you about the command)
man ls (manual to give you a list of all command arguments for any command)
locate crontab (I like mlocate more)
which python
```

# Listing and Navigating
***
[(Back to Top)](#terminal)
```
ls              (list files)
ls -la          (list all files, permissions, and hidden too)
pwd             (print working directory)
cd ..           (go down a directory)
cd /            (go to lowest level)
cd ~            (go to logged in user's home)
cd /var/www     (go to absolute path)
```


# Users
***
[(Back to Top)](#terminal)

```
su - username       (switch users)
sudo su             (switch to root)

passwd              (change logged in users password)
passwd username     (change another users password)

useradd -m -s /bin/bash username
usermod -a -G existing_group existing_user
```

# Permissions
***
[(Back to Top)](#terminal)

```<commit_msg>groups added!<commit_after># Terminal
This is an assortment of quick references to speed up your Terminal skills!
- [Basics](#basics)
- [Listing and Navigating](#listing-and-navigating)
- [Users](#users)
- [Groups](#groups)
- [Permissions](#permissions)
- [OS Details](#os-details)
    - [Operating System](#operating-system)
    - [CPU Info](#cpu-info)
    - [Usage Info](#usage-info)
    - [Disk Space](#disk-space)
    - [System Processes](#system-processes)
    - [GUI Processes](#gui-processes)
- [List all Keybindings](#list-all-keybindings)
    - [See Keypressed](#see-keypressed)
- [OS Shutdown](#os-shutdown)
- [Crontab](#crontab)
- [Services](#services)
- [System State](#system-state)
- [Processes](#processes)
- [Bash](#bash)
    - [Bash Paths](#bash-paths)
    - [Add to Path](#add-to-path) 
    - [Bash Completions](#bash-completions)
    - [Fix Broken Bash Completions](#fix-broken-bash-completions)
    - [Log Script from Bash](#log-script-from-bash)
- [Finding Files](#finding-files)
- [Find in Files (GREP)](#find-in-files-grep)
    - [Pipe Grep](#pipe-grep)
- [Reading Files](#reading-files)
- [Downloading Files](#downloading-files)
    - [Using Wget](#using-wget)
    - [Using cURL](#using-curl)
- [Compressing and Uncompressing Files](#compressing-and-uncompressing-files)
    - [Compressing Files](#compressing-files)
    - [Decompressing Files](#decompressing-files)
- [SCP](#scp)
    - [Download from server to local](#download-from-server-to-local)
    - [Upload from local to server](#upload-from-local-to-server)
- [SSH](#ssh)
    - [Connecting to a server](#connecting-to-a-server)
    - [SSH Permissions](#ssh-permissions)
    - [Using the Config](#using-the-config)
- [Firewall](#firewall)
    - [UFW Status](#ufw-status)
    - [UFW Enable/Disable](#ufw-enabledisable)
    - [UFW Example Customization](#ufw-example-customization)
    - [UFW More Options](#ufw-more-options)
    - [UFW Deleting Rules](#ufw-deleting-rules)
    - [UFW Reset Rules](#ufw-reset-rules)
- [MySQL](#mysql)
    - [Connecting](#connecting)
    - [Exporting Database to SQL](#exporting-database-to-sql)
    - [Importing SQL Files](#importing-sql-files)
    - [Exporting Compressed Database](#exporting-compressed-database)
    - [Importing Compressed Database](#importing-compressed-database)
- [Git](#git)
    - [Populate a Repository](#populate-a-repository)
    - [Add or Remove Files](#add-or-remove-files)
    - [Ignoring files](#ignoring-files)
    - [Create a Branch](#create-a-branch)
    - [Switch Branches](#switch-branches)
    - [Create a Tag](#create-a-tag)
    - [Remove a Tag](#remove-a-tag)
    - [Clone a Respository](#clone-a-repository)
    - [Current Status](#current-status)
    - [Commit Log and Show](#commit-log-and-show)
    - [Reset Hard](#reset-hard)
    - [Prune](#prune)

## Basics
***
[(Back to Top)](#terminal)
```
whereis bash (find absolute location of bash, or any file)
whatis ls (tells you about the command)
man ls (manual to give you a list of all command arguments for any command)
locate crontab (I like mlocate more)
which python
```

# Listing and Navigating
***
[(Back to Top)](#terminal)
```
ls              (list files)
ls -la          (list all files, permissions, and hidden too)
pwd             (print working directory)
cd ..           (go down a directory)
cd /            (go to lowest level)
cd ~            (go to logged in user's home)
cd /var/www     (go to absolute path)
```


# Users
***
[(Back to Top)](#terminal)

```
su - username       (switch users)
sudo su             (switch to root)

passwd              (change logged in users password)
passwd username     (change another users password)

useradd -m -s /bin/bash username
usermod -a -G existing_group existing_user
```

# Groups
***
[(Back to Top)](#terminal)
Do not delete groups you don't know what they are used for, that's dangerous!
```
groups                  (see what groups current user belongs to)
groupadd name           (create a group)
groupadd -g 900 name    (create a group with custom GroupID aka gid)

groupdel name           (delete a group)
sudo useradd <group>    (add current user to a group)

cat /etc/group          (list all groups)
cut -d: -f1 /etc/group  (list all groups, cleaner)

```

# Permissions
***
[(Back to Top)](#terminal)

```
{'fraction_non_alphanumeric': 0.15918114143920595, 'fraction_numerical': 0.0004962779156327543, 'mean_word_length': 3.359653866955111, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1485172', 'n_tokens_mistral': 2848, 'n_tokens_neox': 2587, 'n_words': 674}