exit lab

Command Reference

Searchable Git, Docker, Linux, Maven, and PostgreSQL commands with copy buttons.

Git

git status

Show changed, staged, and untracked files.

git status

git status

git add

Stage changes for the next commit.

git add <path>

git add src/main/java/AutoPayController.java

git commit

Record staged changes as a new commit.

git commit -m "<message>"

git commit -m "fix: null pointer on empty cart"

git checkout -b

Create and switch to a new branch.

git checkout -b <branch>

git checkout -b feature/jwt-refresh-token

git log

View commit history.

git log --oneline -n <count>

git log --oneline -n 10

git stash

Temporarily shelve uncommitted changes.

git stash

git stash && git checkout main

git rebase

Replay commits from one branch onto another for a linear history.

git rebase <branch>

git rebase main

Docker

docker build

Build an image from a Dockerfile.

docker build -t <name>:<tag> <context>

docker build -t myapp:1.0 .

docker run

Start a new container from an image.

docker run -p <host>:<container> <image>

docker run -p 8080:8080 myapp:1.0

docker ps

List running containers.

docker ps

docker ps -a

docker logs

View a container's logs.

docker logs -f <container>

docker logs -f myapp

docker exec

Run a command inside a running container.

docker exec -it <container> <command>

docker exec -it myapp sh

docker image prune

Remove unused images to free disk space.

docker image prune -a

docker image prune -a

Docker Compose

docker compose up

Create and start all services defined in compose.yml.

docker compose up -d

docker compose up -d --build

docker compose down

Stop and remove containers and networks.

docker compose down

docker compose down -v

docker compose logs

View output from all services.

docker compose logs -f

docker compose logs -f api

docker compose exec

Run a command inside a running service.

docker compose exec <service> <command>

docker compose exec db psql -U postgres

docker compose ps

List the status of services in the stack.

docker compose ps

docker compose ps

Linux

systemctl status

Check whether a service is running.

systemctl status <service>

systemctl status nginx

journalctl

View systemd service logs.

journalctl -u <service> -f

journalctl -u myapp -f

df -h

Show disk usage in human-readable form.

df -h

df -h

top / htop

View running processes and resource usage.

top

htop

chmod

Change file permissions.

chmod <mode> <file>

chmod +x deploy.sh

grep

Search text by pattern.

grep -r "<pattern>" <path>

grep -r "TODO" src/

Maven

mvn clean install

Clean, compile, run tests, and install the artifact locally.

mvn clean install

mvn clean install -DskipTests

mvn test

Run the test suite.

mvn test

mvn test

mvn spring-boot:run

Run the app directly without packaging a JAR first.

mvn spring-boot:run

mvn spring-boot:run -Dspring-boot.run.profiles=dev

mvn package

Compile and package into a JAR/WAR without installing.

mvn package

mvn package -DskipTests

mvn dependency:tree

Print the full dependency tree, useful for finding version conflicts.

mvn dependency:tree

mvn dependency:tree

PostgreSQL

psql

Open an interactive PostgreSQL shell.

psql -U <user> -d <database>

psql -U postgres -d appdb

pg_dump

Back up a database to a SQL file.

pg_dump -U <user> <database> > backup.sql

pg_dump -U postgres appdb > backup.sql

pg_restore / psql <

Restore a database from a backup file.

psql -U <user> -d <database> < backup.sql

psql -U postgres -d appdb < backup.sql

\dt

List tables (inside psql).

\dt

\dt

\d <table>

Describe a table's columns and indexes (inside psql).

\d <table>

\d users

npm

npm install

Install dependencies from package.json.

npm install

npm install

npm run build

Run the build script (production build for Next.js).

npm run build

npm run build

npm run dev

Run the local dev server.

npm run dev

npm run dev

npx

Run a package binary without installing it globally.

npx <package> <args>

npx vercel --prod