commands.sh
$ 144 commands available. Type to search or click to explore.

Recipes

Setup Useful Git Aliases

Recommended aliases from git documentation.

git
# Shortening Aliasesgit config --global alias.co checkoutgit config --global alias.br branchgit config --global alias.cm commitgit config --global alias.st status# Simplify Common Actionsgit config --global alias.unstage 'reset HEAD --'git config --global alias.last 'log -1 HEAD'

Git Feature Branch Workflow

Create a feature branch, make changes, and merge back to main.

git
# Create and switch to feature branchgit checkout -b feature/my-feature# Make your changes, then stage and commitgit add .git commit -m "Add new feature"# Push feature branch to remotegit push -u origin feature/my-feature# After PR is merged, cleanupgit checkout maingit pullgit branch -d feature/my-feature

Undo Last Git Commit

Undo the last commit while keeping changes staged.

git
# Undo last commit, keep changes stagedgit reset --soft HEAD~1# Or undo and unstage changesgit reset HEAD~1# Or completely discard changes (DESTRUCTIVE)git reset --hard HEAD~1

Git Stash Workflow

Save work in progress, switch branches, and restore.

git
# Save current changes to stashgit stash push -m "WIP: work in progress"# List all stashesgit stash list# Apply most recent stash (keeps stash)git stash apply# Apply and remove most recent stashgit stash pop# Apply a specific stashgit stash apply stash@{0}

Interactive Git Rebase

Squash, reorder, or edit recent commits.

git
# Rebase last N commits interactivelygit rebase -i HEAD~3# In the editor, change 'pick' to:# - 'squash' or 's' to combine with previous# - 'reword' or 'r' to edit message# - 'drop' or 'd' to remove commit# - 'edit' or 'e' to stop and amend# If you mess up, abort:git rebase --abort

Docker Compose Dev Environment

Start, stop, and manage a Docker Compose environment.

docker
# Start all services in backgrounddocker compose up -d# View logs (follow mode)docker compose logs -f app# Rebuild and restart a specific servicedocker compose up -d --build app# Stop all servicesdocker compose down# Stop and remove volumes (DESTRUCTIVE)docker compose down -v

Docker Cleanup

Remove unused Docker resources to free disk space.

docker
# Remove stopped containersdocker container prune -f# Remove unused imagesdocker image prune -f# Remove unused volumes (CAREFUL - data loss)docker volume prune -f# Nuclear option: remove everything unuseddocker system prune -a -f --volumes# Check disk usagedocker system df

Docker Build and Push

Build a Docker image and push to a registry.

docker
# Build with tagdocker build -t myapp:latest .# Tag for registrydocker tag myapp:latest ghcr.io/username/myapp:latest# Push to registrydocker push ghcr.io/username/myapp:latest

SSH Key Setup

Generate SSH key and add to ssh-agent.

devops
# Generate new SSH keyssh-keygen -t ed25519 -C "[email protected]"# Start ssh-agenteval "$(ssh-agent -s)"# Add key to agentssh-add ~/.ssh/id_ed25519# Copy public key to clipboard (macOS)cat ~/.ssh/id_ed25519.pub | pbcopy# Test connection (for GitHub)ssh -T [email protected]

Find and Kill Process by Port

Find which process is using a port and kill it.

sysadmin
# Find process using port (macOS/Linux)lsof -i :3000# Kill process by PIDkill -9 12345# One-liner to kill process on port (macOS)lsof -ti :3000 | xargs kill -9# Alternative using fuser (Linux)fuser -k 3000/tcp

Disk Space Analysis

Find what's using disk space.

sysadmin
# Show disk usage summarydf -h# Find largest directories in current folderdu -sh * | sort -hr | head -20# Find largest files (over 100MB)find . -type f -size +100M -exec ls -lh {} \;# Interactive disk usage (if ncdu installed)ncdu .

Create Node.js Project

