DEV Community

Cover image for πŸ”₯ The Ultimate Cheat Sheet 1000+ Essential Commands & Growing !! All in One Place - Don’t Miss Out! πŸš€πŸ’»βš‘
Ramkumar M N
Ramkumar M N

Posted on

12 2 4 2 3

πŸ”₯ The Ultimate Cheat Sheet 1000+ Essential Commands & Growing !! All in One Place - Don’t Miss Out! πŸš€πŸ’»βš‘

πŸš€ Introduction

Welcome to the Ultimate CLI Cheat Sheetβ€”your one-stop reference for 1000+ essential command-line interface (CLI) commands across various platforms! Whether you're a beginner or an advanced user, this guide will help you find and execute commands quickly.

πŸ“Œ How to Use This Blog

  • Easily Navigate: Use the table of contents to jump to any section instantly.
  • Find Commands Fast: Click on any item in the table to go directly to the relevant commands.
  • Copy & Use: Simply copy the commands and run them in your terminal.
  • πŸ” Looking for a specific CLI command? Use Ctrl + F (Windows/Linux) or Cmd + F (Mac) to search within the page.
  • πŸ“Œ Quick Navigation: At the bottom of every section, you’ll find ⬆️ Go to Top | ⬇️ Go to Bottom section links for easy navigation.

πŸ’¬ Contribute & Stay Updated

  • πŸ’‘ Want a new topic to be included? Drop a comment below!
  • ⚠️ Found a command that isn’t working? Let me know in the comments, and I’ll update it.

  • We will periodically update this cheat sheet with new topics and the latest CLI commands, so add this blog to your reading list and don’t forget to like & support! πŸ‘πŸ”₯

Table

Category CLI Commands
πŸ“ Version Control Git πŸ› οΈ
🐳 Containerization and Orchestration Docker πŸ‹ , Kubernetes (kubectl) ☸️ , Helm βš“
βš™οΈ Scripting and Automation Bash πŸ–₯️ , Jenkins πŸš€ , Terraform 🌍 , Ansible πŸ€–
☁️ Cloud Services and CLI Tools AWS CLI πŸ—οΈ , Azure CLI πŸ”· , AWS SageMaker πŸ“Š
πŸ”„ Workflow and Data Pipelines Apache Airflow 🌬️ , MLflow πŸ”¬
🌐 Web Servers and Networking Nginx 🌍 , TCP/IP πŸ“‘ , DNS πŸ”—
πŸ—„οΈ Databases MySQL 🏦 , PostgreSQL 🐘
πŸ“Š Monitoring and Logging Prometheus πŸ“ˆ
πŸ› οΈ Development Tools Expo πŸ“± , NPM πŸ“¦ , YARN 🧢 , PIP 🐍
πŸ“¦ Package Managers APT πŸ“Œ , YUM 🍽️
πŸ”§ Utilities CURL 🌐
πŸ“© Messaging and Queuing MQTT πŸ“‘ , RabbitMQ 🐰 , Kafka πŸ”₯
πŸ” Code Quality and Security SonarQube πŸ›‘οΈ

⬆️ Go to Top | ⬇️ Go to Bottom


Version Control

GIT CLI commands

Basic Commands

git init # Initialize a new Git repository.
git clone [url] # Clone an existing repository.
git status # Show the working directory status.
git add [file] # Add a file to the staging area.
git commit -m "[message]" # Commit changes with a message.
git push # Push changes to a remote repository.
git pull # Fetch and merge changes from a remote repository.
Enter fullscreen mode Exit fullscreen mode

Branching and Merging

git branch # List branches.
git branch [branch-name] # Create a new branch.
git checkout [branch-name] # Switch to a branch.
git merge [branch-name] # Merge a branch into the current branch.
Enter fullscreen mode Exit fullscreen mode

Viewing History

git log # View commit history.
git diff # Show changes between commits, branches, etc.
git show [commit] # Show details of a specific commit.
Enter fullscreen mode Exit fullscreen mode

Undoing Changes

git reset [commit] # Reset to a specific commit.
git revert [commit] # Create a new commit that undoes changes from a previous commit.
git stash # Stash changes in a dirty working directory.
Enter fullscreen mode Exit fullscreen mode

Remote Repositories

git remote # Manage set of tracked repositories.
git remote add [name] [url] # Add a new remote repository.
git fetch [remote] # Fetch changes from a remote repository.
Enter fullscreen mode Exit fullscreen mode

Advanced Commands

git rebase [branch] # Reapply commits on top of another base tip.
git cherry-pick [commit] # Apply the changes introduced by some existing commits.
git bisect # Use binary search to find the commit that introduced a bug.
git tag [tag-name] # Create a tag for marking a specific point in history.
git archive # Create an archive of files from a named tree.
Enter fullscreen mode Exit fullscreen mode

Configuration

git config --global user.name "[name]" # Set the name for all repositories on your system.
git config --global user.email "[email]" # Set the email for all repositories on your system.
git config --list # List all configuration settings.
Enter fullscreen mode Exit fullscreen mode

Collaboration

git fetch --all # Fetch all branches from all remotes.
git pull --rebase # Fetch and rebase the current branch.
git push --tags # Push all tags to the remote repository.
Enter fullscreen mode Exit fullscreen mode

Cleanup

git clean -f # Remove untracked files from the working directory.
git gc # Cleanup unnecessary files and optimize the local repository.
Enter fullscreen mode Exit fullscreen mode

⬆️ Go to Top | ⬇️ Go to Bottom


Containerization and Orchestration

DOCKER CLI commands

Basic Commands

docker --version # Show the Docker version information.
docker info # Display system-wide information.
docker help # Get help on Docker commands.
Enter fullscreen mode Exit fullscreen mode

Container Management

docker run [options] IMAGE [command] [args] # Run a command in a new container.
docker start [container] # Start one or more stopped containers.
docker stop [container] # Stop one or more running containers.
docker restart [container] # Restart one or more containers.
docker rm [container] # Remove one or more containers.
docker ps # List running containers.
docker ps -a # List all containers.
Enter fullscreen mode Exit fullscreen mode

Image Management

docker pull [image] # Pull an image from a registry.
docker push [image] # Push an image to a registry.
docker build [options] PATH | URL | - # Build an image from a Dockerfile.
docker images # List images.
docker rmi [image] # Remove one or more images.
Enter fullscreen mode Exit fullscreen mode

Network Management

docker network ls # List networks.
docker network create [network] # Create a new network.
docker network rm [network] # Remove one or more networks.
docker network inspect [network] # Display detailed information on one or more networks.
Enter fullscreen mode Exit fullscreen mode

Volume Management

docker volume ls # List volumes.
docker volume create [volume] # Create a new volume.
docker volume rm [volume] # Remove one or more volumes.
docker volume inspect [volume] # Display detailed information on one or more volumes.
Enter fullscreen mode Exit fullscreen mode

Docker Compose

docker-compose up # Create and start containers.
docker-compose down # Stop and remove containers, networks, images, and volumes.
docker-compose build # Build or rebuild services.
docker-compose logs # View output from containers.
Enter fullscreen mode Exit fullscreen mode

Advanced Container Management

docker exec [options] CONTAINER COMMAND [args] # Run a command in a running container.
docker attach [container] # Attach local standard input, output, and error streams to a running container.
docker logs [container] # Fetch the logs of a container.
docker inspect [container|image] # Return low-level information on Docker objects.
Enter fullscreen mode Exit fullscreen mode

Security

docker scan [image] # Scan an image for vulnerabilities.
docker secret create [secret_name] [file] # Create a secret from a file or STDIN as content.
docker secret ls # List secrets.
docker secret rm [secret_name] # Remove one or more secrets.
Enter fullscreen mode Exit fullscreen mode

Swarm Management

docker swarm init # Initialize a swarm.
docker swarm join [options] # Join a swarm as a node.
docker node ls # List nodes in the swarm.
docker service create [options] IMAGE [command] [args] # Create a new service.
docker service ls # List services.
docker service rm [service] # Remove one or more services.
Enter fullscreen mode Exit fullscreen mode

System Commands

docker system df # Show Docker disk usage.
docker system prune # Remove unused data.
docker system events # Get real-time events from the server.
Enter fullscreen mode Exit fullscreen mode

⬆️ Go to Top | ⬇️ Go to Bottom


KUBERNETES CLI commands

Basic Commands

kubectl version # Show the Kubernetes version information.
kubectl cluster-info # Display cluster information.
kubectl get [resource] # List resources (e.g., pods, services).
kubectl describe [resource] [name] # Show detailed information about a resource.
kubectl create -f [filename] # Create resources from a file.
kubectl apply -f [filename] # Apply a configuration to a resource by file name or stdin.
kubectl delete [resource] [name] # Delete resources by file name, stdin, resource, and names.
Enter fullscreen mode Exit fullscreen mode

Pod Management

kubectl get pods # List all pods.
kubectl describe pod [pod-name] # Show detailed information about a pod.
kubectl logs [pod-name] # Print the logs for a container in a pod.
kubectl exec [pod-name] -- [command] # Execute a command in a container in a pod.
Enter fullscreen mode Exit fullscreen mode

Deployment Management

kubectl get deployments # List all deployments.
kubectl describe deployment [deployment-name] # Show detailed information about a deployment.
kubectl scale --replicas=[count] deployment/[deployment-name] # Scale a deployment.
kubectl rollout status deployment/[deployment-name] # Show the status of the rollout.
Enter fullscreen mode Exit fullscreen mode

Service Management

kubectl get services # List all services.
kubectl describe service [service-name] # Show detailed information about a service.
kubectl expose deployment [deployment-name] --type=[type] --port=[port] # Expose a deployment as a service.
Enter fullscreen mode Exit fullscreen mode

Namespace Management

kubectl get namespaces # List all namespaces.
kubectl create namespace [namespace-name] # Create a new namespace.
kubectl delete namespace [namespace-name] # Delete a namespace.
Enter fullscreen mode Exit fullscreen mode

Configuration Management

kubectl config view # Show merged kubeconfig settings.
kubectl config use-context [context-name] # Set the current context.
kubectl config set-context [context-name] --namespace=[namespace] # Set a context's namespace.
Enter fullscreen mode Exit fullscreen mode

Advanced Commands

kubectl rollout undo deployment/[deployment-name] # Undo a deployment.
kubectl top nodes # Display resource (CPU/memory) usage of nodes.
kubectl top pods # Display resource (CPU/memory) usage of pods.
kubectl port-forward [pod-name] [local-port]:[remote-port] # Forward one or more local ports to a pod.
Enter fullscreen mode Exit fullscreen mode

Autocompletion

kubectl completion bash # Set up autocompletion in bash.
kubectl completion zsh # Set up autocompletion in zsh.
kubectl completion fish # Set up autocompletion in fish.
Enter fullscreen mode Exit fullscreen mode

Resource Management

kubectl get all # List all resources in the namespace.
kubectl get events # List all events.
kubectl get nodes # List all nodes.
kubectl get configmaps # List all config maps.
kubectl get secrets # List all secrets.
Enter fullscreen mode Exit fullscreen mode

Editing Resources

kubectl edit [resource] [name] # Edit a resource on the server.
kubectl patch [resource] [name] --patch [patch] # Update a resource with a patch.
Enter fullscreen mode Exit fullscreen mode

Debugging

kubectl port-forward [pod-name] [local-port]:[remote-port] # Forward one or more local ports to a pod.
kubectl cp [pod-name]:[path] [local-path] # Copy files and directories to and from containers.
kubectl exec -it [pod-name] -- [command] # Execute a command in a container.
Enter fullscreen mode Exit fullscreen mode

