mirror of
https://github.com/agresdominik/cheat_sheet.git
synced 2026-04-21 18:05:51 +00:00
211 lines
6.3 KiB
JSON
211 lines
6.3 KiB
JSON
{
|
|
"linux": [
|
|
{
|
|
"command": "du -sh --block-size=1M /path/to/directory",
|
|
"desc": "Show size of directory in MB (Change M to G for GB)"
|
|
},
|
|
{
|
|
"command": "df -h /path/to/mount",
|
|
"desc": "Show statistics about a drive (remove path for all)"
|
|
},
|
|
{
|
|
"command": "free -h",
|
|
"desc": "Display memory usage in human-readable units"
|
|
},
|
|
{
|
|
"command": "find /path/to/directory -type f | wc -l",
|
|
"desc": "Show amount of files in directory and its sub-directories"
|
|
},
|
|
{
|
|
"command": "find /path/to/directory -type f -exec grep -n 'search' {} +",
|
|
"desc": "Print all rows together with the filenames and rows a string is found in"
|
|
},
|
|
{
|
|
"command": "ss -tuln",
|
|
"desc": "Show open ports on current host (linux)"
|
|
},
|
|
{
|
|
"command": "echo Hostname: $(hostname); echo Local_IP: $(hostname -i | awk '{print $1}'); echo Default_Gateway: $(ip route | awk '/default/ {print $3}')",
|
|
"desc": "Print IP Address, Hostname, Default Route"
|
|
},
|
|
{
|
|
"command": "tar -czf backup.tgz /path/to/dir",
|
|
"desc": "Create a quick compressed backup of a directory"
|
|
},
|
|
{
|
|
"command": "find . -type f -iname 'myfile.txt'",
|
|
"desc": "Search for a specific file in folder (recursive, case-insensitive (use -name for case sensitive))"
|
|
},
|
|
{
|
|
"command": "zip -r folder_name.zip folder_name",
|
|
"desc": "Zip a folder and all of its contents into a archive"
|
|
},
|
|
{
|
|
"command": "ln -s /path/to/file file",
|
|
"desc": "Create a symbolic link pointing to a file on the system"
|
|
},
|
|
],
|
|
"python": [
|
|
{
|
|
"command": "python3 -m venv .venv && source .venv/bin/activate",
|
|
"desc": "Initialise a (simple) .venv and activate it"
|
|
},
|
|
{
|
|
"command": "python -m http.server 8000",
|
|
"desc": "Serve the current directory over HTTP on port 8000"
|
|
},
|
|
{
|
|
"command": "python -m pip install --upgrade pip",
|
|
"desc": "Upgrade pip to the latest version"
|
|
},
|
|
{
|
|
"command": "python -m pip freeze > requirements.txt",
|
|
"desc": "Export current Python dependencies to requirements.txt"
|
|
},
|
|
{
|
|
"command": "pip install jupyterlab ipykernel && python3 -m ipykernel install --user --name=project-name",
|
|
"desc": "Install and initialise the kernel to use in jupyter"
|
|
},
|
|
{
|
|
"command": "jupyter lab",
|
|
"desc": "Start Jupyiter Lab"
|
|
}
|
|
],
|
|
"go": [
|
|
{
|
|
"command": "go mod init github.com/username/projectname",
|
|
"desc": "Initialise a go project and create a mod file"
|
|
},
|
|
{
|
|
"command": "go test ./...",
|
|
"desc": "Run all Go tests recursively"
|
|
},
|
|
{
|
|
"command": "go test -bench=. ./...",
|
|
"desc": "Run all benchmarks in the module"
|
|
},
|
|
{
|
|
"command": "go list -m all",
|
|
"desc": "List all resolved module dependencies"
|
|
},
|
|
{
|
|
"command": "go get github.com/some/package@latest",
|
|
"desc": "Add dependencies"
|
|
},
|
|
{
|
|
"command": "go mod tidy",
|
|
"desc": "Tidy up unused dependencies"
|
|
},
|
|
{
|
|
"command": "go mod verify",
|
|
"desc": "Verify Integrity"
|
|
},
|
|
{
|
|
"command": "go run <target_file_or_folder>",
|
|
"desc": "Run a main.go file"
|
|
},
|
|
{
|
|
"command": "go build -o bin/<bin_name> <target_file_or_folder>",
|
|
"desc": "Build an executable"
|
|
},
|
|
{
|
|
"command": "GOOS=linux GOARCH=amd64 go build -o bin/myprogram.exe main.go",
|
|
"desc": "Cross-compile for Linux (alt. windows, darwin (arm64 / amd64))"
|
|
}
|
|
],
|
|
"git": [
|
|
{
|
|
"command": "git checkout -b branch_name",
|
|
"desc": "Create and checkout a new branch"
|
|
},
|
|
{
|
|
"command": "git rebase <target_branch>",
|
|
"desc": "Rebase commits from source branch to target branch"
|
|
},
|
|
{
|
|
"command": "git merge <target_branch>",
|
|
"desc": "Merge commits from another branch into the one command is run on"
|
|
},
|
|
{
|
|
"command": "git stash push -m 'Message/Stash Name'",
|
|
"desc": "Stash changes without commiting"
|
|
},
|
|
{
|
|
"command": "git stash pop",
|
|
"desc": "Stash changes without commiting (add stash@{n} for specific stash from 'git stash list'"
|
|
},
|
|
{
|
|
"command": "git reflog",
|
|
"desc": "Show history of all changes"
|
|
},
|
|
{
|
|
"command": "git status",
|
|
"desc": "See what is changed right now"
|
|
},
|
|
{
|
|
"command": "git remote set-url origin git@github.com:username/repo.git",
|
|
"desc": "Change origin url (example from https to ssh)"
|
|
}
|
|
],
|
|
"gpg": [
|
|
{
|
|
"command": "gpg --list-keys",
|
|
"desc": "List all imported keys"
|
|
},
|
|
{
|
|
"command": "gpg --import pubkey.asc",
|
|
"desc": "Import a downloaded key"
|
|
},
|
|
{
|
|
"command": "gpg --encrypt --sign --recipient RECIPIENT_KEY_ID message.txt",
|
|
"desc": "Encrypts message.txt with the recipients key into message.txt.gpg"
|
|
},
|
|
{
|
|
"command": "gpg --decrypt message.asc",
|
|
"desc": "Decrypt a file with a encrypted message"
|
|
},
|
|
{
|
|
"command": "gpg --export -a KEY_ID > publickey.asc",
|
|
"desc": "Export a existing (public) key into a file"
|
|
},
|
|
{
|
|
"command": "gpg --fingerprint KEY_ID",
|
|
"desc": "Check fingerprint of key"
|
|
},
|
|
{
|
|
"command": "gpg --sign-key RECIPIENT_KEY_ID",
|
|
"desc": "Sign a key"
|
|
},
|
|
{
|
|
"command": "gpg --keyserver hkps://keys.openpgp.org --send-keys RECIPIENT_KEY_ID",
|
|
"desc": "Send a signed key to a keyserver"
|
|
}
|
|
],
|
|
"security": [
|
|
{
|
|
"command": "firejail --private --net=none <application>",
|
|
"desc": "Run a command in a sandbox with no access to the home dir or the network"
|
|
},
|
|
{
|
|
"command": "nmap -p- -A <ip-address>",
|
|
"desc": "Scan a IP Address for open ports and os information"
|
|
},
|
|
{
|
|
"command": "nmap -p <port-num> -sV <ip-address>",
|
|
"desc": "Scan a specific port to see more information about service running"
|
|
},
|
|
{
|
|
"command": "nmap -p <port-num> --script ssh* <ip-address>",
|
|
"desc": "Scan a ssh port for all ssh relavant info"
|
|
},
|
|
{
|
|
"command": "chkrootkit / rkhunter --check / lynis audit system",
|
|
"desc": "System checking tools for malware and auditing on linux"
|
|
},
|
|
{
|
|
"command": "arch-audit",
|
|
"desc": "Audit installed packages for known vulnerabilities (pacman)"
|
|
}
|
|
]
|
|
}
|