Initialize a new Node.js project with TypeScript.

setup
# Create directory and initmkdir my-project && cd my-projectnpm init -y# Install TypeScript and typesnpm install -D typescript @types/node ts-node# Create tsconfignpx tsc --init# Create source directorymkdir src && touch src/index.ts# Add scripts to package.jsonnpm pkg set scripts.build="tsc"npm pkg set scripts.dev="ts-node src/index.ts"

Quick HTTP Server

Serve current directory over HTTP for testing.

devops
# Python 3python3 -m http.server 8000# Node.js (npx)npx serve -p 8000# PHPphp -S localhost:8000

Generate Random Password

Generate a secure random password.

sysadmin
# Using opensslopenssl rand -base64 32# Using /dev/urandom (alphanumeric)cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1# Using Pythonpython3 -c "import secrets; print(secrets.token_urlsafe(32))"

Tail Logs with Highlight

Monitor log files with pattern highlighting.

sysadmin
# Tail with grep highlighttail -f /var/log/app.log | grep --color=always -E 'ERROR|$'# Multiple patternstail -f /var/log/app.log | grep --color=always -E 'ERROR|WARN|$'# Using less for scrollbackless +F /var/log/app.log

Sync Files with Rsync

Efficiently sync files between locations.

sysadmin
# Sync local to remotersync -avz --progress ./src/ [email protected]:/backup/src/# Sync with delete (mirror exactly)rsync -avz --delete ./src/ /backup/src/# Dry run (see what would happen)rsync -avzn ./src/ /backup/src/# Exclude patternsrsync -avz --exclude='node_modules' --exclude='.git' ./src/ /backup/src/

All Commands

alias
all

Create aliases - words that are replaced by a command string. Aliases expire with the current shell session unless defined in the shell's configuration file, e.g. `~/.bashrc` for Bash or `~/.zshrc` for Zsh. See also: `unalias`.

6 examples

ansible
all

Manage groups of computers remotely over SSH. (use the `/etc/ansible/hosts` file to add new groups/hosts). Some subcommands such as `galaxy` have their own usage documentation.

7 examples

apt
linux

Package manager for Debian-based distributions. Intended as a user-friendly alternative to `apt-get` for interactive use. For equivalent commands in other package managers, see <https://wiki.archlinux.org/title/Pacman/Rosetta>.

8 examples

apt-get
linux

Debian and Ubuntu package management utility. Search for packages using `apt-cache`. It is recommended to use `apt` when used interactively in Ubuntu versions 16.04 and later.

8 examples

awk
all

A versatile programming language for working on files. Note: Different implementations of AWK often make this a symlink of their binary. See also: `gawk`.

8 examples

aws
all

The official CLI tool for Amazon Web Services. Some subcommands such as `s3` have their own usage documentation.

8 examples

az
all

The official CLI tool for Microsoft Azure. Some subcommands such as `login` have their own usage documentation.

8 examples

base64
all

Encode or decode file or `stdin` to/from base64, to `stdout`.

5 examples

bun
all

JavaScript runtime and toolkit. Includes a bundler, a test runner, and a package manager.

8 examples

cal
all

Display a calendar with the current day highlighted. See also: `gcal`.

3 examples

cargo
all

Manage Rust projects and their module dependencies (crates). Some subcommands such as `build` have their own usage documentation.

8 examples

cat
all

Print and concatenate files.

5 examples

cd
all

Change the current working directory.

6 examples

chmod
all

Change the access permissions of a file or directory.

8 examples

chown
all

Change user and group ownership of files and directories. See also: `chgrp`.

7 examples

cmake
all

Cross-platform build automation system, that generates recipes for native build systems.

8 examples

code
all

Cross platform and extensible code editor.

8 examples

convert
all

This command is an alias of `magick convert`. Note: This alias is deprecated since ImageMagick 7. It has been replaced by `magick`. Use `magick convert` if you need to use the old tool in versions 7+.