Scaling and Rolling Updates

kubectl scale deployment [deployment-name] --replicas=[count] # Scale a deployment.
kubectl rollout restart deployment [deployment-name] # Restart a deployment.
kubectl rollout history deployment [deployment-name] # View rollout history of a deployment.
Enter fullscreen mode Exit fullscreen mode

Resource Quotas and Limits

kubectl get resourcequotas # List resource quotas.
kubectl describe resourcequotas [quota-name] # Show detailed information about a resource quota.
kubectl get limitranges # List limit ranges.
kubectl describe limitranges [limit-range-name] # Show detailed information about a limit range.
Enter fullscreen mode Exit fullscreen mode

⬆️ Go to Top | ⬇️ Go to Bottom


HELM CLI commands

General Commands

helm version # Show the Helm version.
helm help # Get help on Helm commands.
Enter fullscreen mode Exit fullscreen mode

Chart Management

helm create [name] # Create a new chart with the given name.
helm lint [chart] # Run tests to examine a chart for possible issues.
helm package [chart] # Package a chart directory into a chart archive.
helm show all [chart] # Show all information about a chart.
helm show values [chart] # Show the values file for a chart.
helm show chart [chart] # Show the chart.yaml file.
helm show readme [chart] # Show the README file.
helm show crds [chart] # Show the Custom Resource Definitions.
helm dependency list [chart] # List the dependencies for a chart.
helm dependency update [chart] # Update the dependencies for a chart.
Enter fullscreen mode Exit fullscreen mode

Repository Management

helm repo add [name] [url] # Add a chart repository.
helm repo list # List chart repositories.
helm repo update # Update information on available charts.
helm repo remove [name] # Remove a chart repository.
Enter fullscreen mode Exit fullscreen mode

Release Management

helm install [name] [chart] # Install a chart.
helm upgrade [release] [chart] # Upgrade a release to a new version of a chart.
helm rollback [release] [revision] # Roll back a release to a previous revision.
helm list # List releases.
helm status [release] # Show the status of a release.
helm uninstall [release] # Uninstall a release.
helm history [release] # Show the history of a release.
Enter fullscreen mode Exit fullscreen mode

Template and Testing

helm template [chart] # Render chart templates locally.
helm test [release] # Test a release.
Enter fullscreen mode Exit fullscreen mode

Plugin Management

helm plugin list # List installed Helm plugins.
helm plugin install [url] # Install a Helm plugin.
helm plugin update [plugin] # Update a Helm plugin.
helm plugin remove [plugin] # Remove a Helm plugin.
Enter fullscreen mode Exit fullscreen mode

Registry Management

helm registry login [url] # Log in to a Helm registry.
helm registry logout [url] # Log out from a Helm registry.
helm push [chart] [registry] # Push a chart to a registry.
helm pull [chart] # Pull a chart from a registry.
Enter fullscreen mode Exit fullscreen mode

Chart Management

helm dependency build [chart] # Rebuild the dependencies for a chart.
helm dependency update [chart] # Update the dependencies for a chart.
helm dependency list [chart] # List the dependencies for a chart.
Enter fullscreen mode Exit fullscreen mode

Release Management

helm get all [release] # Get all information about a release.
helm get hooks [release] # Get hooks for a release.
helm get manifest [release] # Get the manifest for a release.
helm get values [release] # Get the values for a release.
helm get notes [release] # Get the notes for a release.
Enter fullscreen mode Exit fullscreen mode

Template and Testing

helm template [chart] --output-dir [directory] # Render chart templates locally and output to a directory.
helm test [release] --logs # Test a release and display logs.
Enter fullscreen mode Exit fullscreen mode

Registry Management

helm registry login [url] --username [username] --password [password] # Log in to a Helm registry with credentials.
helm registry logout [url] # Log out from a Helm registry.
helm registry list # List all Helm registries.
Enter fullscreen mode Exit fullscreen mode

⬆️ Go to Top | ⬇️ Go to Bottom


Scripting and Automation

BASH CLI commands

File and Directory Management

ls # List directory contents.
cd [directory] # Change the current directory.
pwd # Print the current working directory.
mkdir [directory] # Create a new directory.
rmdir [directory] # Remove an empty directory.
rm [file] # Remove a file.
cp [source] [destination] # Copy files or directories.
mv [source] [destination] # Move or rename files or directories.
touch [file] # Create an empty file or update the timestamp of an existing file.
Enter fullscreen mode Exit fullscreen mode

File Viewing and Editing

cat [file] # Concatenate and display file content.
less [file] # View file content one screen at a time.
head [file] # Display the first few lines of a file.
tail [file] # Display the last few lines of a file.
nano [file] # Edit a file using the nano text editor.
vim [file] # Edit a file using the vim text editor.
Enter fullscreen mode Exit fullscreen mode

File Permissions

chmod [permissions] [file] # Change file permissions.
chown [owner]:[group] [file] # Change file owner and group.
Enter fullscreen mode Exit fullscreen mode

Process Management

ps # Display information about running processes.
top # Display real-time system information and process details.
kill [pid] # Terminate a process by its process ID.
killall [process-name] # Terminate all processes with the specified name.
Enter fullscreen mode Exit fullscreen mode

Networking

ping [host] # Send ICMP ECHO_REQUEST packets to network hosts.
ifconfig # Configure network interfaces.
wget [url] # Download files from the web.
curl [url] # Transfer data from or to a server.
Enter fullscreen mode Exit fullscreen mode

System Information

uname -a # Display system information.
df -h # Display disk space usage.
du -sh [directory] # Display the size of a directory.
free -h # Display memory usage.
Enter fullscreen mode Exit fullscreen mode

Scripting and Automation

echo [text] # Display a line of text.
read [variable] # Read a line of input into a variable.
for [variable] in [list]; do [commands]; done # Loop through a list of items.
while [condition]; do [commands]; done # Loop while a condition is true.
if [condition]; then [commands]; fi # Execute commands based on a condition.
Enter fullscreen mode Exit fullscreen mode

File and Directory Management

find [path] -name [pattern] # Search for files and directories.
ln -s [target] [link] # Create a symbolic link to a file or directory.
du -sh [directory] # Display the size of a directory and its contents.
Enter fullscreen mode Exit fullscreen mode

File Viewing and Editing

grep [pattern] [file] # Search for a pattern in a file.
awk '{print $1}' [file] # Process and analyze text files.
sed 's/[pattern]/[replacement]/g' [file] # Stream editor for filtering and transforming text.
Enter fullscreen mode Exit fullscreen mode

Process Management

bg # Resume a job in the background.
fg # Bring a job to the foreground.
jobs # List active jobs.
Enter fullscreen mode Exit fullscreen mode

Networking

netstat -tuln # Display network connections, routing tables, and interface statistics.
ssh [user]@[host] # Connect to a remote host via SSH.
scp [source] [destination] # Securely copy files between hosts.
Enter fullscreen mode Exit fullscreen mode

System Information

uptime # Show how long the system has been running.
who # Show who is logged on.
dmesg # Print or control the kernel ring buffer.
Enter fullscreen mode Exit fullscreen mode

Scripting and Automation

crontab -e # Edit the crontab file to schedule jobs.
alias [name]='[command]' # Create an alias for a command.
source [file] # Execute commands from a file in the current shell.
Enter fullscreen mode Exit fullscreen mode

⬆️ Go to Top | ⬇️ Go to Bottom


JENKINS CLI commands

Basic Jenkins Commands

sudo service jenkins start # Start the Jenkins service.
sudo service jenkins stop # Stop the Jenkins service.
sudo service jenkins restart # Restart the Jenkins service.
sudo service jenkins status # Check the status of the Jenkins service.
Enter fullscreen mode Exit fullscreen mode

Jenkins CLI Commands

java -jar jenkins-cli.jar -s http://<JENKINS_URL> help # Get help with the Jenkins CLI.
java -jar jenkins-cli.jar -s http://<JENKINS_URL> list-jobs # List all jobs.
java -jar jenkins-cli.jar -s http://<JENKINS_URL> build <JOB_NAME> # Trigger a job build.
java -jar jenkins-cli.jar -s http://<JENKINS_URL> create-job <JOB_NAME> <config.xml> # Create a new job.
java -jar jenkins-cli.jar -s http://<JENKINS_URL> delete-job <JOB_NAME> # Delete a job.
java -jar jenkins-cli.jar -s http://<JENKINS_URL> get-job <JOB_NAME> # Retrieve job configuration.
java -jar jenkins-cli.jar -s http://<JENKINS_URL> update-job <JOB_NAME> <config.xml> # Update job configuration.
java -jar jenkins-cli.jar -s http://<JENKINS_URL> disable-job <JOB_NAME> # Disable a job.
java -jar jenkins-cli.jar -s http://<JENKINS_URL> enable-job <JOB_NAME> # Enable a job.
Enter fullscreen mode Exit fullscreen mode

Jenkins Job Management

Create a New Job # Use the Jenkins UI to create a new job by selecting β€œNew Item”.
Delete a Job # Remove a job through the Jenkins interface by selecting β€œDelete Project”.
Configure a Job # Edit job settings via the Jenkins dashboard under β€œConfigure”.
Build a Job Now # Trigger a build by clicking β€œBuild Now” on the job page.
Schedule a Job # Set up build schedules in the job configuration using cron syntax.
Trigger Build Remotely # Use a URL with a token to trigger builds remotely: `http://<JENKINS_URL>/job/<JOB_NAME>/build?token=<TOKEN>`.
View Build History # Access the build history from the job’s page to review past builds.
Check Console Output # View detailed logs from a build under β€œConsole Output”.
Archive Build Artifacts # Configure post-build actions to save build artifacts.
Enter fullscreen mode Exit fullscreen mode

Jenkins Pipeline Management

Create a Pipeline Job # Set up a new pipeline job from the Jenkins dashboard.
Configure Pipeline Script # Use the pipeline editor to write and configure pipeline scripts.
Run Pipeline Script # Execute the pipeline script by triggering a build.
View Pipeline Stages # Check the stages and steps of a running or completed pipeline build.
Pause and Resume Pipeline # Pause or resume a pipeline job from the Jenkins UI.
Enter fullscreen mode Exit fullscreen mode

Jenkins Plugin Management

Install a Plugin # Go to Manage Jenkins > Manage Plugins > Available, search for a plugin, and install it.
Update Plugins # Check for updates under Manage Jenkins > Manage Plugins > Updates.
Uninstall a Plugin # Remove a plugin through Manage Jenkins > Manage Plugins > Installed.
Enter fullscreen mode Exit fullscreen mode

User and Security Management

Add a New User # Create users through Manage Jenkins > Manage Users > Create User.
Assign User Roles # Manage user roles and permissions using Role-Based Authorization plugins.
Enter fullscreen mode Exit fullscreen mode

Jenkins CLI Commands

java -jar jenkins-cli.jar -s http://<JENKINS_URL> safe-restart # Restart Jenkins safely after all builds are complete.
java -jar jenkins-cli.jar -s http://<JENKINS_URL> cancel-quiet-down # Cancel the quiet down mode.
java -jar jenkins-cli.jar -s http://<JENKINS_URL> reload-configuration # Reload the configuration from disk.
java -jar jenkins-cli.jar -s http://<JENKINS_URL> groovy [script] # Execute a Groovy script on the server.
Enter fullscreen mode Exit fullscreen mode

