Table of contents
1.
Introduction
2.
Chef Overview
3.
Download Cookbook
4.
Install Cookbook
4.1.
Syntax
5.
Arguments
5.1.
list
5.2.
Search
5.3.
Share
5.4.
Show
5.5.
Unshare
6.
Frequently Asked Questions
6.1.
What are the Chef's clients and servers?
6.2.
What is the Chef automation tool?
6.3.
What is the difference between a chef and Ansible?
6.4.
Is Chef a programming language?
6.5.
What is the Knife?
6.6.
What is a chef supermarket?
7.
Conclusion
Last Updated: Aug 13, 2025

Knife Supermarket Subcommand

Author Mayank Goyal
0 upvote
Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction

The knife supermarket subcommand can access Cookbooks on public and private Chef Supermarket sites. Any community activity that writes data to the Chef Supermarket requires a user account; however, the following arguments—download, search, install, and list do not.

knife supermarket

But what is the chef? Let's have a basic overview of the chef.

Chef Overview

chef overview

Opscode created the open-source technology known as Chef. Adam Jacob is the founder of the Chef. He is also the co-founder of Opscode. This technology creates fundamental building pieces like recipes and cookbooks using Ruby encoding. Chef is used to automating infrastructure management, which helps to cut down on manual labour and repetitive chores.

Chef is a configuration management technology that is used to automate infrastructure provisioning. It was created using the Ruby DSL language as a foundation. Configuring and managing the company's server is simplified with it. It is capable of being merged with any cloud technology.

To install and maintain servers and apps both locally and in the cloud, DevOps uses Chef.

Now we have a basic understanding of Knife supermarket subcommand and chef. Now let's see how we can download and install cookbooks on our local machine.

Download Cookbook

To download a cookbook from Chef Supermarket, use the download argument. A tar.gz archive of a cookbook will be downloaded and put in the currently active working directory. Suppose the —force option is not used. In that case, the knife will notify the user that a cookbook (or cookbook version) has been deprecated and then provide the name of that cookbook's most recent non-deprecated version.

Syntax knife supermarket download COOKBOOK_NAME [COOKBOOK_VERSION] (options)
Option
  • COOKBOOK VERSION
    The downloadable edition of a cookbook. This option can be used only if a cookbook has one version. The most recent version is downloaded if this option is not chosen and a cookbook has multiple versions.
     
  • -f FILE, --file FILE
    The document that a downloaded cookbook is written to.
     
  • --force
    Replace a current directory.
     
  • --supermarket-site, -m
    The website address of the Chef Supermarket. https://supermarket.chef.io is the default setting.

Install Cookbook

Install a cookbook downloaded from Chef Supermarket to a local git repository using the install parameter. Installing user-contributed recipes to the nearby chef-repo uses the git version control system and the Chef Supermarket website. Using this defense results in the following:

  1. A new "pristine copy" branch is made in git to track the upstream.
     
  2. A cookbook's current iterations are all deleted from the branch.
     
  3. The cookbook can be obtained in tar.gz format from Chef Supermarket.
     
  4. The downloaded cookbook's contents are untarred, committed to git, and given a tag.
     
  5. The master branch incorporates the "pristine copy" branch.
     

This procedure enables git to keep modifications as a separate patch while allowing the upstream cookbook in the master branch to be amended. Any local modifications can be kept while the changes are merged once an updated upstream version is accessible.

Syntax

Syntax knife supermarket installs COOKBOOK_NAME [COOKBOOK_VERSION] (options)

Now that we have gone through the setup process, let’s see the arguments available:

Arguments

list

View a list of the cookbooks that Chef Supermarket has in stock using the list argument.

Syntax knife supermarket list (options)
Option
  • -m, --supermarket-site
    The URL at which the Chef Supermarket is located. Default value: https://supermarket.chef.io.
     
  • -w, --with-uri

Search