1 example

cp
all

Copy files and directories.

8 examples

cron
all

A system scheduler for running jobs or tasks unattended. The command to submit, edit, or delete entries to `cron` is called `crontab`.

1 example

crontab
all

Schedule cron jobs to run on a time interval for the current user.

8 examples

curl
all

Transfers data from or to a server. Supports most protocols, including HTTP, HTTPS, FTP, SCP, etc. See also: `wcurl`, `wget`.

8 examples

date
all

Set or display the system date.

8 examples

df
all

Display an overview of the filesystem disk space usage.

4 examples

diff
all

Compare files and directories. See also: `delta`, `difft`.

8 examples

docker
all

Manage Docker containers and images. Some subcommands such as `container` and `image` have their own usage documentation.

8 examples

docker-build
all

Build an image from a Dockerfile.

7 examples

docker-compose
all

Run and manage multi container Docker applications.

8 examples

docker-exec
all

This command is an alias of `docker container exec`.

1 example

docker-logs
all

This command is an alias of `docker container logs`.

1 example

docker-ps
all

This command is an alias of `docker container ls`.

1 example

docker-pull
all

This command is an alias of `docker image pull`.

1 example

docker-rm
all

This command is an alias of `docker container rm`.

1 example

docker-run
all

This command is an alias of `docker container run`.

1 example

du
all

Disk usage: estimate and summarize file and directory space usage.

7 examples

echo
all

Print given arguments. See also: `printf`.

7 examples

env
all

Show the environment or run a program in a modified environment.

7 examples

export
all

Export shell variables to child processes.

2 examples

ffmpeg
all

Video conversion tool. See also: `gst-launch-1.0`.

8 examples

find
all

Find files or directories under a directory tree, recursively. See also: `fd`.

8 examples

free
linux

Display amount of free and used memory in the system.

4 examples

g++
all

Compile C++ source files. Part of GCC (GNU Compiler Collection).

8 examples

gcc
all

Preprocess and compile C and C++ source files, then assemble and link them together. Part of GCC (GNU Compiler Collection).

8 examples

gcloud
all

The official CLI tool for Google Cloud Platform. Some subcommands such as `app` and `init` have their own usage documentation.

8 examples

gdb
all

The GNU Debugger.

6 examples

gh
all

Work seamlessly with GitHub. Some subcommands such as `config` have their own usage documentation.

8 examples

git
all

Distributed version control system. Some subcommands such as `commit`, `add`, `branch`, `switch`, `push`, etc. have their own usage documentation.

8 examples

git-add
all

Adds changed files to the index.

8 examples

git-branch
all

Main Git command for working with branches.

8 examples

git-checkout
all

Checkout a branch or paths to the working tree.

8 examples

git-clone
all

Clone an existing repository.

8 examples

git-commit
all

Commit files to the repository.

7 examples

git-diff
all

Show changes to tracked files.

8 examples

git-fetch
all

Download objects and refs from a remote repository.

7 examples

git-init
all

Initialize a new local Git repository.

4 examples

git-log
all

Show a history of commits.

8 examples

git-merge
all

Merge branches.

5 examples

git-pull
all

Fetch branch from a remote repository and merge it to local repository.

3 examples

git-push
all

Push commits to a remote repository.

8 examples

git-rebase
all

Reapply commits from one branch on top of another branch. Commonly used to "move" an entire branch to another base, creating copies of the commits in the new location.

8 examples

git-remote
all

Manage set of tracked repositories ("remotes").

7 examples

git-reset
all

Undo commits or unstage changes by resetting the current Git HEAD to the specified state. If a path is passed, it works as "unstage"; if a commit hash or branch is passed, it works as "uncommit".

7 examples

git-revert
all

Create new commits which reverse the effect of earlier ones.

6 examples

git-stash
all

Stash local Git changes in a temporary area.

8 examples