Jenkins Job Management

java -jar jenkins-cli.jar -s http://<JENKINS_URL> copy-job <source-job> <destination-job> # Copy a job.
java -jar jenkins-cli.jar -s http://<JENKINS_URL> disable-job <job-name> # Disable a job.
java -jar jenkins-cli.jar -s http://<JENKINS_URL> enable-job <job-name> # Enable a job.
Enter fullscreen mode Exit fullscreen mode

Jenkins Node Management

java -jar jenkins-cli.jar -s http://<JENKINS_URL> list-nodes # List all nodes.
java -jar jenkins-cli.jar -s http://<JENKINS_URL> create-node <node-name> # Create a new node.
java -jar jenkins-cli.jar -s http://<JENKINS_URL> delete-node <node-name> # Delete a node.
java -jar jenkins-cli.jar -s http://<JENKINS_URL> offline-node <node-name> # Take a node offline.
java -jar jenkins-cli.jar -s http://<JENKINS_URL> online-node <node-name> # Bring a node online.
Enter fullscreen mode Exit fullscreen mode

Jenkins System Management

java -jar jenkins-cli.jar -s http://<JENKINS_URL> safe-shutdown # Safely shut down Jenkins after all builds are complete.
java -jar jenkins-cli.jar -s http://<JENKINS_URL> quiet-down # Put Jenkins into quiet down mode, which allows existing builds to complete but prevents new builds from starting.
Enter fullscreen mode Exit fullscreen mode

⬆️ Go to Top | ⬇️ Go to Bottom


TERRAFORM CLI commands

Basic Commands

terraform version # Show the current Terraform version.
terraform init # Initialize a new or existing Terraform configuration.
terraform validate # Validate the configuration files.
terraform plan # Create an execution plan.
terraform apply # Apply the changes required to reach the desired state.
terraform destroy # Destroy the Terraform-managed infrastructure.
Enter fullscreen mode Exit fullscreen mode

Formatting and Validation

terraform fmt # Reformat configuration files to a canonical format.
terraform validate # Validate the configuration files.
Enter fullscreen mode Exit fullscreen mode

State Management

terraform state list # List resources in the state.
terraform state show [resource] # Show detailed information about a resource in the state.
terraform state rm [resource] # Remove a resource from the state.
terraform state mv [source] [destination] # Move a resource in the state.
Enter fullscreen mode Exit fullscreen mode

Resource Management

terraform import [address] [id] # Import existing infrastructure into Terraform.
terraform taint [resource] # Mark a resource for recreation.
terraform untaint [resource] # Remove the 'tainted' state from a resource.
Enter fullscreen mode Exit fullscreen mode

Output and Variables

terraform output # Show output values from the Terraform state.
terraform output -json # Show output values in JSON format.
terraform variables # List all variables in the configuration.
Enter fullscreen mode Exit fullscreen mode

Workspaces

terraform workspace list # List all workspaces.
terraform workspace new [name] # Create a new workspace.
terraform workspace select [name] # Select a workspace.
terraform workspace delete [name] # Delete a workspace.
Enter fullscreen mode Exit fullscreen mode

Advanced Commands

terraform graph # Generate a visual representation of the configuration.
terraform console # Open a console for evaluating expressions.
terraform force-unlock [lock-id] # Manually unlock the state.
Enter fullscreen mode Exit fullscreen mode

Advanced Commands

terraform get # Download and update modules mentioned in the configuration.
terraform login # Obtain and save credentials for a remote host.
terraform logout # Remove locally-stored credentials for a remote host.
terraform metadata # Metadata related commands.
terraform providers # Show the providers required for this configuration.
terraform refresh # Update the state to match remote systems.
terraform show # Show the current state or a saved plan.
terraform state # Advanced state management.
terraform taint # Mark a resource instance as not fully functional.
terraform untaint # Remove the 'tainted' state from a resource instance.
Enter fullscreen mode Exit fullscreen mode

Formatting and Validation

terraform fmt --recursive # Format files in subdirectories.
terraform fmt --diff # Display differences between original configuration files and formatting changes.
terraform fmt --check # Ensure the configuration files are formatted correctly.
Enter fullscreen mode Exit fullscreen mode

Workspace Management

terraform workspace new [name] # Create a new workspace.
terraform workspace select [name] # Select a workspace.
terraform workspace delete [name] # Delete a workspace.
Enter fullscreen mode Exit fullscreen mode

Graph and Console

terraform graph # Generate a visual representation of the configuration.
terraform console # Open a console for evaluating expressions.
Enter fullscreen mode Exit fullscreen mode

⬆️ Go to Top | ⬇️ Go to Bottom


ANSIBLE CLI commands

Ad-Hoc Commands

ansible all -m setup # Gather facts about remote hosts.
ansible all -m command -a "[command]" # Run a command on all hosts.
ansible all -m copy -a "src=[source] dest=[destination]" # Copy files to remote hosts.
Enter fullscreen mode Exit fullscreen mode

Playbook Management

ansible-playbook [playbook.yml] --diff # Show differences when running the playbook.
ansible-playbook [playbook.yml] --start-at-task "[task-name]" # Start the playbook at a specific task.
Enter fullscreen mode Exit fullscreen mode

Inventory Management

ansible-inventory --yaml # Display the inventory in YAML format.
ansible-inventory --graph --vars # Display the inventory graphically with variables.
Enter fullscreen mode Exit fullscreen mode

Role and Collection Management

ansible-galaxy role init [role-name] # Initialize a new role skeleton.
ansible-galaxy collection init [namespace].[collection-name] # Initialize a new collection skeleton.
Enter fullscreen mode Exit fullscreen mode

Vault Management

ansible-vault view [file] # View the contents of an encrypted file.
ansible-vault rekey --new-vault-password-file [file] [file] # Change the password of an encrypted file using a password file.
Enter fullscreen mode Exit fullscreen mode

Ad-Hoc Commands

ansible all -m yum -a "name=httpd state=present" -b # Install a package on all hosts using the `yum` module.
ansible all -m service -a "name=httpd state=started" -b # Start a service on all hosts using the `service` module.
Enter fullscreen mode Exit fullscreen mode

Playbook Management

ansible-playbook [playbook.yml] --step # Prompt before executing each task.
ansible-playbook [playbook.yml] --force-handlers # Run handlers even if a task fails.
Enter fullscreen mode Exit fullscreen mode

Inventory Management

ansible-inventory --export # Export the inventory in JSON format.
ansible-inventory --list-hosts # List all hosts in the inventory.
Enter fullscreen mode Exit fullscreen mode

Role and Collection Management

ansible-galaxy role search [keyword] # Search for roles on Ansible Galaxy.
ansible-galaxy collection search [keyword] # Search for collections on Ansible Galaxy.
Enter fullscreen mode Exit fullscreen mode

Vault Management

ansible-vault encrypt_string '[string]' --name '[variable_name]' # Encrypt a string for use in a playbook or role.
Enter fullscreen mode Exit fullscreen mode

⬆️ Go to Top | ⬇️ Go to Bottom


Cloud Services and CLI Tools

AWS CLI commands

General Commands

aws --version # Display the AWS CLI version.
aws configure # Configure the AWS CLI with your credentials and settings.
aws help # Get help on AWS CLI commands.
Enter fullscreen mode Exit fullscreen mode

EC2 (Elastic Compute Cloud)

aws ec2 describe-instances # List all EC2 instances.
aws ec2 start-instances --instance-ids [instance-id] # Start an EC2 instance.
aws ec2 stop-instances --instance-ids [instance-id] # Stop an EC2 instance.
aws ec2 terminate-instances --instance-ids [instance-id] # Terminate an EC2 instance.
Enter fullscreen mode Exit fullscreen mode

S3 (Simple Storage Service)

aws s3 ls # List all S3 buckets.
aws s3 mb s3://[bucket-name] # Create a new S3 bucket.
aws s3 cp [file] s3://[bucket-name]/[key] # Copy a file to an S3 bucket.
aws s3 rm s3://[bucket-name]/[key] # Remove a file from an S3 bucket.
Enter fullscreen mode Exit fullscreen mode

IAM (Identity and Access Management)

aws iam list-users # List all IAM users.
aws iam create-user --user-name [username] # Create a new IAM user.
aws iam delete-user --user-name [username] # Delete an IAM user.
aws iam attach-user-policy --user-name [username] --policy-arn [policy-arn] # Attach a policy to an IAM user.
Enter fullscreen mode Exit fullscreen mode

Lambda

aws lambda list-functions # List all Lambda functions.
aws lambda create-function --function-name [name] --runtime [runtime] --role [role-arn] --handler [handler] --zip-file fileb://[file-path] # Create a new Lambda function.
aws lambda invoke --function-name [name] [output-file] # Invoke a Lambda function.
aws lambda delete-function --function-name [name] # Delete a Lambda function.
Enter fullscreen mode Exit fullscreen mode

CloudFormation

aws cloudformation list-stacks # List all CloudFormation stacks.
aws cloudformation create-stack --stack-name [name] --template-body file://[template-file] # Create a new CloudFormation stack.
aws cloudformation delete-stack --stack-name [name] # Delete a CloudFormation stack.
Enter fullscreen mode Exit fullscreen mode

RDS (Relational Database Service)

aws rds describe-db-instances # List all RDS instances.
aws rds start-db-instance --db-instance-identifier [identifier] # Start an RDS instance.
aws rds stop-db-instance --db-instance-identifier [identifier] # Stop an RDS instance.
aws rds delete-db-instance --db-instance-identifier [identifier] --skip-final-snapshot # Delete an RDS instance.
Enter fullscreen mode Exit fullscreen mode

ECS (Elastic Container Service)

aws ecs list-clusters # List all ECS clusters.
aws ecs create-cluster --cluster-name [name] # Create a new ECS cluster.
aws ecs delete-cluster --cluster [name] # Delete an ECS cluster.
Enter fullscreen mode Exit fullscreen mode

CloudWatch

aws cloudwatch list-metrics # List all CloudWatch metrics.
aws cloudwatch put-metric-alarm --alarm-name [name] --metric-name [metric] --namespace [namespace] --statistic [statistic] --period [period] --threshold [threshold] --comparison-operator [operator] --evaluation-periods [periods] --alarm-actions [actions] # Create a CloudWatch alarm.
aws cloudwatch delete-alarms --alarm-names [name] # Delete a CloudWatch alarm.
Enter fullscreen mode Exit fullscreen mode

ECR (Elastic Container Registry)

aws ecr create-repository --repository-name [name] # Create a new ECR repository.
aws ecr delete-repository --repository-name [name] # Delete an ECR repository.
aws ecr list-images --repository-name [name] # List images in an ECR repository.
Enter fullscreen mode Exit fullscreen mode

General Commands

aws configure list # Display the current configuration settings.
aws configure get [setting] # Get a specific configuration setting.
aws configure set [setting] [value] # Set a specific configuration setting.
Enter fullscreen mode Exit fullscreen mode

EC2 (Elastic Compute Cloud)

aws ec2 describe-volumes # List all EBS volumes.
aws ec2 create-snapshot --volume-id [volume-id] # Create a snapshot of an EBS volume.
aws ec2 describe-snapshots # List all EBS snapshots.
Enter fullscreen mode Exit fullscreen mode

S3 (Simple Storage Service)

aws s3 sync [source] s3://[bucket-name]/[destination] # Sync files between a local directory and an S3 bucket.
aws s3 ls s3://[bucket-name] # List objects in an S3 bucket.
Enter fullscreen mode Exit fullscreen mode

