Skip to content

Latest commit

 

History

History
218 lines (149 loc) · 5.14 KB

File metadata and controls

218 lines (149 loc) · 5.14 KB

Useful programs

Table of contents

Browser

Browsers:

Chrome

Chrome is a web browser developed by Google.

It is available on:

Docs:

Firefox

Firefox is a web browser developed by Mozilla.

It is available on

Docs:

Safari

Safari is a web browser developed by Apple.

It is available on:

Docs:

curl

curl is a command-line tool for transferring data with URLs, commonly used to send HTTP requests.

Send a GET request with curl

curl <url>

Example:

curl http://127.0.0.1:8080/status

Common curl flags

Flag Description
-s Silent — suppresses progress output. Useful when piping to jq.
-X <method> Set the HTTP method (e.g., -X POST).
-H <header> Add a request header (e.g., -H "Authorization: Bearer <token>").
-d <data> Send a request body (e.g., -d '{"key": "value"}').

git

git is a version control system for tracking changes in files and coordinating work across a team. See the git wiki for detailed documentation.

Common git commands

Command Description
git status Show the current state of the working tree.
git add <file> Stage a file for the next commit.
git commit -m "<message>" Create a commit with a message.
git push Push commits to the remote repository.
git pull Fetch and merge changes from the remote.
git log Show the commit history.

source

source is a shell builtin that executes a file in the current shell session, not a subprocess.

It is commonly used to activate a Python virtual environment. Example:

source .venv/bin/activate

Note

Unlike running a script with bash script.sh, source applies changes (such as environment variable updates) directly to the current shell.

bash

bash runs a shell script file.

bash <script.sh>

Example:

bash setup.sh

jq

jq is a command-line JSON processor. It is commonly used to format and filter JSON output from commands like curl.

Format JSON output with jq

Pipe the output of any command that returns JSON to jq to pretty-print it:

curl -s <url> | jq

Common jq filters

Filter Description
. Output the full JSON with pretty formatting.
.<key> Extract a top-level field (e.g., .name).
.[<index>] Extract an element from an array (e.g., .[0]).
.[] Iterate over all elements in an array or object.
.[].key Extract a field from each element of an array.

find

find searches for files and directories within a directory tree.

Find files with find

find <directory> -name "<pattern>"

Example — find all Python files in the current directory:

find . -name "*.py"

Common find flags

Flag Description
-name "<pattern>" Match by filename (supports wildcards, e.g., "*.py").
-type f Match regular files only.
-type d Match directories only.
-not -path "<pattern>" Exclude paths matching the pattern.

ripgrep

ripgrep (rg) searches file contents recursively for a text pattern. It is faster than grep and respects .gitignore by default.

Search text with rg

rg "<pattern>"

Example — find all occurrences of TODO in the current directory:

rg "TODO"

Common rg flags

Flag Description
-i Case-insensitive search.
-l List only file names with matches, not the matching lines.
-n Show line numbers (enabled by default).
-t <type> Limit to a file type (e.g., -t py for Python).
--no-ignore Don't respect .gitignore rules.