DEV Community

Ashen Chathuranga
Ashen Chathuranga

Posted on

My Command Reference

Docker Commands

Container Management

# List all containers (running and stopped)
docker ps -a

# List only running containers
docker ps

# Stop all running containers
docker stop $(docker ps -q)

# Remove all stopped containers
docker rm $(docker ps -aq)

# Remove all containers (running and stopped)
docker rm -f $(docker ps -aq)

# Stop and remove a specific container
docker rm -f <container_name_or_id>

# Remove all unused containers, networks, images
docker system prune

# Remove everything including volumes
docker system prune -a --volumes
Enter fullscreen mode Exit fullscreen mode

Image Management

# List all images
docker images

# Remove all unused images
docker image prune -a

# Remove specific image
docker rmi <image_name_or_id>

# Remove all images
docker rmi $(docker images -q)

# Build image from Dockerfile
docker build -t <tag_name> .

# Pull image from registry
docker pull <image_name>
Enter fullscreen mode Exit fullscreen mode

Running Containers

# Run container interactively
docker run -it <image_name> /bin/bash

# Run container in background
docker run -d <image_name>

# Run with port mapping
docker run -p <host_port>:<container_port> <image_name>

# Run with volume mount
docker run -v <host_path>:<container_path> <image_name>
Enter fullscreen mode Exit fullscreen mode

Logs and Debugging

# View container logs
docker logs <container_name_or_id>

# Follow logs in real-time
docker logs -f <container_name_or_id>

# Execute command in running container
docker exec -it <container_name_or_id> /bin/bash

# Inspect container details
docker inspect <container_name_or_id>
Enter fullscreen mode Exit fullscreen mode

Arduino CLI Commands

Board Management

# Update board package index
arduino-cli core update-index

# Install board package (e.g., ESP32)
arduino-cli core install esp32:esp32

# List installed boards
arduino-cli core list

# List available boards
arduino-cli board listall

# Search for boards
arduino-cli core search <board_name>
Enter fullscreen mode Exit fullscreen mode

Library Management

# Update library index
arduino-cli lib update-index

# Install library
arduino-cli lib install "<library_name>"

# List installed libraries
arduino-cli lib list

# Search for libraries
arduino-cli lib search <library_name>

# Uninstall library
arduino-cli lib uninstall "<library_name>"
Enter fullscreen mode Exit fullscreen mode

Compilation and Upload

# Compile sketch
arduino-cli compile --fqbn <board_fqbn> <sketch_path>

# Upload to board
arduino-cli upload -p <port> --fqbn <board_fqbn> <sketch_path>

# Compile and upload in one command
arduino-cli compile --upload -p <port> --fqbn <board_fqbn> <sketch_path>

# Set upload speed (in sketch or command)
arduino-cli upload -p <port> --fqbn <board_fqbn> <sketch_path> --upload-field upload.speed=921600
Enter fullscreen mode Exit fullscreen mode

Board Detection and Port Management

# List connected boards
arduino-cli board list

# Get board info
arduino-cli board details --fqbn <board_fqbn>

# Common FQBNs:
# Arduino Uno: arduino:avr:uno
# ESP32: esp32:esp32:esp32
# ESP8266: esp8266:esp8266:nodemcuv2
Enter fullscreen mode Exit fullscreen mode

Serial Monitor with picocom

# Connect to serial port
picocom -b 115200 /dev/ttyUSB0

# Connect with different baud rates
picocom -b 9600 /dev/ttyUSB0
picocom -b 57600 /dev/ttyUSB0
picocom -b 921600 /dev/ttyUSB0

# Exit picocom: Ctrl+A then Ctrl+X

# List available serial ports
ls /dev/tty*
# or
dmesg | grep tty
Enter fullscreen mode Exit fullscreen mode

Arduino IDE Configuration Files

# Preferences location (Linux)
~/.arduino15/

# Sketches default location
~/Arduino/

# Set upload speed in boards.txt or via IDE:
# Tools -> Upload Speed -> Select desired speed
Enter fullscreen mode Exit fullscreen mode

Useful Arduino Compile Flags

# Verbose compilation output
arduino-cli compile --verbose --fqbn <board_fqbn> <sketch_path>

# Enable warnings
arduino-cli compile --warnings all --fqbn <board_fqbn> <sketch_path>

# Clean build
arduino-cli compile --clean --fqbn <board_fqbn> <sketch_path>
Enter fullscreen mode Exit fullscreen mode

Top comments (0)