IAM (Identity and Access Management)

aws iam list-roles # List all IAM roles.
aws iam create-role --role-name [role-name] --assume-role-policy-document file://[policy-file] # Create a new IAM role.
aws iam delete-role --role-name [role-name] # Delete an IAM role.
Enter fullscreen mode Exit fullscreen mode

Lambda

aws lambda update-function-code --function-name [name] --zip-file fileb://[file-path] # Update the code of a Lambda function.
aws lambda list-aliases --function-name [name] # List aliases for a Lambda function.
Enter fullscreen mode Exit fullscreen mode

CloudFormation

aws cloudformation update-stack --stack-name [name] --template-body file://[template-file] # Update a CloudFormation stack.
aws cloudformation describe-stack-events --stack-name [name] # List events for a CloudFormation stack.
Enter fullscreen mode Exit fullscreen mode

RDS (Relational Database Service)

aws rds create-db-snapshot --db-instance-identifier [identifier] --db-snapshot-identifier [snapshot-id] # Create a snapshot of an RDS instance.
aws rds describe-db-snapshots # List all RDS snapshots.
Enter fullscreen mode Exit fullscreen mode

ECS (Elastic Container Service)

aws ecs list-tasks --cluster [cluster-name] # List tasks in an ECS cluster.
aws ecs describe-tasks --cluster [cluster-name] --tasks [task-id] # Describe tasks in an ECS cluster.
Enter fullscreen mode Exit fullscreen mode

CloudWatch

aws cloudwatch get-metric-statistics --namespace [namespace] --metric-name [metric] --start-time [start-time] --end-time [end-time] --period [period] --statistics [statistics] # Retrieve statistics for a specific metric.
Enter fullscreen mode Exit fullscreen mode

ECR (Elastic Container Registry)

aws ecr batch-delete-image --repository-name [name] --image-ids imageTag=[tag] # Delete images from an ECR repository.
Enter fullscreen mode Exit fullscreen mode

⬆️ Go to Top | ⬇️ Go to Bottom


AZURE CLI commands

General Commands

az login # Log in to Azure.
az logout # Log out of Azure.
az account show # Show the details of the current subscription.
az account list # List all subscriptions.
Enter fullscreen mode Exit fullscreen mode

Resource Group Management

az group create --name [group-name] --location [location] # Create a new resource group.
az group delete --name [group-name] # Delete a resource group.
az group list # List all resource groups.
Enter fullscreen mode Exit fullscreen mode

Virtual Machines (VMs)

az vm create --resource-group [group-name] --name [vm-name] --image [image] # Create a new virtual machine.
az vm start --resource-group [group-name] --name [vm-name] # Start a virtual machine.
az vm stop --resource-group [group-name] --name [vm-name] # Stop a virtual machine.
az vm delete --resource-group [group-name] --name [vm-name] # Delete a virtual machine.
az vm list # List all virtual machines.
Enter fullscreen mode Exit fullscreen mode

Storage Accounts

az storage account create --name [account-name] --resource-group [group-name] --location [location] --sku [sku] # Create a new storage account.
az storage account delete --name [account-name] --resource-group [group-name] # Delete a storage account.
az storage account list # List all storage accounts.
Enter fullscreen mode Exit fullscreen mode

Azure Kubernetes Service (AKS)

az aks create --resource-group [group-name] --name [cluster-name] --node-count [count] --enable-addons monitoring --generate-ssh-keys # Create a new AKS cluster.
az aks delete --resource-group [group-name] --name [cluster-name] # Delete an AKS cluster.
az aks list # List all AKS clusters.
Enter fullscreen mode Exit fullscreen mode

Azure Functions

az functionapp create --resource-group [group-name] --consumption-plan-location [location] --runtime [runtime] --name [app-name] --storage-account [account-name] # Create a new function app.
az functionapp delete --resource-group [group-name] --name [app-name] # Delete a function app.
az functionapp list # List all function apps.
Enter fullscreen mode Exit fullscreen mode

Azure SQL Database

az sql server create --name [server-name] --resource-group [group-name] --location [location] --admin-user [username] --admin-password [password] # Create a new SQL server.
az sql db create --resource-group [group-name] --server [server-name] --name [db-name] --service-objective S0 # Create a new SQL database.
az sql server delete --name [server-name] --resource-group [group-name] # Delete a SQL server.
az sql db delete --resource-group [group-name] --server [server-name] --name [db-name] # Delete a SQL database.
Enter fullscreen mode Exit fullscreen mode

Networking

az network vnet create --name [vnet-name] --resource-group [group-name] --address-prefix [prefix] # Create a new virtual network.
az network vnet delete --name [vnet-name] --resource-group [group-name] # Delete a virtual network.
az network vnet list # List all virtual networks.
Enter fullscreen mode Exit fullscreen mode

Additional Commands

az monitor metrics list --resource [resource-id] # List metrics for a resource.
az policy assignment create --name [assignment-name] --scope [scope] --policy [policy-id] # Create a policy assignment.
az role assignment create --assignee [user] --role [role] --scope [scope] # Create a role assignment.
Enter fullscreen mode Exit fullscreen mode

General Commands

az configure # Configure the Azure CLI settings.
az feedback # Provide feedback to the Azure CLI team.
Enter fullscreen mode Exit fullscreen mode

Resource Management

az resource list # List all resources in a subscription.
az resource show --id [resource-id] # Show details of a specific resource.
az resource delete --id [resource-id] # Delete a specific resource.
Enter fullscreen mode Exit fullscreen mode

Virtual Machines (VMs)

az vm list-sizes --location [location] # List available VM sizes in a region.
az vm show --resource-group [group-name] --name [vm-name] # Show details of a specific VM.
az vm deallocate --resource-group [group-name] --name [vm-name] # Deallocate a VM.
Enter fullscreen mode Exit fullscreen mode

Storage Accounts

az storage account show-usage --location [location] # Show the current usage of the storage account.
az storage blob list --account-name [account-name] --container-name [container-name] # List blobs in a container.
Enter fullscreen mode Exit fullscreen mode

Networking

az network nsg create --resource-group [group-name] --name [nsg-name] # Create a new network security group.
az network nsg rule create --resource-group [group-name] --nsg-name [nsg-name] --name [rule-name] --priority [priority] --direction [direction] --access [access] --protocol [protocol] --source-address-prefixes [source] --source-port-ranges [source-port] --destination-address-prefixes [destination] --destination-port-ranges [destination-port] # Create a new security rule in a network security group.
Enter fullscreen mode Exit fullscreen mode

Azure Active Directory (AAD)

az ad user create --display-name [name] --user-principal-name [email] --password [password] # Create a new Azure AD user.
az ad group create --display-name [name] --mail-nickname [nickname] # Create a new Azure AD group.
az ad group member add --group [group-name] --member-id [user-id] # Add a member to an Azure AD group.
Enter fullscreen mode Exit fullscreen mode

Azure DevOps

az devops configure --defaults organization=https://dev.azure.com/[organization] # Configure the default Azure DevOps organization.
az devops project create --name [project-name] # Create a new Azure DevOps project.
az pipelines create --name [pipeline-name] --project [project-name] --repository [repository] --branch [branch] --yaml-path [path] # Create a new pipeline in Azure DevOps.
Enter fullscreen mode Exit fullscreen mode

⬆️ Go to Top | ⬇️ Go to Bottom


AWS SAGEMAKER CLI commands

General Commands

aws sagemaker list-notebook-instances # List all SageMaker notebook instances.
aws sagemaker list-endpoints # List all SageMaker endpoints.
aws sagemaker list-training-jobs # List all SageMaker training jobs.
aws sagemaker list-models # List all SageMaker models.
Enter fullscreen mode Exit fullscreen mode

Notebook Instances

aws sagemaker create-notebook-instance --notebook-instance-name [name] --instance-type [type] --role-arn [role-arn] # Create a new notebook instance.
aws sagemaker delete-notebook-instance --notebook-instance-name [name] # Delete a notebook instance.
aws sagemaker start-notebook-instance --notebook-instance-name [name] # Start a notebook instance.
aws sagemaker stop-notebook-instance --notebook-instance-name [name] # Stop a notebook instance.
Enter fullscreen mode Exit fullscreen mode

Training Jobs

aws sagemaker create-training-job --training-job-name [name] --algorithm-specification [spec] --role-arn [role-arn] --input-data-config [config] --output-data-config [config] # Create a new training job.
aws sagemaker describe-training-job --training-job-name [name] # Describe a training job.
aws sagemaker stop-training-job --training-job-name [name] # Stop a training job.
Enter fullscreen mode Exit fullscreen mode

Models

aws sagemaker create-model --model-name [name] --primary-container [container] --execution-role-arn [role-arn] # Create a new model.
aws sagemaker delete-model --model-name [name] # Delete a model.
aws sagemaker describe-model --model-name [name] # Describe a model.
Enter fullscreen mode Exit fullscreen mode

Endpoints

aws sagemaker create-endpoint --endpoint-name [name] --endpoint-config-name [config-name] # Create a new endpoint.
aws sagemaker delete-endpoint --endpoint-name [name] # Delete an endpoint.
aws sagemaker describe-endpoint --endpoint-name [name] # Describe an endpoint.
Enter fullscreen mode Exit fullscreen mode

Hyperparameter Tuning Jobs

aws sagemaker create-hyper-parameter-tuning-job --hyper-parameter-tuning-job-name [name] --hyper-parameter-tuning-job-config [config] --training-job-definition [definition] # Create a new hyperparameter tuning job.
aws sagemaker describe-hyper-parameter-tuning-job --hyper-parameter-tuning-job-name [name] # Describe a hyperparameter tuning job.
aws sagemaker stop-hyper-parameter-tuning-job --hyper-parameter-tuning-job-name [name] # Stop a hyperparameter tuning job.
Enter fullscreen mode Exit fullscreen mode

Processing Jobs

aws sagemaker create-processing-job --processing-job-name [name] --processing-resources [resources] --app-specification [spec] --role-arn [role-arn] # Create a new processing job.
aws sagemaker describe-processing-job --processing-job-name [name] # Describe a processing job.
aws sagemaker stop-processing-job --processing-job-name [name] # Stop a processing job.
Enter fullscreen mode Exit fullscreen mode

Additional Commands

aws sagemaker list-apps # List all SageMaker apps.
aws sagemaker list-model-packages # List all model packages.
aws sagemaker list-endpoint-configs # List all endpoint configurations.
aws sagemaker list-transform-jobs # List all transform jobs.
Enter fullscreen mode Exit fullscreen mode

General Commands

aws sagemaker list-tags --resource-arn [resource-arn] # List tags for a SageMaker resource.
aws sagemaker add-tags --resource-arn [resource-arn] --tags [key=value] # Add tags to a SageMaker resource.
aws sagemaker delete-tags --resource-arn [resource-arn] --tag-keys [key] # Delete tags from a SageMaker resource.
Enter fullscreen mode Exit fullscreen mode

AutoML Jobs

aws sagemaker create-auto-ml-job --auto-ml-job-name [name] --input-data-config [config] --output-data-config [config] --role-arn [role-arn] # Create an AutoML job.
aws sagemaker describe-auto-ml-job --auto-ml-job-name [name] # Describe an AutoML job.
aws sagemaker list-auto-ml-jobs # List all AutoML jobs.
Enter fullscreen mode Exit fullscreen mode

Model Package Management