Search for a cookbook at Chef Supermarket using the search argument. These cookbooks are listed using a search query that has the same syntax as the knife search subcommand.

Syntax knife supermarket search SEARCH_QUERY (options)
Option
  • -m, --supermarket-site
    The URL at which the Chef Supermarket is located. Default value: https://supermarket.chef.io.

Share

Cookbooks can be added to Chef Supermarket using the shared parameter. A user account and a Chef Supermarket certificate are needed for this action. If not given on the command line or in a different configuration file, the knife will use the user name and API key listed in the configuration file used during the upload by default. Only the owner or maintainer of a cookbook that already exists in Chef Supermarket is permitted to make revisions.

Syntax knife supermarket share COOKBOOK_NAME CATEGORY (options)
Option
  • CATEGORY
    The cookbook category: includes "Databases," "Web Servers," "Process Management," "Monitoring & Trending," "Programming Languages," "Package Management," "Applications," "Networking," "Operating Systems & Virtualization," "Utilities," or "Other."

     
  • -m, --supermarket-site
    The URL at which the Chef Supermarket is located. Default value: https://supermarket.chef.io.

     
  • -o PATH:PATH, --cookbook-path PATH:PATH
    The directory in which cookbooks are created. This can be a colon-separated path.

Show

View details about a cookbook at Chef Supermarket by using the show argument.

Syntax knife supermarket show COOKBOOK_NAME [COOKBOOK_VERSION] (options)
Option
  • COOKBOOK VERSION
    the cookbook layout is shown. This option can be used only if a cookbook has one version. A list of cookbook versions is returned if this option is omitted and a cookbook has many versions.
     
  • -m, --supermarket-site
    the website address of the Chef Supermarket. https://supermarket.chef.io is the default setting.

Unshare

Stop sharing a cookbook from Chef Supermarket by using the unshare argument. The cookbook's maintainer can only carry out this action.

Syntax knife supermarket unshares COOKBOOK_NAME/versions/VERSION (options)
Option
  • -m, --supermarket-site
    the website address of the Chef Supermarket. https://supermarket.chef.io is the default setting.

Check out this article - Converting NFA to DFA

Check out most important Git Interview Questions here.

Frequently Asked Questions

What are the Chef's clients and servers?

The hub of the workstation and the nodes is the Chef Server. Here, all of the metadata, cookbooks, and recipes are kept.

What is the Chef automation tool?

A chef is an automation tool. It provides a way to define infrastructure as code. It means managing infrastructure by writing code. It is also called a programmable infrastructure.

What is the difference between a chef and Ansible?

A chef is a for-profit tool, whereas Ansible is an open-source IT automation solution. Ansible is used for application deployment automation, configuration management, and short procedures like updating the RHEL or Linux operating systems.

Is Chef a programming language?

Chef is an esoteric programming language. Programs in Chef look like recipes. The main principle of language design is: that program recipes should not only generate valid output but be easy to prepare and delicious.

What is the Knife?

The command-line tool for communicating with the Chef server is called Knife. It is used for managing other Chef features as well as uploading cookbooks. It connects the local machine's chefDK (Repo) and the Chef server.

What is a chef supermarket?

Supermarket serves as the hub for the exchange of cookbooks, plugins, and tools within the Chef community. It is a location where members of the Chef community can download shared recipes, work together to create cookbooks, and post cookbooks for usage by other community members.

Conclusion

In this article, we had an overview of the Knife supermarket subcommand. We have discussed the various subcommands of knife supermarket.

Refer to the Overview of knife cookbookAbout knife search subcommand, and About knife user subcommand to have better knowledge.

You can also refer to our Guided Path on Coding Ninjas Studio to upskill yourself in Data Structures and AlgorithmsCompetitive ProgrammingJavaScriptSystem DesignOperating SystemCompiler DesignAutomata Theory, and many more! If you want to test your competency in coding, check out the mock test series and participate in the contests hosted on Coding Ninjas Studio!

Happy Coding!

Live masterclass