git-status
all

Show the changes to files in a Git repository. List changed, added, and deleted files compared to the currently checked-out commit.

7 examples

git-switch
all

Switch between Git branches. Requires Git version 2.23+. See also: `git checkout`.

7 examples

git-tag
all

Create, list, delete, or verify tags. A tag is a static reference to a commit.

8 examples

go
all

Manage Go source code. Some subcommands such as `build` have their own usage documentation.

7 examples

grep
all

Find patterns in files using `regex`es. See also: `regex`.

8 examples

gunzip
all

This command is an alias of `gzip --decompress`.

1 example

gzip
all

Compress/uncompress files with `gzip` compression (LZ77).

8 examples

head
all

Output the first part of files.

1 example

history
all

Manage command-line history.

8 examples

hostname
all

Show or set the system's host name.

4 examples

htop
all

Display dynamic real-time information about running processes. An enhanced version of `top`. See also: `top`, `atop`, `glances`, `btop`, `btm`.

8 examples

ifconfig
all

Network Interface Configurator.

5 examples

ip
linux

Show/manipulate routing, devices, policy routing and tunnels. Some subcommands such as `address` have their own usage documentation.

8 examples

java
all

Java application launcher.

6 examples

javac
all

Java application compiler.

4 examples

jq
all

A JSON processor that uses a domain-specific language (DSL).

8 examples

kill
all

Send a signal to a process, usually related to stopping the process. All signals except for SIGKILL and SIGSTOP can be intercepted by the process to perform a clean exit.

7 examples

killall
all

Send kill signal to all instances of a process by name (must be exact name). All signals except SIGKILL and SIGSTOP can be intercepted by the process, allowing a clean exit.

5 examples

kubectl
all

Run commands against Kubernetes clusters. Some subcommands such as `run` have their own usage documentation.

8 examples

less
all

Open a file for interactive reading, allowing scrolling and search.

8 examples

ln
all

Create links to files and directories.

4 examples

ls
all

List directory contents.

8 examples

make
all

Task runner for targets described in Makefile. Mostly used to control the compilation of an executable from source code.

8 examples

man
all

Format and display manual pages. See also: `whatis`, `apropos`.

8 examples

md5sum
all

Calculate MD5 cryptographic checksums.

7 examples

mkdir
all

Create directories and set their permissions.

4 examples

mongosh
all

A new shell for MongoDB, replacement for `mongo`. Note: All connection options can be replaced with one string: `mongodb://user@host:port/db_name?authSource=authdb_name`.

4 examples

mv
all

Move or rename files and directories.

8 examples

mysql
all

The MySQL tool.

7 examples

nano
all

Text editor. An enhanced `pico` clone. See also: `pico`, `rnano`.

8 examples

netstat
all

Display network-related information such as open connections, open socket ports, etc. See also: `ss`.

7 examples

nmap
all

Network exploration tool and security/port scanner. Some features (e.g. SYN scan) activate only when `nmap` is run with root privileges. See also: `hping3`, `masscan`, `naabu`, `rustscan`, `zmap`.

8 examples

node
all

Server-side JavaScript platform (Node.js).

6 examples

nohup
all

Allows for a process to live when the terminal gets killed.

4 examples

npm
all

JavaScript and Node.js package manager. Manage Node.js projects and their module dependencies.

8 examples

npx
all

This command is an alias of `npm exec`.

1 example

openssl
all

OpenSSL cryptographic toolkit. Some subcommands such as `req` have their own usage documentation.

8 examples

ping
all

Send ICMP ECHO_REQUEST packets to network hosts.

7 examples

pip
all

Python package manager. Some subcommands such as `install` have their own usage documentation.

8 examples

pip3
all

This command is an alias of `pip`.

1 example

pkill
all

Signal process by name. Mostly used for stopping processes.

5 examples

pnpm
all

Fast, disk space efficient package manager for Node.js. Manage Node.js projects and their module dependencies.