aws sagemaker create-model-package --model-package-name [name] --model-package-group-name [group-name] --model-metrics [metrics] --inference-specification [spec] # Create a model package.
aws sagemaker describe-model-package --model-package-name [name] # Describe a model package.
aws sagemaker list-model-packages # List all model packages.
Enter fullscreen mode Exit fullscreen mode

Pipelines

aws sagemaker create-pipeline --pipeline-name [name] --pipeline-definition [definition] --role-arn [role-arn] # Create a new pipeline.
aws sagemaker describe-pipeline --pipeline-name [name] # Describe a pipeline.
aws sagemaker list-pipelines # List all pipelines.
aws sagemaker start-pipeline-execution --pipeline-name [name] # Start a pipeline execution.
Enter fullscreen mode Exit fullscreen mode

Data Wrangler

aws sagemaker create-flow-definition --flow-definition-name [name] --role-arn [role-arn] --human-loop-config [config] # Create a Data Wrangler flow definition.
aws sagemaker describe-flow-definition --flow-definition-name [name] # Describe a Data Wrangler flow definition.
aws sagemaker list-flow-definitions # List all Data Wrangler flow definitions.
Enter fullscreen mode Exit fullscreen mode

Feature Store

aws sagemaker create-feature-group --feature-group-name [name] --record-identifier-feature-name [feature-name] --event-time-feature-name [feature-name] --role-arn [role-arn] # Create a feature group.
aws sagemaker describe-feature-group --feature-group-name [name] # Describe a feature group.
aws sagemaker list-feature-groups # List all feature groups.
Enter fullscreen mode Exit fullscreen mode

⬆️ Go to Top | ⬇️ Go to Bottom


Workflow and Data Pipelines

APACHE AIRFLOW CLI commands

DAG Management

airflow dags backfill [dag-id] # Run tasks in a DAG for a specified date range.
airflow dags reserialize # Reserialize all DAGs to the database.
Enter fullscreen mode Exit fullscreen mode

Task Management

airflow tasks render [dag-id] [task-id] [execution-date] # Render a task instance's template(s).
airflow tasks state [dag-id] [task-id] [execution-date] # Get the status of a task instance.
airflow tasks states-for-dag-run [dag-id] [execution-date] # Get the status of all task instances in a DAG run.
Enter fullscreen mode Exit fullscreen mode

Database Management

airflow db check # Check the status of the metadata database.
airflow db shell # Run a shell to access the metadata database.
Enter fullscreen mode Exit fullscreen mode

Pools Management

airflow pools list # List all pools.
airflow pools set [name] [slots] [description] # Create or update a pool.
airflow pools delete [name] # Delete a pool.
Enter fullscreen mode Exit fullscreen mode

Providers Management

airflow providers list # List all providers.
airflow providers get [provider-name] # Get information about a specific provider.
Enter fullscreen mode Exit fullscreen mode

Roles Management

airflow roles list # List all roles.
airflow roles create [role-name] # Create a new role.
airflow roles delete [role-name] # Delete a role.
Enter fullscreen mode Exit fullscreen mode

Plugins Management

airflow plugins list # List all plugins.
Enter fullscreen mode Exit fullscreen mode

Miscellaneous

airflow kerberos # Start a Kerberos ticket renewer.
airflow rotate-fernet-key # Rotate the Fernet key used for encrypting data.
Enter fullscreen mode Exit fullscreen mode

DAG Management

airflow dags backfill [dag-id] # Run tasks in a DAG for a specified date range.
airflow dags reserialize # Reserialize all DAGs to the database.
Enter fullscreen mode Exit fullscreen mode

Task Management

airflow tasks render [dag-id] [task-id] [execution-date] # Render a task instance's template(s).
airflow tasks state [dag-id] [task-id] [execution-date] # Get the status of a task instance.
airflow tasks states-for-dag-run [dag-id] [execution-date] # Get the status of all task instances in a DAG run.
Enter fullscreen mode Exit fullscreen mode

Database Management

airflow db check # Check the status of the metadata database.
airflow db shell # Run a shell to access the metadata database.
Enter fullscreen mode Exit fullscreen mode

Pools Management

airflow pools list # List all pools.
airflow pools set [name] [slots] [description] # Create or update a pool.
airflow pools delete [name] # Delete a pool.
Enter fullscreen mode Exit fullscreen mode

Providers Management

airflow providers list # List all providers.
airflow providers get [provider-name] # Get information about a specific provider.
Enter fullscreen mode Exit fullscreen mode

Roles Management

airflow roles list # List all roles.
airflow roles create [role-name] # Create a new role.
airflow roles delete [role-name] # Delete a role.
Enter fullscreen mode Exit fullscreen mode

Plugins Management

airflow plugins list # List all plugins.
Enter fullscreen mode Exit fullscreen mode

Miscellaneous

airflow kerberos # Start a Kerberos ticket renewer.
airflow rotate-fernet-key # Rotate the Fernet key used for encrypting data.
Enter fullscreen mode Exit fullscreen mode

⬆️ Go to Top | ⬇️ Go to Bottom


MLFLOW CLI commands

General Commands

mlflow --version # Show the MLflow version.
mlflow --help # Get help on MLflow commands.
Enter fullscreen mode Exit fullscreen mode

Experiment Management

mlflow experiments create --experiment-name [name] # Create a new experiment.
mlflow experiments delete --experiment-id [id] # Delete an experiment.
mlflow experiments list # List all experiments.
mlflow experiments restore --experiment-id [id] # Restore a deleted experiment.
Enter fullscreen mode Exit fullscreen mode

Run Management

mlflow run [uri] # Run an MLflow project from a given URI.
mlflow runs list # List all runs.
mlflow runs delete --run-id [id] # Delete a run.
mlflow runs restore --run-id [id] # Restore a deleted run.
Enter fullscreen mode Exit fullscreen mode

Artifact Management

mlflow artifacts log-artifact --local-file [file] # Log a local file as an artifact.
mlflow artifacts list --run-id [id] # List all artifacts for a run.
mlflow artifacts download --run-id [id] --artifact-path [path] # Download an artifact.
Enter fullscreen mode Exit fullscreen mode

Model Management

mlflow models serve --model-uri [uri] # Serve a model locally.
mlflow models predict --model-uri [uri] --input-path [input] --output-path [output] # Generate predictions using a model.
mlflow models build-docker --model-uri [uri] --name [name] # Build a Docker image for a model.
Enter fullscreen mode Exit fullscreen mode

Deployment

mlflow deployments create --name [name] --model-uri [uri] --flavor [flavor] # Deploy a model.
mlflow deployments delete --name [name] # Delete a deployment.
mlflow deployments list # List all deployments.
Enter fullscreen mode Exit fullscreen mode

Tracking Server

mlflow server --host [host] --port [port] # Start the MLflow tracking server.
Enter fullscreen mode Exit fullscreen mode

Miscellaneous

mlflow db upgrade # Upgrade the database schema.
mlflow gc # Perform garbage collection on the tracking server.
Enter fullscreen mode Exit fullscreen mode

Experiment Management

mlflow experiments update --experiment-id [id] --new-name [name] # Update the name of an experiment.
Enter fullscreen mode Exit fullscreen mode

Run Management

mlflow runs search --experiment-ids [id] --filter [filter] # Search for runs that match a filter expression.
mlflow runs describe --run-id [id] # Describe a run.
Enter fullscreen mode Exit fullscreen mode

Artifact Management

mlflow artifacts download --artifact-uri [uri] --dst-path [path] # Download an artifact from a specified URI.
Enter fullscreen mode Exit fullscreen mode

Model Management

mlflow models list # List all registered models.
mlflow models delete --name [name] # Delete a registered model.
mlflow models transition-stage --model-name [name] --version [version] --stage [stage] # Transition a model version to a different stage.
Enter fullscreen mode Exit fullscreen mode

Deployment

mlflow deployments update --name [name] --model-uri [uri] # Update an existing deployment with a new model.
mlflow deployments get --name [name] # Get details of a deployment.
Enter fullscreen mode Exit fullscreen mode

Miscellaneous

mlflow doctor # Check for common issues in the MLflow installation.
mlflow gateway # Manage MLflow gateway configurations.
Enter fullscreen mode Exit fullscreen mode

⬆️ Go to Top | ⬇️ Go to Bottom


Web Servers and Networking

NGINX CLI commands

General Commands

nginx -v # Show the Nginx version.
nginx -V # Show the Nginx version, compiler version, and configure parameters.
nginx -t # Test the configuration file for syntax errors.
nginx -T # Test the configuration file and dump it to standard output.
nginx -s [signal] # Send a signal to the master process. Signals can be:
stop # Shut down quickly.
quit # Shut down gracefully.
reload # Reload the configuration.
reopen # Reopen log files.
Enter fullscreen mode Exit fullscreen mode

Configuration Management

nginx -c [file] # Use an alternative configuration file.
nginx -g [directives] # Set global configuration directives.
nginx -p [prefix] # Set the Nginx path prefix.
Enter fullscreen mode Exit fullscreen mode

Service Management (Systemd)

sudo systemctl start nginx # Start the Nginx service.
sudo systemctl stop nginx # Stop the Nginx service.
sudo systemctl restart nginx # Restart the Nginx service.
sudo systemctl reload nginx # Reload the Nginx configuration.
sudo systemctl status nginx # Check the status of the Nginx service.
Enter fullscreen mode Exit fullscreen mode

Service Management (SysVinit)

sudo service nginx start # Start the Nginx service.
sudo service nginx stop # Stop the Nginx service.
sudo service nginx restart # Restart the Nginx service.
sudo service nginx reload # Reload the Nginx configuration.
sudo service nginx status # Check the status of the Nginx service.
Enter fullscreen mode Exit fullscreen mode

Log Management

nginx -e [file] # Use an alternative error log file.
Enter fullscreen mode Exit fullscreen mode

⬆️ Go to Top | ⬇️ Go to Bottom


TCP IP Commands

Basic Commands

ipconfig # Display IP configuration (Windows).
ifconfig # Display IP configuration (Linux/Unix).
ping # Test connectivity to a host.
tracert # Trace the route to a host (Windows).
traceroute # Trace the route to a host (Linux/Unix).
netstat # Display network connections, routing tables, and interface statistics.
route # Display or modify the routing table.
arp # Display or modify the ARP table.
ip # Advanced IP configuration (Linux/Unix, replaces `ifconfig`).
hostname # Display or set the hostname of the system.
Enter fullscreen mode Exit fullscreen mode

Advanced Commands

nslookup # Query DNS servers for domain name or IP address information.
dig # Query DNS servers (Linux/Unix).
tcpdump # Capture and analyze network packets (Linux/Unix).
wireshark # Graphical network protocol analyzer.
nmap # Network exploration and security auditing tool.
telnet # Connect to remote hosts using the Telnet protocol.
ssh # Securely connect to remote hosts using SSH.
Enter fullscreen mode Exit fullscreen mode

⬆️ Go to Top | ⬇️ Go to Bottom


DNS Commands

Basic Commands

nslookup # Query DNS servers for domain name or IP address information.
dig # Query DNS servers (Linux/Unix).
host # DNS lookup utility (Linux/Unix).
ipconfig /displaydns # Display the DNS resolver cache (Windows).
ipconfig /flushdns # Flush the DNS resolver cache (Windows).
Enter fullscreen mode Exit fullscreen mode

Advanced Commands

