Commands Cheat Sheet

Evaluating engineering tools? Get the comparison in Google Sheets

(Perfect for making buy/build decisions or internal reviews.)

Most-used commands
Your email is safe thing.

Thankyou for your submission

We have sent the cheatsheet on your email!
Oops! Something went wrong while submitting the form.

Connection

knife ssl fetch
Retrieve SSL certificates from the Chef server

knife ssl check
Verify SSL certificates for Chef server

knife client list
List all registered clients

knife user list
List all registered users

Node Management

knife node list
List all registered nodes

knife node show NODE_NAME
Show details for a specific node

knife node edit NODE_NAME
Edit node attributes

knife node delete NODE_NAME
Delete a node

knife node run_list add NODE_NAME 'recipe[cookbook::recipe]'
Add a recipe to a node's run list

knife node run_list remove NODE_NAME 'recipe[cookbook::recipe]'
Remove a recipe from a node's run list

Cookbook Management

knife cookbook list
List all cookbooks

knife cookbook show COOKBOOK_NAME
Show details of a specific cookbook

knife cookbook upload COOKBOOK_NAME
Upload a cookbook to the Chef server

knife cookbook download COOKBOOK_NAME
Download a cookbook from the Chef server

knife cookbook delete COOKBOOK_NAME
Delete a cookbook from the Chef server

knife cookbook test COOKBOOK_NAME
Test a cookbook syntax

Environment Management

knife environment list
List all environments

knife environment show ENV_NAME
Show details for a specific environment

knife environment create ENV_NAME
Create a new environment

knife environment edit ENV_NAME
Edit an environment

knife environment delete ENV_NAME
Delete an environment

Role Management

knife role list
List all roles

knife role show ROLE_NAME
Show details for a specific role

knife role create ROLE_NAME
Create a new role

knife role edit ROLE_NAME
Edit a role

knife role delete ROLE_NAME
Delete a role

Data Bag Management

knife data bag list
List all data bags

knife data bag show BAG_NAME
Show contents of a data bag

knife data bag create BAG_NAME
Create a new data bag

knife data bag delete BAG_NAME
Delete a data bag

knife data bag item create BAG_NAME ITEM_NAME
Create an item in a data bag

knife data bag item delete BAG_NAME ITEM_NAME
Delete an item from a data bag

Client-Side Commands

chef-client
Run the Chef client to configure the node

chef-client --why-run
Do a dry run of chef-client without making changes

chef-client -l debug
Run chef-client with debug logging

chef-client -o 'recipe[cookbook::recipe]'
Run a specific recipe only

chef-client -j JSON_ATTRIBUTES
Use a JSON file of attributes

Reporting and Monitoring

knife status
Show node status with last check-in time

knife status 'name:NODE_PATTERN'
Show status of nodes matching pattern

knife exec -E 'nodes.all {|n| puts n.name if n.chef_environment == "production"}'
List all nodes in production environment

knife reporting status
Get status of Chef reporting