8 examples

printf
all

Format and print text. See also: `echo`.

6 examples

ps
all

Information about running processes.

7 examples

psql
all

PostgreSQL client.

5 examples

python
all

Python language interpreter.

8 examples

python3
all

This command is an alias of `python`.

1 example

redis-cli
all

Open a connection to a Redis server.

7 examples

rm
all

Remove files or directories. See also: `rmdir`, `trash`.

6 examples

rmdir
all

Remove directories without files. See also: `rm`.

3 examples

rsync
all

Transfer files either to or from a remote host (but not between two remote hosts), by default using SSH. To specify a remote path, use `user@host:path/to/file_or_directory`.

8 examples

rustc
all

The Rust compiler. Rust projects usually use `cargo` instead of invoking `rustc` directly.

7 examples

scp
all

Secure copy. Copy files between hosts using Secure Copy Protocol over SSH.

8 examples

screen
all

Hold a session open on a remote server. Manage multiple windows with a single SSH connection. See also: `tmux`, `zellij`.

8 examples

sed
all

Edit text in a scriptable manner. See also: `awk`, `ed`.

3 examples

sha256sum
all

Calculate SHA256 cryptographic checksums.

7 examples

sort
all

Sort lines of text files.

8 examples

source
all

Execute commands from a file in the current shell.

2 examples

ssh
all

Secure Shell is a protocol used to securely log onto remote systems. It can be used for logging or executing commands on a remote server.

8 examples

sudo
all

Execute a single command as the superuser or another user. See also: `pkexec`, `run0`, `doas`.

8 examples

systemctl
linux

Control the systemd system and service manager. Some subcommands such as `disable`, `status`, `reboot` etc. have their own usage documentation.

8 examples

tail
all

Display the last part of a file. See also: `head`.

8 examples

tar
all

Archiving utility. Often combined with a compression method, such as `gzip` or `bzip2`.

8 examples

tee
all

Read from `stdin` and write to `stdout` and files (or commands).

4 examples

terraform
all

Create and deploy infrastructure as code to cloud providers.

6 examples

tmux
all

Terminal multiplexer. It allows multiple sessions with windows, panes, and more. See also: `zellij`, `screen`.

8 examples

touch
all

Create files and set access/modification times.

7 examples

uname
all

Print details about the current machine and the operating system running on it. See also: `lsb_release`.

7 examples

uniq
all

Output the unique lines from a input or file. Since it does not detect repeated lines unless they are adjacent, we need to sort them first. See also: `sort`.

7 examples

unzip
all

Extract files/directories from Zip archives. See also: `zip`.

6 examples

uptime
all

Tell how long the system has been running and other information.

5 examples

vim
all

Vim (Vi IMproved), a command-line text editor, provides several modes for different kinds of text manipulation. Pressing `<i>` in normal mode enters insert mode. Pressing `<Esc>` goes back to normal mode, which enables the use of Vim commands. See also: `vimdiff`, `vimtutor`, `nvim`, `gvim`.

8 examples

wc
all

Count lines, words, and bytes.

6 examples

wget
all

Download files from the Web. Supports HTTP, HTTPS, and FTP. See also: `wcurl`, `curl`.

8 examples

which
all

Locate a program in the user's `$PATH`. See also: `whereis`, `type`.

2 examples

whoami
all

This command is an alias of `id --user --name`.

1 example

xargs
all

Execute a command with piped arguments coming from another command, a file, etc. The input is treated as a single block of text and split into separate pieces on spaces, tabs, newlines, and end-of-file. See also: `parallel`.

8 examples

yarn
all

JavaScript and Node.js package manager alternative.

6 examples

yq
all

A lightweight and portable YAML processor.

8 examples

zip
all

Package and compress (archive) files into a Zip archive. See also: `unzip`.

7 examples

made by @shridhargupta | data from tldr-pages