dnscmd # Manage DNS servers (Windows Server).
rndc # Remote name daemon control for BIND DNS servers (Linux/Unix).
named-checkconf # Check the syntax of BIND DNS configuration files (Linux/Unix).
named-checkzone # Check the syntax and consistency of BIND DNS zone files (Linux/Unix).
systemd-resolve --status # Show the current DNS settings (Linux with systemd).
Enter fullscreen mode Exit fullscreen mode

⬆️ Go to Top | ⬇️ Go to Bottom


Databases

MySQL CLI commands

Basic Commands

mysql -u username -p # Connect to MySQL.
SHOW DATABASES; # Show all databases.
USE database_name; # Select a specific database.
SHOW TABLES; # Show all tables in the selected database.
DESCRIBE table_name; # Show the structure of a table.
CREATE DATABASE database_name; # Create a new database.
DROP DATABASE database_name; # Delete a database.
CREATE TABLE table_name (column1 datatype, column2 datatype, ...); # Create a new table.
DROP TABLE table_name; # Delete a table.
Enter fullscreen mode Exit fullscreen mode

Data Manipulation

INSERT INTO table_name (column1, column2, ...) VALUES (value1, value2, ...); # Insert data into a table.
SELECT column1, column2, ... FROM table_name; # Retrieve data from a table.
UPDATE table_name SET column1 = value1, column2 = value2, ... WHERE condition; # Update data in a table.
DELETE FROM table_name WHERE condition; # Delete data from a table.
Enter fullscreen mode Exit fullscreen mode

User Management

CREATE USER 'username'@'host' IDENTIFIED BY 'password'; # Create a new user.
GRANT ALL PRIVILEGES ON database*name.* TO 'username'@'host'; # Grant privileges to a user.
REVOKE ALL PRIVILEGES ON database*name.* FROM 'username'@'host'; # Revoke privileges from a user.
SHOW GRANTS FOR 'username'@'host'; # Show the privileges granted to a user.
DROP USER 'username'@'host'; # Delete a user.
Enter fullscreen mode Exit fullscreen mode

Database Maintenance

mysqldump -u username -p database_name > backup_file.sql # Backup a database.
mysql -u username -p database_name < backup_file.sql # Restore a database from a backup.
CHECK TABLE table_name; # Check a table for errors.
REPAIR TABLE table_name; # Repair a table.
OPTIMIZE TABLE table_name; # Optimize a table.
Enter fullscreen mode Exit fullscreen mode

Advanced Commands

ALTER TABLE table_name ADD column_name datatype; # Add a new column to a table.
ALTER TABLE table_name DROP COLUMN column_name; # Remove a column from a table.
ALTER TABLE table_name MODIFY column_name datatype; # Change the data type of a column.
CREATE INDEX index_name ON table_name (column_name); # Create an index on a column.
DROP INDEX index_name ON table_name; # Remove an index from a column.
SHOW INDEX FROM table_name; # Show all indexes on a table.
Enter fullscreen mode Exit fullscreen mode

Transaction Management

START TRANSACTION; # Begin a new transaction.
COMMIT; # Commit the current transaction.
ROLLBACK; # Roll back the current transaction.
Enter fullscreen mode Exit fullscreen mode

Information and Status

SHOW STATUS; # Display server status information.
SHOW VARIABLES; # Display system variables.
SHOW PROCESSLIST; # Show active threads.
SHOW ENGINE INNODB STATUS; # Display InnoDB status information.
Enter fullscreen mode Exit fullscreen mode

Security

FLUSH PRIVILEGES; # Reload the privileges from the grant tables in the `mysql` database.
SET PASSWORD FOR 'username'@'host' = PASSWORD('new_password'); # Change a user's password.
Enter fullscreen mode Exit fullscreen mode

⬆️ Go to Top | ⬇️ Go to Bottom


POSTGRESQL CLI commands

Basic Commands

psql -U username -d database_name # Connect to a PostgreSQL database.
\l # List all databases.
\c database_name # Connect to a specific database.
\dt # List all tables in the current database.
\d table_name # Describe the structure of a table.
CREATE DATABASE database_name; # Create a new database.
DROP DATABASE database_name; # Delete a database.
CREATE TABLE table_name (column1 datatype, column2 datatype, ...); # Create a new table.
DROP TABLE table_name; # Delete a table.
Enter fullscreen mode Exit fullscreen mode

Data Manipulation

INSERT INTO table_name (column1, column2, ...) VALUES (value1, value2, ...); # Insert data into a table.
SELECT column1, column2, ... FROM table_name; # Retrieve data from a table.
UPDATE table_name SET column1 = value1, column2 = value2, ... WHERE condition; # Update data in a table.
DELETE FROM table_name WHERE condition; # Delete data from a table.
Enter fullscreen mode Exit fullscreen mode

User Management

CREATE USER username WITH PASSWORD 'password'; # Create a new user.
GRANT ALL PRIVILEGES ON DATABASE database_name TO username; # Grant privileges to a user.
REVOKE ALL PRIVILEGES ON DATABASE database_name FROM username; # Revoke privileges from a user.
\du # List all users and their roles.
DROP USER username; # Delete a user.
Enter fullscreen mode Exit fullscreen mode

Database Maintenance

pg_dump -U username -d database_name -f backup_file.sql # Backup a database.
psql -U username -d database_name -f backup_file.sql # Restore a database from a backup.
VACUUM table_name; # Clean up and optimize a table.
ANALYZE table_name; # Collect statistics about a table for the query planner.
Enter fullscreen mode Exit fullscreen mode

Advanced Commands

ALTER TABLE table_name ADD COLUMN column_name datatype; # Add a new column to a table.
ALTER TABLE table_name DROP COLUMN column_name; # Remove a column from a table.
ALTER TABLE table_name ALTER COLUMN column_name TYPE datatype; # Change the data type of a column.
CREATE INDEX index_name ON table_name (column_name); # Create an index on a column.
DROP INDEX index_name; # Remove an index.
Enter fullscreen mode Exit fullscreen mode

Transaction Management

BEGIN; # Begin a new transaction.
COMMIT; # Commit the current transaction.
ROLLBACK; # Roll back the current transaction.
Enter fullscreen mode Exit fullscreen mode

Information and Status

\conninfo # Display information about the current database connection.
\dt+ # List all tables with additional information.
\di # List all indexes.
\df # List all functions.
\dv # List all views.
Enter fullscreen mode Exit fullscreen mode

Security

ALTER USER username WITH PASSWORD 'new_password'; # Change a user's password.
REVOKE CONNECT ON DATABASE database_name FROM PUBLIC; # Restrict access to a database.
Enter fullscreen mode Exit fullscreen mode

Advanced Commands

ALTER TABLE table_name RENAME TO new_table_name; # Rename a table.
ALTER TABLE table_name RENAME COLUMN old_column_name TO new_column_name; # Rename a column.
COPY table_name TO 'file_path' WITH (FORMAT csv); # Export table data to a CSV file.
COPY table_name FROM 'file_path' WITH (FORMAT csv); # Import data from a CSV file into a table.
Enter fullscreen mode Exit fullscreen mode

Information and Status

\l+ # List all databases with additional information.
\d+ table_name # Describe the structure of a table with additional information.
\x # Toggle expanded display mode for query results.
Enter fullscreen mode Exit fullscreen mode

Security

REVOKE ALL ON SCHEMA public FROM PUBLIC; # Restrict access to the public schema.
GRANT USAGE ON SCHEMA schema_name TO username; # Grant usage on a schema to a user.
GRANT SELECT ON ALL TABLES IN SCHEMA schema_name TO username; # Grant select privileges on all tables in a schema to a user.
Enter fullscreen mode Exit fullscreen mode

⬆️ Go to Top | ⬇️ Go to Bottom


Monitoring and Logging

PROMETHEUS CLI commands

Basic Commands

prometheus --config.file=path/to/config.yml # Start Prometheus with a specific configuration file.
prometheus --version # Show the Prometheus version.
prometheus --help # Show help for Prometheus CLI.
Enter fullscreen mode Exit fullscreen mode

Configuration and Management

prometheus --storage.tsdb.path=data/ # Set the storage path for metrics.
prometheus --web.listen-address=:9090 # Set the address to listen on for the web interface and API.
prometheus --web.enable-lifecycle # Enable HTTP endpoints for lifecycle management (e.g., reload configuration).
prometheus --web.enable-admin-api # Enable API endpoints for administrative actions.
Enter fullscreen mode Exit fullscreen mode

Storage and Retention

prometheus --storage.tsdb.retention.time=15d # Set the retention time for metrics data.
prometheus --storage.tsdb.retention.size=512MB # Set the retention size for metrics data.
Enter fullscreen mode Exit fullscreen mode

Remote Write and Read

prometheus --web.enable-remote-write-receiver # Enable the remote write receiver endpoint.
prometheus --web.enable-remote-read-receiver # Enable the remote read receiver endpoint.
Enter fullscreen mode Exit fullscreen mode

Promtool Commands

promtool check config path/to/config.yml # Validate the Prometheus configuration file.
promtool check rules path/to/rules.yml # Validate the Prometheus rules file.
promtool query instant --query='up' --time='2025-03-04T12:00:00Z' # Execute an instant query against a Prometheus server.
promtool query range --query='up' --start='2025-03-04T00:00:00Z' --end='2025-03-04T12:00:00Z' --step=60s # Execute a range query against a Prometheus server.
Enter fullscreen mode Exit fullscreen mode

Configuration and Management

prometheus --config.auto-reload-interval=30s # Automatically reload the configuration file at specified intervals.
prometheus --web.config.file=path/to/web_config.yml # Path to a configuration file that can enable TLS or authentication.
prometheus --web.read-timeout=5m # Set the maximum duration before timing out read requests.
prometheus --web.max-connections=512 # Set the maximum number of simultaneous connections.
prometheus --web.external-url=http://example.com # Set the external URL for Prometheus.
prometheus --web.route-prefix=/prometheus # Set the route prefix for web endpoints.
prometheus --web.user-assets=path/to/assets # Path to static asset directory.
Enter fullscreen mode Exit fullscreen mode

Promtool Commands

promtool check metrics path/to/metrics # Validate metrics.
promtool tsdb analyze path/to/tsdb # Analyze a TSDB (Time Series Database) for issues.
promtool tsdb create-blocks-from openmetrics path/to/openmetrics # Create TSDB blocks from OpenMetrics data.
Enter fullscreen mode Exit fullscreen mode

⬆️ Go to Top | ⬇️ Go to Bottom


Development Tools

EXPO CLI commands

Basic Commands

npx expo start # Start the development server.
npx expo prebuild # Generate native Android and iOS directories.
npx expo run:android # Compile and run the native Android app locally.
npx expo run:ios # Compile and run the native iOS app locally.
npx expo install package-name # Install a new library or validate and update specific libraries.
npx expo login # Log in to your Expo account.
npx expo logout # Log out of your Expo account.
npx expo whoami # Display the currently logged-in user.
npx expo register # Create a new Expo account.
Enter fullscreen mode Exit fullscreen mode

Project Management

npx expo export # Export the static files of your project.
npx expo customize # Customize the native project configuration.
npx expo config # Read and write the app configuration.
Enter fullscreen mode Exit fullscreen mode

Development Tools

npx expo lint # Set up and configure ESLint, or lint your project files if ESLint is already configured.
npx expo-doctor # Diagnose issues in your Expo project.
Enter fullscreen mode Exit fullscreen mode

EAS CLI (Expo Application Services)

eas build # Build your app using EAS services.
eas update # Create over-the-air (OTA) updates.
eas submit # Submit your app to the app stores.
eas login # Log in to your Expo account using EAS CLI.
eas logout # Log out of your Expo account using EAS CLI.
Enter fullscreen mode Exit fullscreen mode

⬆️ Go to Top | ⬇️ Go to Bottom


NPM CLI commands

Basic Commands

npm init # Create a `package.json` file.
npm install # Install all dependencies listed in `package.json`.
npm install <package> # Install a specific package.
npm uninstall <package> # Remove a specific package.
npm update # Update all packages to the latest version.
npm outdated # Check for outdated packages.
npm list # List installed packages.
npm run <script> # Run a script defined in `package.json`.
Enter fullscreen mode Exit fullscreen mode

Package Management

npm publish # Publish a package to the npm registry.
npm unpublish # Remove a package from the npm registry.
npm version <newversion> # Bump a package version.
npm view <package> # View registry information about a package.
npm link # Symlink a package folder.
npm pack # Create a tarball from a package.
Enter fullscreen mode Exit fullscreen mode

Configuration and Cache

npm config set <key> <value> # Set a configuration value.
npm config get <key> # Get a configuration value.
npm cache clean --force # Clean the npm cache.
Enter fullscreen mode Exit fullscreen mode

Security and Auditing

npm audit # Run a security audit.
npm audit fix # Automatically fix vulnerabilities.
Enter fullscreen mode Exit fullscreen mode

User Management

npm login # Log in to the npm registry.
npm logout # Log out of the npm registry.
npm whoami # Display the logged-in user.
Enter fullscreen mode Exit fullscreen mode

Miscellaneous

npm help # Get help on npm commands.
npm doctor # Check your environment for potential problems.
npm fund # Display funding information for dependencies.
npm dedupe # Reduce duplication in the `node_modules` folder.
Enter fullscreen mode Exit fullscreen mode

Advanced Commands

npx expo upgrade # Upgrade your project and its dependencies to the latest versions.
npx expo eject # Create native iOS and Android projects for your app.
npx expo publish # Publish your project to Expo's hosting service.
npx expo build:android # Build a standalone APK or App Bundle for Android.
npx expo build:ios # Build a standalone IPA for iOS.
npx expo diagnostics # Print environment info to debug and report issues.
Enter fullscreen mode Exit fullscreen mode

⬆️ Go to Top | ⬇️ Go to Bottom


YARN CLI commands

Basic Commands

yarn init # Initialize a new project.
yarn install # Install all dependencies defined in `package.json`.
yarn add <package> # Add a package to the project.
yarn remove <package> # Remove a package from the project.
yarn upgrade # Upgrade all dependencies to their latest version.
yarn run <script> # Run a script defined in `package.json`.
Enter fullscreen mode Exit fullscreen mode

Package Management

yarn publish # Publish a package to the npm registry.
yarn pack # Create a tarball from the project.
yarn link # Symlink a package folder.
yarn unlink # Remove a symlinked package.
Enter fullscreen mode Exit fullscreen mode

Configuration and Cache

yarn config set <key> <value> # Set a configuration value.
yarn config get <key> # Get a configuration value.
yarn config delete <key> # Delete a configuration value.
yarn cache clean # Clean the Yarn cache.
Enter fullscreen mode Exit fullscreen mode

Security and Auditing

yarn audit # Run a security audit.
yarn audit fix # Automatically fix vulnerabilities.
Enter fullscreen mode Exit fullscreen mode

User Management

yarn login # Log in to the npm registry.
yarn logout # Log out of the npm registry.
yarn whoami # Display the logged-in user.
Enter fullscreen mode Exit fullscreen mode

Miscellaneous

yarn help # Get help on Yarn commands.
yarn info <package> # Show information about a package.
yarn list # List installed packages.
yarn why <package> # Explain why a package is installed.
yarn version # Bump the version of your project.
Enter fullscreen mode Exit fullscreen mode

Workspaces

yarn workspace <workspace_name> <command> # Run a command within a specific workspace.
yarn workspaces list # List all available workspaces.
Enter fullscreen mode Exit fullscreen mode

Advanced Commands

yarn dedupe # Deduplicate dependencies with overlapping ranges.
yarn exec <command> # Execute a shell command.
yarn explain <error_code> # Explain an error code.
yarn stage # Add all Yarn files to your version control system.
yarn unplug <package> # Force the unpacking of a list of packages.
Enter fullscreen mode Exit fullscreen mode

Advanced Commands

npm ci # Install dependencies from `package-lock.json` without modifying it.
npm exec <command> # Execute a command from a local package.
npm explain <dependency> # Explain why a dependency is installed.
npm dedupe # Reduce duplication in the `node_modules` folder.
npm prune # Remove extraneous packages.
Enter fullscreen mode Exit fullscreen mode

⬆️ Go to Top | ⬇️ Go to Bottom


PIP Commands

Basic Commands

pip install package_name # Install a package.
pip install --upgrade package_name # Upgrade a package.
pip uninstall package_name # Uninstall a package.
pip list # List installed packages.
pip show package_name # Show information about a package.
pip search query # Search for packages.
pip freeze # Output installed packages and their versions.
pip install -r requirements.txt # Install packages from a requirements file.
pip freeze > requirements.txt # Generate a requirements file.
pip list --outdated # Check for outdated packages.
Enter fullscreen mode Exit fullscreen mode

Advanced Commands

pip check # Verify installed packages have compatible dependencies.
pip cache list # List the contents of the pip cache.
pip cache purge # Remove all items from the pip cache.
pip install --user package_name # Install a package for the current user.
pip install --no-deps package_name # Install a package without dependencies.
pip install --force-reinstall package_name # Reinstall a package, even if it is already installed.
pip install --pre package_name # Install pre-release versions of a package.
Enter fullscreen mode Exit fullscreen mode

⬆️ Go to Top | ⬇️ Go to Bottom


Package Managers

APT Commands

Basic Commands

sudo apt update # Update the package list.
sudo apt upgrade # Upgrade all installed packages to their latest versions.
sudo apt install package_name # Install a new package.
sudo apt remove package_name # Remove a package.
sudo apt autoremove # Remove unnecessary packages.
sudo apt clean # Clean up the local repository of retrieved package files.
sudo apt show package_name # Show detailed information about a package.
sudo apt list # List packages based on criteria (e.g., `--installed`, `--upgradable`).
Enter fullscreen mode Exit fullscreen mode

Advanced Commands

sudo apt full-upgrade # Perform an upgrade, potentially removing some packages if necessary.
sudo apt search keyword # Search for a package by keyword.
sudo apt policy package_name # Show the installed and available versions of a package.
sudo apt edit-sources # Edit the sources list.
sudo apt depends package_name # Show the dependencies of a package.
sudo apt rdepends package_name # Show reverse dependencies of a package.
sudo apt purge package_name # Remove a package and its configuration files.
sudo apt download package_name # Download a package file without installing it.
sudo apt list --upgradable # List all packages that can be upgraded.
sudo apt list --installed # List all installed packages.
sudo apt list --all-versions # List all available versions of a package.
sudo apt-mark hold package_name # Prevent a package from being automatically upgraded.
sudo apt-mark unhold package_name # Allow a package to be automatically upgraded again.
sudo apt-get build-dep package_name # Install dependencies required to build a package from source.
sudo apt-get source package_name # Download the source code of a package.
Enter fullscreen mode Exit fullscreen mode

⬆️ Go to Top | ⬇️ Go to Bottom


YUM Commands

Basic Commands

sudo yum update # Update all packages to the latest version.
sudo yum install package_name # Install a new package.
sudo yum remove package_name # Remove a package.
sudo yum list # List all available and installed packages.
sudo yum search keyword # Search for a package by keyword.
sudo yum info package_name # Display detailed information about a package.
sudo yum clean all # Clean up the local repository of retrieved package files.
Enter fullscreen mode Exit fullscreen mode

Advanced Commands

sudo yum check-update # Check for available package updates.
sudo yum deplist package_name # Display dependencies for a package.
sudo yum groupinstall "Group Name" # Install a group of packages.
sudo yum groupremove "Group Name" # Remove a group of packages.
sudo yum groupinfo "Group Name" # Display detailed information about a package group.
sudo yum history # Display the transaction history of `yum` commands.
sudo yum history undo transaction_id # Undo a specific transaction.
sudo yum history redo transaction_id # Redo a specific transaction.
sudo yum repolist # List all enabled repositories.
sudo yum repoinfo # Display detailed information about repositories.
sudo yum provides file_name # Find which package provides a specific file.
Enter fullscreen mode Exit fullscreen mode

⬆️ Go to Top | ⬇️ Go to Bottom


Utilities

CURL Commands

Basic Commands

curl http://example.com # Fetch a URL.
curl -O http://example.com/file.txt # Download a file.
curl -o output.txt http://example.com/file.txt # Download a file and save it with a specific name.
curl -I http://example.com # Fetch the headers of a URL.
curl -L http://example.com # Follow redirects.
curl -u username:password http://example.com # Access a URL with basic authentication.
curl -d "param1=value1&param2=value2" http://example.com # Send POST data.
curl -X POST http://example.com # Send a POST request.
curl -X DELETE http://example.com # Send a DELETE request.
curl -H "Content-Type: application/json" -d '{"key":"value"}' http://example.com # Send JSON data.
Enter fullscreen mode Exit fullscreen mode

Advanced Commands

curl -F "name=@file.txt" http://example.com/upload # Upload a file.
curl -b cookies.txt http://example.com # Send cookies from a file.
curl -c cookies.txt http://example.com # Save cookies to a file.
curl -k https://example.com # Ignore SSL certificate warnings.
curl --limit-rate 100K http://example.com # Limit the download rate.
curl --proxy http://proxy.example.com:8080 http://example.com # Use a proxy.
curl --compressed http://example.com # Request a compressed response.
curl --interface eth0 http://example.com # Use a specific network interface.
curl --retry 5 http://example.com # Retry a failed request up to 5 times.
curl --data-urlencode "param=value" http://example.com # URL encode POST data.
curl -X PUT http://example.com # Send a PUT request.
curl -X PATCH http://example.com # Send a PATCH request.
curl -T file.txt http://example.com # Upload a file using PUT.
curl -u username:password -T file.txt ftp://example.com # Upload a file to an FTP server with authentication.
curl -C - -O http://example.com/file.txt # Resume a previous file transfer.
curl --head http://example.com # Fetch only the headers of a URL.
curl --data-binary @file.bin http://example.com # Send binary data.
curl --cert cert.pem --key key.pem https://example.com # Use a client certificate for HTTPS requests.
curl --max-time 10 http://example.com # Set a maximum time for the request.
curl --connect-timeout 5 http://example.com # Set a maximum time for the connection phase.
Enter fullscreen mode Exit fullscreen mode

⬆️ Go to Top | ⬇️ Go to Bottom


Messaging and Queuing

MQTT CLI Commands

Basic Commands

mqtt pub -t [topic] -m "[message]" -h [broker] # Publish a message to a topic.
mqtt sub -t [topic] -h [broker] # Subscribe to a topic.
mqtt sh # Enter shell mode.
mqtt test -h [broker] # Run tests against a broker.
mqtt --help # Get an overview of supported commands.
Enter fullscreen mode Exit fullscreen mode

Advanced Commands

mqtt pub -t [topic] -m "[message]" -h [broker] -q [QoS] # Publish a message with a specific Quality of Service (QoS) level.
mqtt sub -t [topic] -h [broker] -q [QoS] # Subscribe to a topic with a specific QoS level.
mqtt pub -t [topic] -m "[message]" -h [broker] -r # Publish a retained message.
mqtt sub -t [topic] -h [broker] -v # Subscribe to a topic with verbose output.
Enter fullscreen mode Exit fullscreen mode

Connection Management

mqtt conn -h [broker] -p [port] # Connect to a broker on a specific port.
mqtt disconn # Disconnect from the broker.
mqtt reconnect # Reconnect to the broker.
Enter fullscreen mode Exit fullscreen mode

Security

mqtt pub -t [topic] -m "[message]" -h [broker] --cafile [file] # Publish a message using a CA certificate file.
mqtt sub -t [topic] -h [broker] --cafile [file] # Subscribe to a topic using a CA certificate file.
Enter fullscreen mode Exit fullscreen mode

Shell Mode Commands

mqtt con -i [client-id] # Connect an MQTT client with a specific client ID.
mqtt dis # Disconnect an MQTT client.
mqtt switch # Switch the current client context.
mqtt ls # List all connected clients in the current session.
mqtt cls # Clear the screen.
mqtt exit # Exit the shell mode.
Enter fullscreen mode Exit fullscreen mode

⬆️ Go to Top | ⬇️ Go to Bottom


RabbitMQ CLI Commands

General Management

rabbitmqctl status # Display the status of the RabbitMQ node.
rabbitmqctl stop # Stop the RabbitMQ node.
rabbitmqctl start_app # Start the RabbitMQ application.
rabbitmqctl stop_app # Stop the RabbitMQ application.
rabbitmqctl reset # Reset the RabbitMQ node to its initial state.
rabbitmqctl rotate_logs # Rotate the RabbitMQ logs.
Enter fullscreen mode Exit fullscreen mode

User Management

rabbitmqctl add_user [username] [password] # Add a new user.
rabbitmqctl delete_user [username] # Delete a user.
rabbitmqctl list_users # List all users.
rabbitmqctl set_user_tags [username] [tag] # Set tags for a user.
Enter fullscreen mode Exit fullscreen mode

Virtual Host Management

rabbitmqctl add_vhost [vhost] # Add a new virtual host.
rabbitmqctl delete_vhost [vhost] # Delete a virtual host.
rabbitmqctl list_vhosts # List all virtual hosts.
Enter fullscreen mode Exit fullscreen mode

Permission Management

rabbitmqctl set_permissions -p [vhost] [user] "[conf]" "[write]" "[read]" # Set permissions for a user on a virtual host.
rabbitmqctl clear_permissions -p [vhost] [user] # Clear permissions for a user on a virtual host.
rabbitmqctl list_permissions -p [vhost] # List all permissions for a virtual host.
Enter fullscreen mode Exit fullscreen mode

Queue Management

rabbitmqctl list_queues # List all queues.
rabbitmqctl purge_queue [queue] # Purge all messages from a queue.
rabbitmqctl delete_queue [queue] # Delete a queue.

### Exchange Management
```
{% endraw %}
 bash
rabbitmqctl list_exchanges # List all exchanges.
rabbitmqctl delete_exchange [exchange] # Delete an exchange.
{% raw %}

Enter fullscreen mode Exit fullscreen mode

Plugin Management


 bash
rabbitmq-plugins enable [plugin] # Enable a plugin.
rabbitmq-plugins disable [plugin] # Disable a plugin.
rabbitmq-plugins list # List all plugins.


Enter fullscreen mode Exit fullscreen mode

Diagnostics


 bash
rabbitmq-diagnostics check_port_connectivity # Check port connectivity.
rabbitmq-diagnostics memory_breakdown # Display memory usage breakdown.
rabbitmq-diagnostics server_version # Display the RabbitMQ server version.


Enter fullscreen mode Exit fullscreen mode

HTTP API Management


 bash
rabbitmqadmin list [object] # List objects (e.g., queues, exchanges).
rabbitmqadmin declare [object] # Declare objects (e.g., queues, exchanges).
rabbitmqadmin delete [object] # Delete objects (e.g., queues, exchanges).


Enter fullscreen mode Exit fullscreen mode

⬆️ Go to Top | ⬇️ Go to Bottom


Kafka CLI Commands

General Management



kafka-server-start.sh [config-file] # Start a Kafka server with the specified configuration file.
kafka-server-stop.sh # Stop the running Kafka server.
zookeeper-server-start.sh [config-file] # Start the ZooKeeper server with the specified configuration file.
zookeeper-server-stop.sh # Stop the running ZooKeeper server.


Enter fullscreen mode Exit fullscreen mode

Topic Management



kafka-topics.sh --create --topic [topic-name] --bootstrap-server [server] --partitions [num] --replication-factor [num] # Create a new topic.
kafka-topics.sh --list --bootstrap-server [server] # List all topics.
kafka-topics.sh --describe --topic [topic-name] --bootstrap-server [server] # Describe a topic.
kafka-topics.sh --delete --topic [topic-name] --bootstrap-server [server] # Delete a topic.


Enter fullscreen mode Exit fullscreen mode

Producer and Consumer



kafka-console-producer.sh --topic [topic-name] --bootstrap-server [server] # Start a console producer to send messages to a topic.
kafka-console-consumer.sh --topic [topic-name] --bootstrap-server [server] --from-beginning # Start a console consumer to read messages from a topic from the beginning.


Enter fullscreen mode Exit fullscreen mode

Consumer Group Management



kafka-consumer-groups.sh --list --bootstrap-server [server] # List all consumer groups.
kafka-consumer-groups.sh --describe --group [group-name] --bootstrap-server [server] # Describe a consumer group.
kafka-consumer-groups.sh --delete --group [group-name] --bootstrap-server [server] # Delete a consumer group.


Enter fullscreen mode Exit fullscreen mode

Offsets Management



kafka-consumer-groups.sh --reset-offsets --group [group-name] --topic [topic-name] --to-earliest --bootstrap-server [server] # Reset offsets for a consumer group to the earliest.
kafka-consumer-groups.sh --reset-offsets --group [group-name] --topic [topic-name] --to-latest --bootstrap-server [server] # Reset offsets for a consumer group to the latest.


Enter fullscreen mode Exit fullscreen mode

Partition Management



kafka-reassign-partitions.sh --reassignment-json-file [file] --execute --bootstrap-server [server] # Reassign partitions as specified in the JSON file.
kafka-reassign-partitions.sh --reassignment-json-file [file] --verify --bootstrap-server [server] # Verify partition reassignment.


Enter fullscreen mode Exit fullscreen mode

Log Management



kafka-log-dirs.sh --describe --bootstrap-server [server] # Describe log directories.


Enter fullscreen mode Exit fullscreen mode

Configuration Management



kafka-configs.sh --alter --entity-type [type] --entity-name [name] --add-config [config] --bootstrap-server [server] # Alter configurations for a specified entity.
kafka-configs.sh --describe --entity-type [type] --entity-name [name] --bootstrap-server [server] # Describe configurations for a specified entity.


Enter fullscreen mode Exit fullscreen mode

Code Quality and Security

SonarQube CLI Commands

Basic Commands



sonar-scanner # Run the SonarQube scanner to analyze your project.
sonar-scanner -h # Display help information.
sonar-scanner -v # Display version information.
sonar-scanner -X # Produce execution debug output.


Enter fullscreen mode Exit fullscreen mode

Configuration



-Dsonar.projectKey=[projectKey] # Set the unique project key.
-Dsonar.projectName=[projectName] # Set the project name.
-Dsonar.projectVersion=[version] # Set the project version.
-Dsonar.sources=[sourcePath] # Set the source code path.
-Dsonar.host.url=[URL] # Set the SonarQube server URL.
-Dsonar.login=[token] # Set the authentication token.


Enter fullscreen mode Exit fullscreen mode

Advanced Configuration



-Dsonar.sourceEncoding=[encoding] # Set the source code encoding (default is system encoding).
-Dsonar.exclusions=[pattern] # Exclude files from analysis.
-Dsonar.inclusions=[pattern] # Include only specific files in the analysis.
-Dsonar.tests=[testPath] # Set the test code path.
-Dsonar.test.inclusions=[pattern] # Include only specific test files in the analysis.
-Dsonar.test.exclusions=[pattern] # Exclude test files from analysis.


Enter fullscreen mode Exit fullscreen mode

Running Analysis



sonar-scanner -Dsonar.projectKey=my:project -Dsonar.sources=. -Dsonar.host.url=http://localhost:9000 -Dsonar.login=myAuthenticationToken # Example command to run analysis with specified parameters.


Enter fullscreen mode Exit fullscreen mode

Docker Commands


 docker
docker run --rm -e SONAR_HOST_URL="http://your-sonarqube-server" -v "${YOUR_REPO}:/usr/src" sonarsource/sonar-scanner-cli # Run SonarScanner CLI using Docker.


Enter fullscreen mode Exit fullscreen mode

⬆️ Go to Top | ⬇️ Go to Bottom


πŸ”₯ Conclusion

Mastering the command line can significantly boost your productivity and efficiency. This cheat sheet is designed to be your go-to CLI reference, whether you're a beginner or an experienced user.

πŸ’‘ Stay Updated: I will continue to add new topics and update existing commands as technologies evolve. Make sure to bookmark this page and check back for the latest updates!


πŸ“’ Your Feedback Matters!

  • Have a new topic request? Let me know in the comments!
  • Found a command that isn’t working? Drop a comment, and I’ll fix it.

πŸš€ Like, share, and support this blog if you found it useful! Let’s make this the ultimate CLI cheat sheet for everyone! πŸ’»βš‘


πŸ“’ Let’s Connect!

πŸ’Ό LinkedIn | πŸ“‚ GitHub | ✍️ Dev.to | 🌐 Hashnode


πŸ’‘ Join the Conversation:

  • Found this useful?** Like πŸ‘, comment πŸ’¬.
  • Share πŸ”„ to help others on their journey!
  • Have ideas? Share them below!
  • Bookmark πŸ“Œ this content for easy access later.
  • Save this article πŸ“– for future updates.

Let’s collaborate and create something amazing! πŸš€


πŸš€ Useful Resources


⬆️ Go to Top | ⬇️ Go to Bottom


Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (7)

Collapse
 
mahmoudessam profile image
Mahmoud EL-kariouny β€’

Thank you it's very helpful.

Collapse
 
ramkumar-m-n profile image
Ramkumar M N β€’

Hi Mohmoud,
Thank you for the acknowledgement .

Collapse
 
mahmoudessam profile image
Mahmoud EL-kariouny β€’

It's my pleasure Ramkumar

Collapse
 
webdeveloperhyper profile image
Web Developer Hyper β€’

Wow!
So much information about CLI.
Very valuable post.
Thank you for sharing.πŸ˜€

Collapse
 
ramkumar-m-n profile image
Ramkumar M N β€’

Hi WDH,

Thanks for your acknowledgement, Glad you found it valuable! The CLI is such a powerful tool, and I love sharing useful insights. Appreciate your support and feedback as always!

Regards,
Ram

Collapse
 
matt-hummel-pa profile image
Matt Hummel β€’

Thank you for providing this list. I'm currently updating my skillset for more modern tools. I'll be referring back to this post frequently.

Collapse
 
ramkumar-m-n profile image
Ramkumar M N β€’

Hi Matt,

Glad you found it useful! Keeping skills up to date with modern tools is always a great move. Feel free to check back anytime, and if you have any questions or need recommendations, just let me know. Happy learning!

Please mark it in your reading list, I will keep you posted.

Regards,
Ram

Some comments may only be visible to logged-in visitors. Sign in to view all comments.

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay