Compare commits

..

48 Commits

Author SHA1 Message Date
waldek 6d38977f46 fixes the sequence image 2022-08-23 11:05:45 +02:00
waldek 929aae54ea adds systemd 2022-08-23 11:04:55 +02:00
waldek 4ef8fd3886 adds math function for priority 2022-08-23 10:08:34 +02:00
waldek 8fa1a1dc37 adds missing python scripts 2022-08-23 09:59:09 +02:00
waldek b2c5e93fe1 adds processes from course doc 2022-08-22 14:33:56 +02:00
waldek b5b308e84c joining changes from online and command line.
Merge branch 'master' of ssh://86thumbs.net:3022/waldek/linux_introduction
2022-07-15 16:12:25 +02:00
waldek 9ee90d41e8 from command line 2022-07-15 16:11:23 +02:00
waldek 4109279420 Update 'outline.md'
again, should not do this...
2022-07-15 16:10:20 +02:00
waldek f5dd5be7a4 adds adbellah kvm link 2022-07-15 13:57:54 +02:00
waldek 2a142396ad adds vim config link 2022-07-15 11:18:19 +02:00
waldek 0c82904a33 recutils link 2022-07-14 16:23:30 +02:00
waldek 77ea7d4c79 quick and dirty function doc 2022-07-14 16:16:26 +02:00
waldek 4a7606507d quick break and continue example 2022-07-14 15:49:06 +02:00
waldek b9badbde9d fixes #1 2022-07-14 14:41:23 +02:00
waldek 6f87421044 adds a license to the repo 2022-07-14 14:35:07 +02:00
waldek de588dc4e3 moves the homework into a folder and starts readme 2022-07-14 12:23:02 +02:00
waldek 17e141c6bf adds chapters to the todo md file 2022-07-14 11:54:58 +02:00
waldek 98125772f3 Merge branch 'master' of ssh://86thumbs.net:3022/waldek/linux_introduction 2022-07-14 11:46:43 +02:00
waldek ba528bd3e1 adds todo over the break 2022-07-14 11:46:16 +02:00
waldek b9bd04bb1e adds new birthday ex 2022-07-11 11:50:00 +02:00
waldek a5ca242827 adds a simpler broken ip list to the first exercises 2022-07-08 10:37:01 +02:00
waldek d64b0d334c starts setuid 2022-07-07 09:14:29 +02:00
waldek fc5c7f68fc quick generation of exercise files 2022-07-04 10:08:47 +02:00
waldek 98c334aa8b adds outline for steve 2022-07-01 14:48:38 +02:00
waldek b230fcdc73 moves nspawn files 2022-07-01 12:02:55 +02:00
waldek e048ba9973 adds basic debos files 2022-07-01 11:26:22 +02:00
waldek c5dad30511 one more exercise... 2022-06-28 23:06:28 +02:00
waldek 0a7f47a309 finishes some text manipulation exercises 2022-06-28 22:45:20 +02:00
waldek 6af5846681 Merge branch 'master' of ssh://86thumbs.net:3022/waldek/linux_introduction 2022-06-28 20:22:49 +02:00
waldek 688bcab1b7 adds text manipulation exercises 2022-06-28 20:22:42 +02:00
waldek 005e727434 Merge branch 'master' of ssh://86thumbs.net:3022/waldek/linux_introduction 2022-06-28 20:21:50 +02:00
waldek eddafa6545 adds gsm list belgium 2022-06-28 20:21:36 +02:00
waldek fe76dac62a first documentation of shell modding 2022-06-15 17:19:33 +02:00
waldek 10605055d6 adds umask and input redirect 2022-06-15 15:38:52 +02:00
waldek 33e1323a4c adds some bash ex 2022-06-14 14:41:28 +02:00
waldek 45cdcf0c8b merges links 2022-06-14 14:40:24 +02:00
waldek 6fdf048d2b add some links 2022-06-14 14:39:05 +02:00
waldek 4f5c8b37ce adds more links 2022-06-14 14:38:33 +02:00
waldek 0f98886112 more links and exercises 2022-05-24 15:14:14 +02:00
waldek 4719e5d451 more scripting 2022-05-23 16:51:00 +02:00
waldek 83d38d2105 completes some more bash scripting 2022-05-23 15:20:56 +02:00
waldek 74fa7c957a Merge branch 'testing' 2022-05-20 17:19:31 +02:00
waldek 7f1c2b59b2 Merge branch 'testing' of ssh://86thumbs.net:3022/waldek/linux_introduction into testing 2022-05-20 17:18:25 +02:00
waldek 97db0d9d07 merge of forgotten link 2022-05-20 17:15:30 +02:00
waldek f85ead5c4e missing link 2022-05-20 17:07:19 +02:00
waldek 7d391db0d9 moves coding challenge to end of chapter 2022-05-20 15:56:52 +02:00
waldek 2560bf39ad adds the template for shells plus more scripting info 2022-05-20 15:18:40 +02:00
waldek b9ef2de302 links update 2022-05-19 13:08:16 +02:00
42 changed files with 81772 additions and 58 deletions

5
.gitignore vendored
View File

@ -1 +1,6 @@
*.swp *.swp
tmp.*
*.raw
.mkosi*
*.tgz
*.img

674
LICENSE Normal file
View File

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

View File

@ -351,7 +351,6 @@ waldek@metal:~$
# Coding challenge - Output system stats # Coding challenge - Output system stats
Write a program that prints information about your computer such as: Write a program that prints information about your computer such as:
* the hostname * the hostname
@ -410,6 +409,9 @@ hmmm, I don't know how to compare helloworld to supersecret
waldek@metal:~$ waldek@metal:~$
``` ```
We haven't learned how to *evaluate* values but if you're eager and quick you can try to figure it out yourself.
If not, no worries, we'll get to *conditional logic* soon enough.
<details> <details>
<summary>Spoiler warning!</summary> <summary>Spoiler warning!</summary>
@ -425,11 +427,60 @@ echo "hmmm, I don't know how to compare $pass to $my_pass"
</details> </details>
### `read` multiple variables ### `read` multiple variables
TODO `read` can be used to unpack multiple values right on the spot!
By *unpacking* I mean that each value is separated by **white space**.
A demonstration can be seen below, plus the actual code right after.
```
waldek@debian:~$ bash test.sh
first and last name please: wouter gordts
hello mr gordts...
or may I call you wouter?
waldek@debian:~$
```
```
#!/bin/bash
read -p "first and last name please: " first last
echo "hello mr $last..."
echo "or may I call you $first?"
```
#### Exercise - unpack values
It is worth discovering what happens when you supply too many or to little values.
Please try this out!
# Coding challenge - Birthday **day**
Write me `bash` program that asks for your date of birth and prints the day of the week that was.
Like the output below.
```
waldek@server:~$ bash birthday.sh
what is your birthday (day month year)? 07 10 1986
you where born on a Tuesday
```
<details>
<summary>Spoiler warning!</summary>
```bash
#!/bin/bash
read -p "what is your date of birth? (day month year) " day month year
day_of_the_week=$(date +%A -d "$month/$day/$year")
echo "you where born on a $day_of_the_week"
```
</details>
## With command line arguments ## With command line arguments
@ -457,14 +508,6 @@ This variable represents the *first* argument on the command line.
Knowing this, what would `$4` mean? Knowing this, what would `$4` mean?
Indeed, the *fourth* argument... Indeed, the *fourth* argument...
## From a file
TODO
## From a pipe
TODO
# Coding Challenge - output the exact output below # Coding Challenge - output the exact output below
``` ```
@ -668,7 +711,91 @@ fi
## How does it work behind the scenes? ## How does it work behind the scenes?
TODO - explain `test` and exit status ## exit status
Every command you execute on the command line has an **exit code**.
You can [read up](https://en.wikipedia.org/wiki/Exit_status) a bit on what they are but the most important things to know are:
* the code is always a **number**
* on our systems it's a [uint8](https://en.wikipedia.org/wiki/Integer_(computer_science)#Common_integral_data_types) which means a value between **0** and **255**
* the [**convention**](https://tldp.org/LDP/abs/html/exitcodes.html) is that `0` means **success**, everything else is an **error**
In your bash shell, the variable `$?` always references the *last* exit status code.
We can discover it's behaviour as follows.
```
waldek@debian:~$ ls does_exist
does_exist
waldek@debian:~$ echo $?
0
waldek@debian:~$ ls does_not_exist
ls: cannot access 'does_not_exist': No such file or directory
waldek@debian:~$ echo $?
2
waldek@debian:~$ echo $?
0
waldek@debian:~$
```
The **first** `echo $?` prints the exit code of `ls does_exist`.
The **second** prints the exit code of the *failed* command `ls does_not_exist`.
The **third** prints the exit code of the `echo $?` that failed!
## `test`
The presence of exit codes means we can **evaluate** their value and make **decisions** based on the outcome.
The main workhorse for this is a builtin called `test`.
```
waldek@debian:~$ whatis test
test (1) - check file types and compare values
waldek@debian:~$
```
I **highly** recommend you take some time to read the `man test`.
Because the convention of exit codes is *no news, good news* there are two tiny programs that just serve to output `true` and `false`, where true is `0` and false is `1`.
A little demonstration.
```
waldek@debian:~$ which true
/usr/bin/true
waldek@debian:~$ which false
/usr/bin/false
waldek@debian:~$ whatis true
true (1) - do nothing, successfully
waldek@debian:~$ whatis false
false (1) - do nothing, unsuccessfully
waldek@debian:~$ true
waldek@debian:~$ echo $?
0
waldek@debian:~$ false
waldek@debian:~$ echo $?
1
waldek@debian:~$ test true == true
waldek@debian:~$ echo $?
0
waldek@debian:~$ test true == false
waldek@debian:~$ echo $?
1
waldek@debian:~$
```
Again, I highly advise you to read the `man test`.
If you did this then the following will make a lot of sense.
```
waldek@debian:~$ test -a does_exist
waldek@debian:~$ echo $?
0
waldek@debian:~$ test -d does_exist
waldek@debian:~$ echo $?
1
waldek@debian:~$ test -a does_not_exist
waldek@debian:~$ echo $?
1
waldek@debian:~$ test ! -a does_not_exist; echo $?
0
waldek@debian:~$
```
The table below is taken from the bash reference manual you can find [here](https://www.gnu.org/software/bash/manual/bash.html#Bash-Conditional-Expressions). The table below is taken from the bash reference manual you can find [here](https://www.gnu.org/software/bash/manual/bash.html#Bash-Conditional-Expressions).
@ -709,8 +836,6 @@ The table below is taken from the bash reference manual you can find [here](http
| string1 < string2 | True if string1 sorts before string2 lexicographically. | | string1 < string2 | True if string1 sorts before string2 lexicographically. |
| string1 > string2 | True if string1 sorts after string2 lexicographically. | | string1 > string2 | True if string1 sorts after string2 lexicographically. |
## Nested `if` statements ## Nested `if` statements
It's worth pointing out we can *nest* `if` statements *inside* other `if` statements. It's worth pointing out we can *nest* `if` statements *inside* other `if` statements.
@ -731,6 +856,38 @@ if [ "$num" -lt "300" ]; then
fi fi
``` ```
## A *modern* version of `test`
I'll be the first to admit that the syntax of `bash` can be confusing and is rarely reader friendly.
A nice, but brief, explication of the nuances of single and double brackets can be found in [this](https://unix.stackexchange.com/questions/306111/what-is-the-difference-between-the-bash-operators-vs-vs-vs) stack overflow post.
The double bracket command are called [compound commands](https://www.gnu.org/software/bash/manual/html_node/Compound-Commands.html).
### `[[ ]]`
```
waldek@debian:~$ [[ 3 = [[:digit:]] ]] ; echo $?
0
waldek@debian:~$ [ 3 = [[:digit:]] ] ; echo $?
1
```
TODO
### `(( ))`
TODO
### `&&` and `||`
```
waldek@debian:~$ test true == true && echo "yes sir!" || echo "nope..."
yes sir!
waldek@debian:~$ test true == false && echo "yes sir!" || echo "nope..."
nope...
waldek@debian:~$
```
[Ryan's tutorials](https://ryanstutorials.net/bash-scripting-tutorial/bash-if-statements.php)
# Coding challenge - File information # Coding challenge - File information
Write a script that takes one argument which should be a valid file path. Write a script that takes one argument which should be a valid file path.
@ -787,37 +944,497 @@ fi
</details> </details>
## A *modern* version of `test` # Coding challenge - pipe or argument?
### `[[ ]]` Can you code me a script that depending on how it is called, with argument or via pipe, prints a different message?
Along these lines...
TODO ```
waldek@debian:~$ bash test.sh
No input was found on stdin, skipping!
No input given!
waldek@debian:~$ bash test.sh shopping.list
No input was found on stdin, skipping!
Filename specified: shopping.list
Doing things now..
waldek@debian:~$ cat shopping.list | bash test.sh
Data was piped to this script!
waldek@debian:~$
```
### `(( ))` <details>
<summary>Spoiler warning!</summary>
TODO **It might take you some time but we've seen all the necessary building blocks!**
### `&&` and `||` <details>
<summary>Spoiler warning!</summary>
TODO ```bash
#!/bin/bash
[Ryan's tutorials](https://ryanstutorials.net/bash-scripting-tutorial/bash-if-statements.php) if [ -p /dev/stdin ]; then
echo "Data was piped to this script!"
else
echo "No input was found on stdin, skipping!"
if [ -f "$1" ]; then
echo "Filename specified: ${1}"
echo "Doing things now.."
else
echo "No input given!"
fi
fi
```
</details>
</details>
# Loops - A variety of ways to perform repetitive tasks. # Loops - A variety of ways to perform repetitive tasks.
[Ryan's tutorials](https://ryanstutorials.net/bash-scripting-tutorial/bash-loops.php) Up until now all our scripts run from top to bottom, executing each line as they are read.
Most, if not all, programming languages offer some form of looping to **repeat** lines of code either based on a **condition** or for a predefined number of *items*.
Write a script that sets all you cpu's to a desired governor. ## `while` loop
Rename all files in a folder with an prefix or postfix. ```bash
#!/bin/bash
counter=0
while [[ counter -lt 10 ]]; do
echo $counter
(( counter++ ))
done
```
### Read from a file with a `while` loop
Below you can see I have two files, one is my *shopping list*, the other my script.
The script loops over each item I have to buy and prints me a verbose message.
```
waldek@debian:~$ cat shopping.list
6 eggs
1 bread
2 milk
4 pasta
waldek@debian:~$ bash test.sh shopping.list
you need to buy: 6 eggs
you need to buy: 1 bread
you need to buy: 2 milk
you need to buy: 4 pasta
waldek@debian:~$
```
One way to do this is with a `while` loop.
The syntax is a follows.
```bash
#!/bin/bash
while read line; do
echo "you need to buy: $line"
done < $1
```
The syntax is not what I would call *pretty* but it is quite effective.
The **file** `$1` is redirected **into** the `while` loop which performs a `read`.
**When** there are no more lines in the file, the condition **fails** and the loop exits.
### Read from a pipe with a `while` loop
We can use a *very* similar construct to read data from a pipe.
The utilisation is as follows.
```
waldek@debian:~$ cat shopping.list | ./test.sh
you need to buy: 6 eggs
you need to buy: 1 bread
you need to buy: 2 milk
you need to buy: 4 pasta
waldek@debian:~$
```
And the code that does this as such.
```bash
#!/bin/bash
while IFS= read line; do
echo "you need to buy: $line"
done
```
What on earth is this `IFS=`?
I'm glad you [asked](https://unix.stackexchange.com/questions/184863/what-is-the-meaning-of-ifs-n-in-bash-scripting)!
## `for` loop
Ah, my favorite loop!
While the `while` loop runs as long as a condition is `true`, the `for` loop **iterates** over *items*.
The simplest way to visualize it would be as follows.
For each *friend* in my list of friends I'll say hello.
```
waldek@debian:~$ ./test.sh
these are my friends: adam camille alice bob steve
hello adam!
hello camille!
hello alice!
hello bob!
hello steve!
waldek@debian:~$
```
The syntax to achieve this goes as follows.
```bash
#!/bin/bash
friends="adam camille alice bob steve"
echo "these are my friends: $friends"
for f in $friends; do
echo "hello $f!"
done
```
### Counter loops with `for`
We can do a counter loop as well via a `for` loop.
An easy way to do this is by using the `seq` program.
Remember to read the `man seq` for more information.
```bash
#!/bin/bash
for number in $(seq 0 10); do
echo "number is $number"
done
```
### Finicky behaviour
`bash` is not the prettiest language and the difference between single and double quotes can be a bit confusing.
```bash
#!/bin/bash
for animal in dog cat horse 'racing horse' whale; do
echo "$animal says: I'm an animal..."
done
```
Which gives the following output.
```
waldek@debian:~$ ./test.sh
dog says: I'm an animal...
cat says: I'm an animal...
horse says: I'm an animal...
racing horse says: I'm an animal...
whale says: I'm an animal...
waldek@debian:~$
```
## `break` and `continue`
When we consider the `secret.sh` password checker we made, we have a problem.
The program always exits, either with a success code `0` or with an error of `1`.
In order to *break* a loop conditionally we need a new keyword, `break`.
I rewrote the same script but with a more logical flow of operation.
```bash
#!/bin/bash
secret="test123"
tries=3
while true; do
read -s -p "your password please: " password
if [[ $password == $secret ]]; then
echo "access granted!"
break
else
(( tries-- ))
if [[ $tries -eq 0 ]]; then
echo "access denied!"
exit 1
fi
echo "wrong password, you have $tries left..."
fi
done
echo "we're in!"
echo "the code keeps on flowing..."
```
`continue` is very similar to `break`.
It *breaks* the current iteration and **continues** to the next cycle.
Consider the example below.
```bash
#!/bin/bash
counter=0
value=0
while [[ $counter -lt 100 ]]; do
if (( $counter % 2 )); then
echo "$counter is even"
random=$(( $RANDOM % 20 ))
echo "adding $random to the counter"
counter=$(( $random + $counter ))
echo "and I'll loop again"
continue
fi
echo "incrementing $counter by just one..."
(( counter++ ))
done
```
# Functions - Reuse code to make life easier. # Functions - Reuse code to make life easier.
[Ryan's tutorials](https://ryanstutorials.net/bash-scripting-tutorial/bash-functions.php) ## defining a function
```bash
#!/bin/bash
function say_hello() {
echo "hello world"
}
say_hello
say_hello
say_hello
```
## function arguments
```bash
#!/bin/bash
function say_hello() {
echo "hello $1"
}
say_hello
say_hello "Alice"
say_hello "Steve" "Camille"
```
## global vs local variable
### global example
```bash
#!/bin/bash
default="my friend"
function say_hello() {
if ! [[ -z $1 ]]; then
default=$1
fi
echo "hello $default"
}
say_hello
say_hello "Alice"
say_hello
```
### local example
```bash
#!/bin/bash
default="my friend"
function say_hello() {
if ! [[ -z $1 ]]; then
local name=$1
else
local name=$default
fi
echo "hello $name"
}
say_hello
say_hello "Alice"
say_hello
```
## return values
```bash
#!/bin/bash
function add_two_numbers() {
if [[ -z $1 ]] && [[ -z $2 ]]; then
echo "I need two arguments!"
return 1
elif ! [[ "$1" =~ ^[0-9]+$ ]] || ! [[ "$2" =~ ^[0-9]+$ ]]; then
echo "arguments need to be numbers!"
return 2
fi
echo "$1 + $2 = $(( $1 + $2 ))"
return 0
}
add_two_numbers
echo $?
add_two_numbers "Alice" "Bob"
echo $?
add_two_numbers 3 4
echo $?
```
## the `command` builtin
```bash
#!/bin/bash
function ls () {
echo "I'm a function..."
}
ls
command ls /etc/ssh/
```
# Coding challenge - pipe or argument plus action!
Can you expand the previous coding challenge, where you perform a conditional logic on the input of the script and actually *use* the incoming data?
For example, print a shopping list or make a sum of all items you need to purchase.
# Coding challenge - Rename files
Rename all files from [this](../assets/simple_sort_01.tar.gz) file with an prefix or postfix.
Can you give the files that start with an **uppercase** letter a different pre or postfix?
Can you move the files with lowercase into a different folder?
If you did it with a prefix, now try with a postfix.
# Coding challenge - Rename jpeg files
Download [these](../assets/jpeg_ext.tar) files, which are all `jpeg` files.
The extensions however are not really uniform.
Find the most common extension type and rename all files with that extension.
# Coding challenge - Remove duplicate files
Find all duplicate files from [this](../assets/shasum.tar) and move them to a different directory.
How certain are you that they are duplicates?
# Coding challenge - File tree
Download [this](../assets/tree.tar) file and use the content of the directory to write me a program that prints the content as a tree structure.
You can be *creative* but it's interesting to learn how to perform these action by hand.
As an extra challenge I would like you to add different behaviour to the script, depending on the input.
For example, if the input file is a `tar.gz` file, the program will automatically uncompress and then show the tree.
[hint](https://www.shellscript.sh/eg/directories/)
# Coding challenge - Compare and move
Compare [these](../assets/) files from `one` directory with `second` directory and if they exist in the second directory, copy them to a `third` directory.
<details>
<summary>Spoiler warning!</summary>
```bash
dir1=directory1
dir2=directory2
dir3=directory3
v=v # change to v= to make it quieter
shopt -s globstar
mkdir -p$v "$dir3"
for f1 in "$dir1"/*.dll; do
for f2 in "$dir2"/**/"${f1##*/}"; do
if [[ -f "$f2" ]]; then
cp ${v:+-v} "$f1" "$dir3/"
break
fi
done
done
```
</details>
# Coding challenge - Guess the number
Can you make me a small guessing game like the one below?
```
waldek@debian:~$ ./test.sh
I have a number in mind between 0 and 100
your quess: 10
my number is smaller...
your quess: 5
my number is bigger...
your quess: helloworld
I don't understand you...
your quess: 6
disco! I had 6 in mind...
waldek@debian:~$
```
<details>
<summary>Spoiler warning!</summary>
```bash
#!/bin/bash
difficulty=100
computernumber=$(( $RANDOM % ( $difficulty + 1)))
echo "I have a number in mind between 0 and $difficulty"
while true; do
read -p "your quess: " usernumber
if [ $usernumber -lt $computernumber ] 2> /dev/null; then
echo "my number is bigger..."
elif [ $usernumber -gt $computernumber ] 2> /dev/null; then
echo "my number is smaller..."
elif [ $usernumber -eq $computernumber ] 2> /dev/null; then
echo "disco! I had $computernumber in mind..."
break
else
echo "I don't understand you..."
fi
done
```
</details>
# Coding challenge - Student reports
With the [following](../assets/scores.csv) file write me a program that prints:
* the total average score for each student
* individual scores for each student
* list of passed student or list of failed students
# User Interface - Make your scripts user friendly. # User Interface - Make your scripts user friendly.
[Ryan's tutorials](https://ryanstutorials.net/bash-scripting-tutorial/bash-user-interfaces.php) * `case` for command line arguments
* `select` for small menu's
* [dialog tutorial](https://www.linuxjournal.com/article/2807)
* [better dialog tutorial](https://linuxcommand.org/lc3_adv_dialog.php)
* [Ryan's tutorials](https://ryanstutorials.net/bash-scripting-tutorial/bash-user-interfaces.php)
# Coding challenge - Address book
* one file db or folder db
* use [recutils](https://www.gnu.org/software/recutils/manual/) for an easy to use text based database
* case insensitive search
* edit record when found
* format cell phone number to standard representation
# Arrays in `bash`
TODO
## Python ## Python

View File

@ -0,0 +1,35 @@
# Encapsulation preface
TODO - outline users permissions
# `chroot`
TODO - ultra basic chroot creation
## With a custom script
# `debootstrap`
TODO - practical root build
# Using `chroot` to fix a system
## `schroot`
# `systemd-nspawn`
## Foreign images
## Creating your own images with `debos`
# links
* [hub](https://hub.nspawn.org/images/)
* [tutorial](https://blog.selectel.com/systemd-containers-introduction-systemd-nspawn/)
* [docker nspawn](https://seanmcgary.com/posts/run-docker-containers-with-systemd-nspawn)
* [debian](https://wiki.debian.org/nspawn)
* [arch](https://wiki.archlinux.org/title/systemd-nspawn#Use_a_%22macvlan%22_or_%22ipvlan%22_interface)
* [systemd-sysext](https://0pointer.net/blog/testing-my-system-code-in-usr-without-modifying-usr.html)
* [schroot](https://wiki.debian.org/RichardDarst/Schroot)

View File

@ -0,0 +1,412 @@
# Processes and management in Linux
## Foreground and background
By default a process is launched in the **foreground** of a terminal.
We can observe this behavior by executing a simple `ls -la` command in our home.
It writes it's result to **STDOUT** and gives us back a terminal when the command completes.
```
➜ ~ ls -la
total 184
drwxr-xr-x 8 waldek waldek 4096 Jul 5 08:15 .
drwxr-xr-x 6 root root 4096 Jun 3 12:41 ..
-rw------- 1 waldek waldek 291 Mar 4 13:10 .bash_history
-rw-r--r-- 1 waldek waldek 220 Mar 4 13:05 .bash_logout
-rw-r--r-- 1 waldek waldek 3526 Mar 4 13:05 .bashrc
drwx------ 4 waldek waldek 4096 May 13 15:14 .config
drwx------ 2 waldek waldek 4096 Jul 4 19:05 .elinks
drwx------ 3 waldek waldek 4096 Mar 4 13:06 .gnupg
drwxr-xr-x 12 waldek waldek 4096 May 3 20:06 .oh-my-zsh
drwxr-x--- 2 waldek waldek 4096 Jul 4 09:25 ovpns
-rw-r--r-- 1 waldek waldek 807 Mar 4 13:05 .profile
-rw------- 1 waldek waldek 0 Mar 18 22:32 .python_history
-rw-r--r-- 1 waldek waldek 10 Mar 4 13:08 .shell.pre-oh-my-zsh
drwxr-xr-x 2 waldek waldek 4096 Jul 1 12:37 .ssh
-rw------- 1 waldek waldek 15035 Jul 1 12:37 .viminfo
-rw-r--r-- 1 waldek waldek 277 Mar 25 12:26 .wget-hsts
-rw-r--r-- 1 waldek waldek 49005 Jun 29 11:42 .zcompdump-vps-42975ad1-5.7.1
-rw------- 1 waldek waldek 60990 Jul 5 08:15 .zsh_history
-rw-r--r-- 1 waldek waldek 3689 Mar 4 13:08 .zshrc
➜ ~
```
This is probably very obvious behaviour by now but now consider the following command `sleep 10`.
This command just **sleeps** for 10 seconds and returns our prompt after.
We use `sleep` to simulate a long running process such as a heavy calculation, think password cracking, or a server of some sort.
We can use **bash syntax** or **signals** to manipulate running processes.
## Jobs
In a new shell execute the `jobs` command.
It will probably return nothing because you don't have any jobs running.
So how can we create jobs?
As mentioned before, we can do it with **bash syntax** or **signals**.
Let's do it with syntax first.
### Bash syntax
If we add a `&` at the end of a command `bash` will send it to the background.
Execute `sleep 10 &` and observe the output.
```
➜ ~ sleep 10 &
[1] 996
➜ ~
```
The sleep command is executed, and running in the background.
We immediately gain control of our terminal again to perform more tasks but after 10 seconds we get the following output indicating our job is done.
```
➜ ~ sleep 10 &
[1] 996
➜ ~
[1] + 996 done sleep 10
➜ ~
```
We can have multiple jobs running at the same time and can inspect them with the `jobs` command.
Try the following in a shell `sleep 5 & sleep 10 & sleep 20 & sleep 30 & sleep 50 &`.
You gain immediate control of the terminal but a list of *background tasks* is displayed first.
```
➜ ~ sleep 5 & sleep 10 & sleep 20 & sleep 30 & sleep 50 &
[1] 1057
[2] 1058
[3] 1059
[4] 1060
[5] 1061
➜ ~ jobs
[1] running sleep 5
[2] running sleep 10
[3] running sleep 20
[4] - running sleep 30
[5] + running sleep 50
➜ ~
[1] 1057 done sleep 5
➜ ~
[2] 1058 done sleep 10
➜ ~
[3] 1059 done sleep 20
➜ ~
[4] - 1060 done sleep 30
➜ ~
[5] + 1061 done sleep 50
➜ ~ jobs
➜ ~
```
Indeed, that's a lot of numbers on your screen.
The numbers between `[]` are the **job ID** numbers and the four digit ones are the **process ID** numbers, or **PID**.
When using the `jobs` command you can sue the job ID to reference a particular job.
For example, run `sleep 30 & sleep 60 & sleep 90 &` and observe the output.
Next run the `jobs` command and not the more verbose output.
All three jobs are **running** and will terminate one by one.
We can bring back a process to the foreground, so we can interact with it from **STDIN**, by running the `fg` command.
If we only have one process running it will bring back this single process but you can choose which one to bring to the foreground by specifying the job ID as such `fg %2` or `fg %3`.
**Can you tell me what the `+` and `-` mean in the jobs list?**
Now, how can we gain control of our terminal again?
Observe the following output:
```
➜ ~ sleep 30 & sleep 60 & sleep 90 &
[1] 13207
[2] 13208
[3] 13209
➜ ~ fg %3
[3] - 13209 running sleep 90
^Z
[3] + 13209 suspended sleep 90
➜ ~ jobs
[1] running sleep 30
[2] - running sleep 60
[3] + suspended sleep 90
➜ ~
```
First we create three jobs that are sent to the background.
Next we bring job ID number 3 back to the foreground.
We send the **suspend** signal to this job by pressing CTRL-Z.
Note the output from `jobs` which now notes two running jobs and one suspended.
This brings us to **signals**.
### Signals
We use signals all the time without realizing it.
The most common signal we have used is the **SIGINT** that we send when pressing **CTRL-C** on a running process.
A second one most of you know by know is CTRL-Z to suspend a running job.
To see all key combination and their signals we can run the `stty -a` command.
```
speed 38400 baud; rows 30; columns 122; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q;
stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke -flusho -extproc
```
We can also send signals with the `kill` command.
Contrary to `jobs`, `kill` uses the **PID** numbers to reference running processes.
The PID of a process is shown when you launch it, or you can inspect the PID of all your jobs by executing `jobs -l`.
To demonstrate how to send signals I advise you to run a few long running sleep commands as follows: `sleep 32234 & sleep 324234 & sleep 72552 & sleep 453445 & sleep 96986996 &`
You can now send signals to these processes with the following syntax `kill -$signal_to_send $PID` where `$signal_to_send` is the signal and `$PID` is the process ID.
For example:
```
➜ ~ sleep 32234 & sleep 324234 & sleep 72552 & sleep 453445 & sleep 96986996 &
[1] 13477
[2] 13478
[3] 13479
[4] 13480
[5] 13481
➜ ~ jobs
[1] running sleep 32234
[2] running sleep 324234
[3] running sleep 72552
[4] - running sleep 453445
[5] + running sleep 96986996
➜ ~ jobs -l
[1] 13477 running sleep 32234
[2] 13478 running sleep 324234
[3] 13479 running sleep 72552
[4] - 13480 running sleep 453445
[5] + 13481 running sleep 96986996
➜ ~ kill -STOP 13479
[3] + 13479 suspended (signal) sleep 72552
➜ ~ jobs -l
[1] 13477 running sleep 32234
[2] 13478 running sleep 324234
[3] + 13479 suspended (signal) sleep 72552
[4] 13480 running sleep 453445
[5] - 13481 running sleep 96986996
➜ ~
```
Analyse the output above step by step to make sense of it.
All of this might seem to complicated but there are some handy features of the shell to help us.
First, to get a list of available signals just type `kill -l` and it will output them to STDOUT.
Secondly, `kill` does **autocomplete** on both **signals** and on the **PID**.
Thirdly, you can specify **multiple PID's** to the `kill` command.
You can use `htop` as well to send signals!
Have a try at this with the same long list of sleep command and not the behavior of the processes.
By stopping and continuing a process you can probably explain me what the `S` column means now no?
## Disown
Up until now all of the commands and examples should work in both `bash` and `zsh`.
To test the following command I advise you to take a `bash` shell because it's [posix](https://en.wikipedia.org/wiki/POSIX) compliant.
When a process starts it's always the **child** of a **parent** process.
You can investigate who is a process's parent with `htop` in the *tree* mode.
An other handy tool is `ps` which reports a snapshot of the current processes.
Let's give `ps` a go.
If you run `ps` in a new shell you should get output similar to codeblock below which shows all running jobs in the current shell.
```
➜ ~ ps
PID TTY TIME CMD
13510 pts/0 00:00:00 zsh
14154 pts/0 00:00:00 ps
➜ ~
```
If I add a few background jobs the output becomes as follows:
```
➜ ~ sleep 32234 & sleep 324234 & sleep 72552 & sleep 453445 & sleep 96986996 &
[1] 14164
[2] 14165
[3] 14166
[4] 14167
[5] 14168
➜ ~ ps
PID TTY TIME CMD
13510 pts/0 00:00:00 zsh
14164 pts/0 00:00:00 sleep
14165 pts/0 00:00:00 sleep
14166 pts/0 00:00:00 sleep
14167 pts/0 00:00:00 sleep
14168 pts/0 00:00:00 sleep
14171 pts/0 00:00:00 ps
➜ ~
```
The information above is already quite interesting but we can add or remove columns to the output by using the `o` argument as follows.
Note that each process has a **unique** PID but they all share the same PPID (parent process ID).
Or do they?
Why does the first line, in my case `zsh` have a different PPID?
```
➜ ~ ps o pid,ppid,cmd
PID PPID CMD
13510 13509 -zsh
14164 13510 sleep 32234
14165 13510 sleep 324234
14166 13510 sleep 72552
14167 13510 sleep 453445
14168 13510 sleep 96986996
14199 13510 ps o pid,ppid,cmd
➜ ~
```
The list of available columns can be found in the `man ps` pages in the **STANDARD FORMAT SPECIFIERS** section (around line 500).
We can specify a specific process with the `-p $PID` argument.
```
➜ ~ ps o pid,ppid,cmd
PID PPID CMD
14466 14465 -zsh
14640 14466 tmux
14643 14642 -zsh
14681 14643 ps o pid,ppid,cmd
➜ ~ ps o pid,ppid,cmd -p 14643
PID PPID CMD
14643 14642 -zsh
➜ ~
```
Now in this shell I can start a few specific background jobs, simulated with `sleep`.
```
➜ ~ sleep 1111 & sleep 2222 & sleep 3333 &
[1] 14697
[2] 14698
[3] 14699
➜ ~ ps o pid,ppid,cmd
PID PPID CMD
14466 14465 -zsh
14640 14466 tmux
14643 14642 -zsh
14697 14643 sleep 1111
14698 14643 sleep 2222
14699 14643 sleep 3333
14702 14643 ps o pid,ppid,cmd
➜ ~
```
If I now `disown` a specific job ID, or all with the `-a` flag the processes will not be dependent on the parent's existance.
A quick `ps o pid,ppid,cmd` will still show the PPID as parent *but* when you close the parent shell and inspect the specific PID of the disowned process you'll see it's now owned by a *different* parent.
I know it sounds complicated but I urge you to test this all out in a few shells.
The practice will explain it a lot better than some codeblocks.
```
➜ ~ ps o pid,ppid,cmd -p 14698
PID PPID CMD
14698 1 sleep 2222
➜ ~
```
Now why is the process only changing parent once the original parent terminates?
I'm asking you to look for an answer online but the solution can be found the realm of *signals*, especially the *hang up* [signal](https://en.wikipedia.org/wiki/SIGHUP).
## Nohup
TODO
## Zombie processes
Yes, there are such things as zombie processes.
Learning how to create them is a bit out of our scope but I highly advise you to read up a bit on [what](https://en.wikipedia.org/wiki/Zombie_process) they are and [how](https://www.howtogeek.com/701971/how-to-kill-zombie-processes-on-linux/) to deal with them.
## Process priorities
Life is all about setting priorities and while Linux is very good at managing it's CPU time all by itself, sometimes we know better.
We've seen the priorities before in `htop` in the `NI` column but we can view them as well via `ps o nice`.
A more detailed command would be `ps o nice,pid,ppid,args` which for my laptop returns the following:
```
➜ ~ git:(master) ✗ ps o nice,pid,args
NI PID COMMAND
0 2220 zsh
0 2283 -zsh
0 2323 /bin/sh /usr/bin/startx
0 2345 xinit /etc/X11/xinit/xinitrc -- /etc/X11/xinit/xserverrc :0 vt1 -keeptty -auth /tmp/serverauth.8jVsAiU2KQ
0 2346 /usr/lib/xorg/Xorg -nolisten tcp :0 vt1 -keeptty -auth /tmp/serverauth.8jVsAiU2KQ
0 2354 x-window-manager -a --restart /run/user/1000/i3/restart-state.2354
0 5848 zsh
0 8365 zsh
0 9036 zsh
0 9065 newsboat
0 10478 ssh waldek@86thumbs.net
0 13113 vim learning_processes.md
0 13860 ps o nice,pid,args
0 28084 zsh
➜ ~ git:(master) ✗
```
All my processes are neutral on a scale from *nice* to *not-very-nice*.
You can tell because they are at `0`.
The **nice** scale goes from `-20` being not-at-all-nice to `20` being super friendly towards other processes.
The nicer a process the less aggressive it will be when demanding CPU time.
The formula for the **priority** is PR=20+NI where NI is a value between -20 and 19.
### Nice
Depending on your system a new process will get a specific nice value.
On my Debian laptop by default processes get `5` as nice value.
We can inspect this as follows where the `ping` command is the new process:
```
➜ ~ git:(master) ✗ ping 8.8.8.8 > /dev/null &
[1] 15428
➜ ~ git:(master) ✗ ps o nice,pid,args -p 15428
NI PID COMMAND
5 15428 ping 8.8.8.8
➜ ~ git:(master) ✗
```
Let's be nice to start with and set the process to be not aggressive at all.
You can launch a command with a specific nice value by prepending `nice -n 15` before the command.
The value you set will be **added** to the default value as seen below (but tops out at 19 and -19).
```
➜ ~ git:(master) ✗ nice -n 15 ping 8.8.8.8 > /dev/null &
[1] 15632
➜ ~ git:(master) ✗ ps o nice,pid,args -p 15632
NI PID COMMAND
19 15632 ping 8.8.8.8
➜ ~ git:(master) ✗
```
Now what about *aggressive* processes?
I would like you to try and set a very *not-nice* value for a `ping` or `sleep` process?
You can probably guess but it won't work.
Why do you think this is?
### Renice
Nice values are not that practical if we need to set them before we start a process no?
That's where the `renice` program comes into play.
It allows us to change the nice value of a running process with a very simple syntax.
I would advise you to use `sudo` when changing the nice values because otherwise you'll constantly run into either `operation not permitted` or `permission denied` errors.
```
➜ ~ git:(master) ✗ ping 8.8.8.8 > /dev/null &
[1] 16877
➜ ~ git:(master) ✗ ps o nice,pid,args -p 16877
NI PID COMMAND
5 16877 ping 8.8.8.8
➜ ~ git:(master) ✗ sudo renice -n 20 -p 16877
16877 (process ID) old priority 5, new priority 19
➜ ~ git:(master) ✗
```
## /proc virtual filesystem
TODO
## Exercises
To help you understand what happens to running and stopped processes I made a few python scripts you can download below.
Run them either with `python3 $SCRIPT_NAME` or `./$SCRIPT_NAME`.
* [simple timer](../assets/processes_ex_01.py)
* [timer with random keyboard prompt](../assets/processes_ex_02.py)
* [custom callback function for SIGALRM](../assets/processes_ex_03.py)

572
advanced/learning_shells.md Normal file
View File

@ -0,0 +1,572 @@
# `bash` login
What happens when we log into a server or when we open up a terminal with `bash` running in it?
As always the manual can tell us quite a bit.
Quite often you'll find a list of configuration files used by a program near the end of the manual.
Sometimes not, your millage may vary but here is the files section of the `bash` manual.
If you can't find a list of files the program you want to investigate searches for, there are other ways of digging deep into what a program is *doing* but that is for a later date.
```
FILES
/bin/bash
The bash executable
/etc/profile
The systemwide initialization file, executed for login shells
/etc/bash.bashrc
The systemwide per-interactive-shell startup file
/etc/bash.bash.logout
The systemwide login shell cleanup file, executed when a login shell exits
~/.bash_profile
The personal initialization file, executed for login shells
~/.bashrc
The individual per-interactive-shell startup file
~/.bash_logout
The individual login shell cleanup file, executed when a login shell exits
~/.inputrc
Individual readline initialization file
```
I created a minimal container to play around a bit.
This is what I have in my home directory.
```
waldek@tester:~$ ls -la
total 24
drwxr-xr-x 2 waldek waldek 4096 Jun 15 15:49 .
drwxr-xr-x 3 root root 4096 Jun 15 15:47 ..
-rw------- 1 waldek waldek 39 Jun 15 15:50 .bash_history
-rw-r--r-- 1 waldek waldek 220 Jun 15 15:47 .bash_logout
-rw-r--r-- 1 waldek waldek 3526 Jun 15 15:47 .bashrc
-rw-r--r-- 1 waldek waldek 807 Jun 15 15:47 .profile
waldek@tester:~$
```
Let's have a look at them one by one.
First the `.bash_history`.
This contains a history of all the commands I ran on this computer!
The arrow keys navigate his file when you search through your history.
Quite handy for when we forget how to do something but we know we've done it before.
You can use `grep` to search the file but there is also a shortcut you can use, `ctrl-r`.
```
waldek@tester:~$ cat .bash_history
vim .profile
su
ls -la
exit
su
logout
waldek@tester:~$
```
Next up is `.bash_logout`.
It's purpose is written in the comment on the first line!
This file gets executed when a login shell exits.
Is there a difference between a *shell* and a *login shell*?
I'll let you ponder this a bit and we'll come back to this later.
```
waldek@tester:~$ cat .bash_logout
# ~/.bash_logout: executed by bash(1) when login shell exits.
# when leaving the console clear the screen to increase privacy
if [ "$SHLVL" = 1 ]; then
[ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q
fi
waldek@tester:~$
```
Now the `.bashrc` file.
I know it's a pretty long file so I'll just show the `head`.
```
waldek@tester:~$ head .bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
waldek@tester:~$
```
Aha!
The comment on the first line mentions *non-login shells* so there must be a difference!
This is a very important configuration file and I urge you to read it, especially the comments.
Notice how the length of your history file is set in here?
What kind of content is in this file?
Last but not least `.profile`.
```
waldek@tester:~$ cat .profile
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
fi
waldek@tester:~$
```
## which files are sources when
So, we have different files that are sourced at different times.
Let's try to play around a bit.
I added some comments to them so we get a clear idea which are sourced when.
```
waldek@tester:~$ tail -n 1 .bashrc .profile .bash_logout
==> .bashrc <==
echo I am .bachrc
==> .profile <==
echo I am .profile
==> .bash_logout <==
echo I am .bash_logout
waldek@tester:~$
```
When I log in on a tty I get the following output.
This is an actual interactive login so we source both `.bashrc` and `.profile`.
You might ask yourself where the *other* output comes from.
That's up to you to find out!
```
Debian GNU/Linux 11 tester pts/1
tester login: waldek
Password:
Linux tester 5.10.0-15-amd64 #1 SMP Debian 5.10.120-1 (2022-06-09) x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Wed Jun 15 16:03:17 CEST 2022 on pts/1
I am .bachrc
I am .profile
waldek@tester:~$
```
What if we `su` to ourselves?
```
waldek@tester:~$ su waldek
Password:
I am .bachrc
waldek@tester:~$
```
The `.profile` is not sourced!
We can however change the behaviour of `su` with arguments.
A quick look at the `man su` tells us that.
```
-, -l, --login
Start the shell as a login shell with an environment similar to a real login:
o clears all the environment variables except TERM and variables specified by --whitelist-environment
o initializes the environment variables HOME, SHELL, USER, LOGNAME, and PATH
o changes to the target user's home directory
o sets argv[0] of the shell to '-' in order to make the shell a login shell
```
So we can do the following.
```
waldek@tester:~$ su - waldek
Password:
I am .bachrc
I am .profile
waldek@tester:~$
```
If we `exit` this session we get the following.
```
waldek@tester:~$ exit
logout
I am .bash_logout
waldek@tester:~$
```
Ah, there is out `.bash_logout` message!
And if we exit the tty session we get this.
```
waldek@tester:~$ exit
logout
I am .bash_logout
Debian GNU/Linux 11 tester pts/1
tester login:
```
When we launch a bash in a bash we get the following.
But when we launch a script, none of our files get sourced!
```
waldek@tester:~$ bash
I am .bachrc
waldek@tester:~$ exit
exit
waldek@tester:~$ bash script.sh
I'm a script
waldek@tester:~$
```
What about `ssh` connections?
I'm running the server on port 2222 because it's a container with host networking.
It's a bit too early to go into too much detail but by then end of the course you'll fully understand what's happening!
```
waldek@tester:~$ ssh localhost -p 2222
waldek@localhost's password:
Linux tester 5.10.0-15-amd64 #1 SMP Debian 5.10.120-1 (2022-06-09) x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Wed Jun 15 16:29:26 2022 from ::1
I am .bachrc
I am .profile
waldek@tester:~$ exit
logout
I am .bash_logout
Connection to localhost closed.
waldek@tester:~$
```
What if we run a command over `ssh`?
Then none of these files are sourced!
```
waldek@tester:~$ ssh localhost -p 2222 ls -la
waldek@localhost's password:
total 36
drwxr-xr-x 3 waldek waldek 4096 Jun 15 16:29 .
drwxr-xr-x 3 root root 4096 Jun 15 15:47 ..
-rw------- 1 waldek waldek 649 Jun 15 16:27 .bash_history
-rw-r--r-- 1 waldek waldek 243 Jun 15 16:19 .bash_logout
-rw-r--r-- 1 waldek waldek 3545 Jun 15 16:20 .bashrc
-rw-r--r-- 1 waldek waldek 826 Jun 15 16:17 .profile
drwx------ 2 waldek waldek 4096 Jun 15 16:29 .ssh
-rw------- 1 waldek waldek 3141 Jun 15 16:20 .viminfo
-rw-r--r-- 1 waldek waldek 34 Jun 15 16:18 script.sh
waldek@tester:~$
```
# A clean slate
I deleted all the content of our three files.
```
waldek@tester:~$ cat .bashrc .bash_logout .profile
waldek@tester:~$
```
We don't see any big differences but our shell is *less* powerful.
For example, autocomplete does not work anymore on things like `systemctl` or `apt`.
We now have a `bash` shell that has only sourced actual content from the following files.
* `/etc/profile`
* `/etc/bash.bashrc`
* `/etc/bash.bash.logout` if it exists
As these are system files we can only edit them as `root` or via `sudo`.
I went a head and added a comment `#` in front of every line.
When I now log in on a tty I get the following.
```
Debian GNU/Linux 11 tester pts/1
tester login: waldek
Password:
Linux tester 5.10.0-15-amd64 #1 SMP Debian 5.10.120-1 (2022-06-09) x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Wed Jun 15 16:44:05 CEST 2022 on pts/1
-bash-5.1$
```
This is a fully barebones `bash` shell, no bells and whistles at all.
You can see our prompt has changed to a super simple one, no more username nor hostname nor path.
Tab complete works, but only for programs and paths, not for arguments.
# Prompt customization
Form this basic session we can learn quite a bit.
The most obvious change is our prompt.
The fact that it changed means we can modify it too!
Let's discover how.
From the manual we can conclude that `$PSX` are the variables that hold the prompt.
```
PS0 The value of this parameter is expanded (see PROMPTING below) and displayed by interactive shells after reading a command and before
the command is executed.
PS1 The value of this parameter is expanded (see PROMPTING below) and used as the primary prompt string. The default value is ``\s-\v\$
''.
PS2 The value of this parameter is expanded as with PS1 and used as the secondary prompt string. The default is ``> ''.
PS3 The value of this parameter is used as the prompt for the select command (see SHELL GRAMMAR above).
PS4 The value of this parameter is expanded as with PS1 and the value is printed before each command bash displays during an execution
trace. The first character of the expanded value of PS4 is replicated multiple times, as necessary, to indicate multiple levels of
indirection. The default is ``+ ''.
```
```
-bash-5.1$ echo $PS
$PS1 $PS2 $PS4
-bash-5.1$ echo $PS1
\s-\v\$
-bash-5.1$
```
Your prompt is defined by the `$PS1` variable.
By setting this we can change it's behaviour.
```
-bash-5.1$ PS1="helloworld"
helloworldls
script.sh
helloworldcd /
helloworldls
bin boot dev etc home lib lib32 lib64 libx32 media mnt opt proc root run sbin srv sys tmp usr var
helloworld
```
This is *far* from useful but it's just to prove a point.
Let's try to get our username back.
Again, by reading the manual we can see all variables we can use in a prompt.
I include the **PROMPTING** section for completeness.
```
PROMPTING
When executing interactively, bash displays the primary prompt PS1 when it is ready to read a command, and the secondary prompt PS2 when it
needs more input to complete a command. Bash displays PS0 after it reads a command but before executing it. Bash displays PS4 as described
above before tracing each command when the -x option is enabled. Bash allows these prompt strings to be customized by inserting a number of
backslash-escaped special characters that are decoded as follows:
\a an ASCII bell character (07)
\d the date in "Weekday Month Date" format (e.g., "Tue May 26")
\D{format}
the format is passed to strftime(3) and the result is inserted into the prompt string; an empty format results in a locale-
specific time representation. The braces are required
\e an ASCII escape character (033)
\h the hostname up to the first `.'
\H the hostname
\j the number of jobs currently managed by the shell
\l the basename of the shell's terminal device name
\n newline
\r carriage return
\s the name of the shell, the basename of $0 (the portion following the final slash)
\t the current time in 24-hour HH:MM:SS format
\T the current time in 12-hour HH:MM:SS format
\@ the current time in 12-hour am/pm format
\A the current time in 24-hour HH:MM format
\u the username of the current user
\v the version of bash (e.g., 2.00)
\V the release of bash, version + patch level (e.g., 2.00.0)
\w the current working directory, with $HOME abbreviated with a tilde (uses the value of the PROMPT_DIRTRIM variable)
\W the basename of the current working directory, with $HOME abbreviated with a tilde
\! the history number of this command
\# the command number of this command
\$ if the effective UID is 0, a #, otherwise a $
\nnn the character corresponding to the octal number nnn
\\ a backslash
\[ begin a sequence of non-printing characters, which could be used to embed a terminal control sequence into the prompt
\] end a sequence of non-printing characters
The command number and the history number are usually different: the history number of a command is its position in the history list, which
may include commands restored from the history file (see HISTORY below), while the command number is the position in the sequence of com
mands executed during the current shell session. After the string is decoded, it is expanded via parameter expansion, command substitution
or contain characters special to word expansion.
```
So, to get our username back we need the `\u` variable.
```
helloworldPS1="\u"
waldekls
bin boot dev etc home lib lib32 lib64 libx32 media mnt opt proc root run sbin srv sys tmp usr var
waldek
```
That *glue* between our username and command is rather annoying, let's modify that a bit.
```
waldekPS1="\u -> "
waldek -> ls
bin boot dev etc home lib lib32 lib64 libx32 media mnt opt proc root run sbin srv sys tmp usr var
waldek ->
```
Ah, much better!
Now, what time is it?
```
waldek -> PS1="\u \t -> "
waldek 17:02:53 -> ls
bin boot dev etc home lib lib32 lib64 libx32 media mnt opt proc root run sbin srv sys tmp usr var
waldek 17:02:56 ->
```
And where am I?
```
waldek@tester 17:04:10 -> PS1="\u@\H \t -> "
waldek@tester 17:04:19 -> ls
bin boot dev etc home lib lib32 lib64 libx32 media mnt opt proc root run sbin srv sys tmp usr var
waldek@tester 17:04:20 ->
```
And in which directory?
```
waldek@tester 17:04:20 -> PS1="\u@\H:\w \t -> "
waldek@tester:/ 17:05:06 -> cd /var/log/
waldek@tester:/var/log 17:05:13 ->
```
What about the *other* `$PS` variables?
Well, if we want to know the exact time when we launch a command we can modify the `$PS0` variable.
```
waldek@tester:/var/log -> PS0="it is \t \n"
waldek@tester:/var/log -> ls
it is 17:06:48
alternatives.log auth.log btmp dpkg.log journal messages runit user.log
apt bootstrap.log daemon.log faillog lastlog private syslog wtmp
waldek@tester:/var/log -> cd
it is 17:06:58
waldek@tester:~ ->
```
## Saving our changes
When you exit your shell, and log back in, you'll notice the prompt is back to normal.
If we want to *save* the one we have we need to place it in one of the files that get *sourced* when our session starts.
I would recommend you make your changes to the `.bashrc` file and have a `.profile` that sources the `.bashrc` if we run an interactive `bash` shell.
You can find some interesting notes [here](https://superuser.com/questions/789448/choosing-between-bashrc-profile-bash-profile-etc).
So let's get started!
```
waldek@tester:~ -> tail -n +1 .profile .bashrc # a nice trick to show file content with header ;)
==> .profile <==
if [ "$BASH" ]; then
. ~/.bashrc
fi
==> .bashrc <==
PS1="\u@\H:\w -> "
echo "sourced"
waldek@tester:~ ->
```
I'm writing this documentation on a laptop so it would be nice to see my battery status on the command line.
By now you probably guessed it, but the sourced files are scripts so we can use every trick we've learned during our `bash` scripting classes.
I'll make a function that prints the status of the battery and will include this function in the prompt.
```bash
function get_battery_status () {
status=$(cat /sys/class/power_supply/BAT0/status)
echo -e $status # -e for no newline
}
PS1="\u@\H:\w [\$(get_battery_status)] -> " # need to escape the $ sign or use single quotes!
#PS1='\u@\H:\w [$(get_battery_status)] -> ' # this would work as well.. ah, bash...
echo "sourced"
```
## Decoding the *base* prompt
On a modern install your `$PS1` will probably be as one of the two below.
They are actually the *same*, just one has **colors** in it, the other one not!
Customizing colors of a prompt is a bit of a nightmare but well worth the exercise!
* `PS1='\u@\h:\w\$ '`
* `PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '']]]]'`
# Alternative shells
TODO
## `zsh`
TODO
## `fish`
TODO
## `xonsh`
TODO
# Shell completion
TODO
# Frameworks
TODO
## oh my zsh
TODO
## oh my bash
TODO
# `xxh`
TODO

1053
advanced/learning_systemd.md Normal file

File diff suppressed because it is too large Load Diff

38
advanced/outline.md Normal file
View File

@ -0,0 +1,38 @@
* learning_vim_configuration.md
* 1 day
* learning_python3.md
* 15 days
* learning_processes.md
* 1 day
* learning_disks.md
* 1 day
* DOC NOT WRITTEN
* learning_disk_management.md
* 1 day
* DOC NOT WRITTEN
* learning_systemd.md
* 2 days
* learning_udev.md
* 1 day
* learning_dbus.md
* 1 day
* TODO add busctl doc
* learning_systemd_udev_integration.md
* 1 day
* learning_systemd_udev_dbus_integration.md
* 1 day
* learning_systemd_login.md
* 1 day
* learning_ssh.md
* 1 day
* learning_remote_graphical_interaction.md
* 1 day
* learning_regex.md
* 1 day
* learning_centralized_system_monitoring.md
* 1 day
* TODO outline python plugin exercise
* learning_centralized_account_management.md
* 1 day
* learning_centralized_account_management_freeipa.md
* 1 day

5000
assets/broken_ip.list Normal file

File diff suppressed because it is too large Load Diff

5000
assets/broken_ip_01.list Normal file

File diff suppressed because it is too large Load Diff

5000
assets/broken_ip_02.list Normal file

File diff suppressed because it is too large Load Diff

38387
assets/fail2ban.log Normal file

File diff suppressed because it is too large Load Diff

907
assets/generic-food.csv Normal file
View File

@ -0,0 +1,907 @@
FOOD NAME;SCIENTIFIC NAME;GROUP;SUB GROUP
Angelica;Angelica keiskei;Herbs and Spices;Herbs
Savoy cabbage;Brassica oleracea var. sabauda;Vegetables;Cabbages
Silver linden;Tilia argentea;Herbs and Spices;Herbs
Kiwi;Actinidia chinensis;Fruits;Tropical fruits
Allium (Onion);Allium;Vegetables;Onion-family vegetables
Garden onion;Allium cepa;Vegetables;Onion-family vegetables
Leek;Allium porrum;Vegetables;Onion-family vegetables
Garlic;Allium sativum;Herbs and Spices;Herbs
Chives;Allium schoenoprasum;Herbs and Spices;Herbs
Lemon verbena;Aloysia triphylla;Herbs and Spices;Herbs
Cashew nut;Anacardium occidentale;Nuts;Nuts
Pineapple;Ananas comosus;Fruits;Tropical fruits
Dill;Anethum graveolens;Herbs and Spices;Herbs
Custard apple;Annona reticulata;Fruits;Tropical fruits
Wild celery;Apium graveolens;Herbs and Spices;Spices
Peanut;Arachis hypogaea;Nuts;Nuts
Burdock;Arctium lappa;Vegetables;Root vegetables
Horseradish;Armoracia rusticana;Herbs and Spices;Spices
Tarragon;Artemisia dracunculus;Herbs and Spices;Herbs
Mugwort;Artemisia vulgaris;Herbs and Spices;Herbs
Asparagus;Asparagus officinalis;Vegetables;Shoot vegetables
Oat;Avena sativa;Cereals and cereal products;Cereals
Star fruit;Averrhoa carambola;Fruits;Tropical fruits
Brazil nut;Bertholletia excelsa;Nuts;Nuts
Common beet;Beta vulgaris;Vegetables;Leaf vegetables
Borage;Borago officinalis;Herbs and Spices;Oilseed crops
Chinese mustard;Brassica juncea;Vegetables;Cabbages
Swede;Brassica napus;Vegetables;Root vegetables
Rape;Brassica napus var. napus;Vegetables;Root vegetables
Common cabbage;Brassica oleracea;Vegetables;Cabbages
Cauliflower;Brassica oleracea var. botrytis;Vegetables;Cabbages
Brussel sprouts;Brassica oleracea var. gemmifera;Vegetables;Cabbages
Kohlrabi;Brassica oleracea var. gongylodes;Vegetables;Root vegetables
Broccoli;Brassica oleracea var. italica;Vegetables;Cabbages
Chinese cabbage;Brassica rapa;Vegetables;Cabbages
Turnip;Brassica rapa var. rapa;Herbs and Spices;Herbs
Pigeon pea;Cajanus cajan;Pulses;Peas
Tea;Camellia sinensis;Teas;Teas
Capers;Capparis spinosa;Herbs and Spices;Spices
Pepper (C. annuum);Capsicum annuum;Vegetables;Fruit vegetables
Papaya;Carica papaya;Fruits;Tropical fruits
Safflower;Carthamus tinctorius;Herbs and Spices;Oilseed crops
Caraway;Carum carvi;Herbs and Spices;Spices
Pecan nut;Carya illinoinensis;Nuts;Nuts
Chestnut;Castanea;Nuts;Nuts
Roman camomile;Chamaemelum nobile;Herbs and Spices;Herbs
Chickpea;Cicer arietinum;Pulses;Peas
Endive;Cichorium endivia;Vegetables;Leaf vegetables
Chicory;Cichorium intybus;Vegetables;Root vegetables
Chinese cinnamon;Cinnamomum aromaticum;Herbs and Spices;Spices
Ceylon cinnamon;Cinnamomum verum;Herbs and Spices;Spices
Watermelon;Citrullus lanatus;Gourds;Gourds
Lime;Citrus aurantiifolia;Fruits;Citrus
Lemon;Citrus limon;Fruits;Citrus
Pummelo;Citrus maxima;Fruits;Citrus
Mandarin orange (Clementine, Tangerine);Citrus reticulata;Fruits;Citrus
Sweet orange;Citrus sinensis;Fruits;Citrus
Coffee;Coffea;Coffee and coffee products;Coffee
Arabica coffee;Coffea arabica;Coffee and coffee products;Coffee
Robusta coffee;Coffea canephora;Coffee and coffee products;Coffee
Coriander;Coriandrum sativum;Herbs and Spices;Herbs
Common hazelnut;Corylus avellana;Nuts;Nuts
Saffron;Crocus sativus;Herbs and Spices;Spices
Muskmelon;Cucumis melo;Gourds;Gourds
Cucumber;Cucumis sativus;Gourds;Gourds
Cucurbita (Gourd);Cucurbita;Gourds;Gourds
Cumin;Cuminum cyminum;Herbs and Spices;Spices
Turmeric;Curcuma longa;Herbs and Spices;Spices
Quince;Cydonia oblonga;Fruits;Pomes
Lemon grass;Cymbopogon citratus;Herbs and Spices;Herbs
Globe artichoke;Cynara scolymus;Vegetables;Shoot vegetables
Wild carrot;Daucus carota;Vegetables;Root vegetables
Japanese persimmon;Diospyros kaki;Fruits;Tropical fruits
Cardamom;Elettaria cardamomum;Herbs and Spices;Spices
Black crowberry;Empetrum nigrum;Fruits;Berries
Loquat;Eriobotrya japonica;Fruits;Tropical fruits
Rocket salad (ssp.);Eruca vesicaria ssp. sativa;Vegetables;Leaf vegetables
Wax apple;Eugenia;Fruits;Tropical fruits
Common buckwheat;Fagopyrum esculentum;Cereals and cereal products;Cereals
Tartary buckwheat;Fagopyrum tataricum;Cereals and cereal products;Cereals
Fig;Ficus carica;Fruits;Other fruits
Fennel;Foeniculum vulgare;Herbs and Spices;Herbs
Strawberry;Fragaria X ananassa;Fruits;Berries
Black huckleberry;Gaylussacia baccata;Fruits;Berries
Soy bean;Glycine max;Soy;Soy
Sunflower;Helianthus annuus;Herbs and Spices;Oilseed crops
Sea-buckthornberry;Hippophae rhamnoides;Fruits;Berries
Barley;Hordeum vulgare;Cereals and cereal products;Cereals
Hyssop;Hyssopus officinalis;Herbs and Spices;Herbs
Star anise;Illicium verum;Herbs and Spices;Spices
Swamp cabbage;Ipomoea aquatica;Vegetables;Leaf vegetables
Sweet potato;Ipomoea batatas;Vegetables;Tubers
Black walnut;Juglans nigra;Nuts;Nuts
Common walnut;Juglans regia;Nuts;Nuts
Lettuce;Lactuca sativa;Vegetables;Leaf vegetables
Grass pea;Lathyrus sativus;Pulses;Peas
Sweet bay;Laurus nobilis;Herbs and Spices;Herbs
Lentils;Lens culinaris;Pulses;Lentils
Garden cress;Lepidium sativum;Vegetables;Leaf vegetables
Lovage;Levisticum officinale;Herbs and Spices;Herbs
Flaxseed;Linum usitatissimum;Herbs and Spices;Oilseed crops
Mexican oregano;Lippia graveolens;Herbs and Spices;Herbs
Lichee;Litchi chinensis;Fruits;Tropical fruits
Lupine;Lupinus;Pulses;Other pulses
Apple;Malus pumila;Fruits;Pomes
Mango;Mangifera indica;Fruits;Tropical fruits
German camomile;Matricaria recutita;Herbs and Spices;Herbs
Lemon balm;Melissa officinalis;Herbs and Spices;Herbs
Mentha (Mint);Mentha;Herbs and Spices;Herbs
Orange mint;Mentha aquatica;Herbs and Spices;Herbs
Cornmint;Mentha arvensis;Herbs and Spices;Herbs
Spearmint;Mentha spicata;Herbs and Spices;Herbs
Peppermint;Mentha X piperita;Herbs and Spices;Herbs
Medlar;Mespilus germanica;Fruits;Pomes
Bitter gourd;Momordica charantia;Gourds;Gourds
Mulberry;Morus;Fruits;Berries
Black mulberry;Morus nigra;Fruits;Berries
Nutmeg;Myristica fragrans;Herbs and Spices;Spices
Sweet basil;Ocimum basilicum;Herbs and Spices;Herbs
Evening primrose;Oenothera biennis;Herbs and Spices;Oilseed crops
Olive;Olea europaea;Vegetables;Fruit vegetables
Sweet marjoram;Origanum majorana;Herbs and Spices;Herbs
Pot marjoram;Origanum onites;Herbs and Spices;Herbs
Common oregano;Origanum vulgare;Herbs and Spices;Herbs
Rice;Oryza sativa;Cereals and cereal products;Cereals
Millet;Panicum miliaceum;Cereals and cereal products;Cereals
Poppy;Papaver;Herbs and Spices;Oilseed crops
Passion fruit;Passiflora edulis;Fruits;Tropical fruits
Parsnip;Pastinaca sativa;Vegetables;Root vegetables
Avocado;Persea americana;Vegetables;Fruit vegetables
Parsley;Petroselinum crispum;Herbs and Spices;Herbs
Scarlet bean;Phaseolus coccineus;Pulses;Beans
Lima bean;Phaseolus lunatus;Pulses;Beans
Common bean;Phaseolus vulgaris;Pulses;Beans
Date;Phoenix dactylifera;Fruits;Other fruits
Black chokeberry;Photinia melanocarpa;Fruits;Berries
Anise;Pimpinella anisum;Herbs and Spices;Herbs
Pine nut;Pinus;Nuts;Nuts
Pepper (Spice);Piper nigrum;Herbs and Spices;Spices
Pistachio;Pistacia vera;Nuts;Nuts
Common pea;Pisum sativum;Pulses;Peas
Purslane;Portulaca oleracea;Herbs and Spices;Herbs
Prunus (Cherry, Plum);Prunus;Fruits;Drupes
Apricot;Prunus armeniaca;Fruits;Drupes
Sweet cherry;Prunus avium;Fruits;Drupes
Sour cherry;Prunus cerasus;Fruits;Drupes
European plum;Prunus domestica;Fruits;Drupes
Almond;Prunus dulcis;Nuts;Nuts
Peach;Prunus persica;Fruits;Drupes
Guava;Psidium guajava;Fruits;Tropical fruits
Pomegranate;Punica granatum;Fruits;Tropical fruits
Pear;Pyrus communis;Fruits;Pomes
Radish;Raphanus sativus;Vegetables;Root vegetables
Garden rhubarb;Rheum rhabarbarum;Vegetables;Stalk vegetables
Blackcurrant;Ribes nigrum;Fruits;Berries
Redcurrant;Ribes rubrum;Fruits;Berries
Gooseberry;Ribes uva-crispa;Fruits;Berries
Watercress;Rorippa nasturtium-aquaticum;Herbs and Spices;Herbs
Rosemary;Rosmarinus officinalis;Herbs and Spices;Herbs
Rubus (Blackberry, Raspberry);Rubus;Fruits;Berries
Cloudberry;Rubus chamaemorus;Fruits;Berries
Red raspberry;Rubus idaeus;Fruits;Berries
Black raspberry;Rubus occidentalis;Fruits;Berries
Sorrel;Rumex acetosa;Herbs and Spices;Herbs
Common sage;Salvia officinalis;Herbs and Spices;Herbs
Black elderberry;Sambucus nigra;Fruits;Berries
Summer savory;Satureja hortensis;Herbs and Spices;Herbs
Winter savory;Satureja montana;Herbs and Spices;Herbs
Rye;Secale cereale;Cereals and cereal products;Cereals
Sesame;Sesamum orientale;Herbs and Spices;Oilseed crops
Garden tomato;Solanum lycopersicum;Vegetables;Fruit vegetables
Cherry tomato;Solanum lycopersicum var. cerasiforme;Vegetables;Fruit vegetables
Garden tomato (var.);Solanum lycopersicum var. lycopersicum;Vegetables;Fruit vegetables
Eggplant;Solanum melongena;Vegetables;Fruit vegetables
Potato;Solanum tuberosum;Vegetables;Tubers
Rowanberry;Sorbus aucuparia;Fruits;Berries
Sorghum;Sorghum bicolor;Cereals and cereal products;Cereals
Spinach;Spinacia oleracea;Vegetables;Leaf vegetables
Cloves;Syzygium aromaticum;Herbs and Spices;Spices
Tamarind;Tamarindus indica;Fruits;Tropical fruits
Dandelion;Taraxacum officinale;Herbs and Spices;Herbs
Cocoa bean;Theobroma cacao;Cocoa and cocoa products;Cocoa
Common thyme;Thymus vulgaris;Herbs and Spices;Herbs
Linden;Tilia;Herbs and Spices;Herbs
Small-leaf linden;Tilia cordata;Herbs and Spices;Herbs
Fenugreek;Trigonella foenum-graecum;Herbs and Spices;Herbs
Common wheat;Triticum aestivum;Cereals and cereal products;Cereals
Vaccinium (Blueberry, Cranberry, Huckleberry);Vaccinium;Fruits;Berries
Lowbush blueberry;Vaccinium angustifolium;Fruits;Berries
Sparkleberry;Vaccinium arboreum;Fruits;Berries
Highbush blueberry;Vaccinium corymbosum;Fruits;Berries
American cranberry;Vaccinium macrocarpon;Fruits;Berries
Bilberry;Vaccinium myrtillus;Fruits;Berries
Lingonberry;Vaccinium vitis-idaea;Fruits;Berries
Vanilla;Vanilla;Herbs and Spices;Spices
Common verbena;Verbena officinalis;Herbs and Spices;Herbs
Broad bean;Vicia faba;Pulses;Beans
Adzuki bean;Vigna angularis;Pulses;Beans
Gram bean;Vigna mungo;Pulses;Beans
Mung bean;Vigna radiata;Pulses;Beans
Climbing bean;Vigna umbellata;Pulses;Beans
Cowpea;Vigna unguiculata;Pulses;Peas
Muscadine grape;Vitis rotundifolia;Fruits;Berries
Common grape;Vitis vinifera;Fruits;Berries
Corn;Zea mays;Cereals and cereal products;Cereals
Ginger;Zingiber officinale;Herbs and Spices;Spices
Arctic blackberry;Rubus arcticus;Fruits;Berries
Banana;Musa acuminata;Fruits;Tropical fruits
Bayberry;Myrica;Fruits;Berries
Elliott's blueberry;Vaccinium elliottii;Fruits;Berries
Canada blueberry;Vaccinium myrtilloides;Fruits;Berries
Bog bilberry;Vaccinium uliginosum;Fruits;Berries
Buffalo currant;Ribes aureum var. villosum;Fruits;Berries
Celeriac;Apium graveolens var. rapaceum;Vegetables;Root vegetables
Celery stalks;Apium graveolens var. dulce;Vegetables;Stalk vegetables
Chinese chives;Allium tuberosum;Herbs and Spices;Herbs
European cranberry;Vaccinium oxycoccos;Fruits;Berries
Deerberry;Vaccinium stamineum;Fruits;Berries
Ginseng;Panax;Herbs and Spices;Spices
Cascade huckleberry;Vaccinium deliciosum;Fruits;Berries
Oval-leaf huckleberry;Vaccinium ovalifolium;Fruits;Berries
Evergreen huckleberry;Vaccinium ovatum;Fruits;Berries
Red huckleberry;Vaccinium parvifolium;Fruits;Berries
Longan;Dimocarpus longan;Fruits;Tropical fruits
Macadamia nut (M. tetraphylla);Macadamia tetraphylla;Nuts;Nuts
Garden onion (var.);Allium cepa var. cepa;Vegetables;Onion-family vegetables
Summer grape;Vitis aestivalis;Fruits;Berries
Fox grape;Vitis labrusca;Fruits;Berries
Nectarine;Prunus persica var. nucipersica;Fruits;Drupes
Peach (var.);Prunus persica var. persica;Fruits;Drupes
Pepper (C. baccatum);Capsicum baccatum var. baccatum;Vegetables;Fruit vegetables
Pepper (C. chinense);Capsicum chinense;Vegetables;Fruit vegetables
Pepper (Capsicum);Capsicum;Vegetables;Fruit vegetables
Rambutan;Nephelium lappaceum;Fruits;Tropical fruits
Red rice;Oryza rufipogon;Cereals and cereal products;Cereals
Annual wild rice;Zizania aquatica;Cereals and cereal products;Cereals
Swiss chard;Beta vulgaris ssp. cicla;Vegetables;Leaf vegetables
Lemon thyme;Thymus pulegioides;Herbs and Spices;Herbs
Tronchuda cabbage;Brassica oleracea var. costata;Vegetables;Cabbages
Japanese walnut;Juglans ailanthifolia;Nuts;Nuts
Welsh onion;Allium fistulosum;Herbs and Spices;Herbs
Hard wheat;Triticum durum;Cereals and cereal products;Cereals
Shallot;Allium ascalonicum;Vegetables;Onion-family vegetables
Rocket salad;Eruca vesicaria;Vegetables;Leaf vegetables
Carrot;Daucus carota ssp. sativus;Vegetables;Root vegetables
Triticale;X Triticosecale rimpaui;Cereals and cereal products;Cereals
Black cabbage;Brassica oleracea var. viridis;Vegetables;Cabbages
Half-highbush blueberry;Vaccinium angustifolium X Vaccinium corymbosum;Fruits;Berries
Celery leaves;Apium graveolens var. secalinum;Herbs and Spices;Herbs
Chicory leaves;Cichorium intybus var. foliosum;Vegetables;Leaf vegetables
Komatsuna;Brassica rapa var. perviridis;Vegetables;Cabbages
Pak choy;Brassica rapa var. chinensis;Vegetables;Cabbages
Napa cabbage;Brassica rapa var. pekinensis;Vegetables;Cabbages
Chicory roots;Cichorium intybus var. sativum;Vegetables;Root vegetables
Grapefruit/Pummelo hybrid;Citrus paradisi X Citrus maxima;Fruits;Citrus
Grapefruit;Citrus X paradisi;Fruits;Citrus
Jostaberry;Ribes × nidigrolaria;Fruits;Berries
Kai-lan;Brassica oleracea var. alboglabra;Vegetables;Cabbages
Italian oregano;Origanum X majoricum;Herbs and Spices;Herbs
Oxheart cabbage;Brassica oleracea var. conica;Vegetables;Cabbages
Daikon radish;Raphanus sativus var. longipinnatus;Vegetables;Root vegetables
Black radish;Raphanus sativus var. niger;Vegetables;Root vegetables
Radish (var.);Raphanus sativus var. sativus;Vegetables;Root vegetables
Red beetroot;Beta vulgaris var. rubra;Vegetables;Root vegetables
Sweet rowanberry;Grataegosorbus mitschurinii;Fruits;Berries
Pineappple sage;Salvia elegans;Herbs and Spices;Herbs
Skunk currant;Ribes glandulosum;Fruits;Berries
Beer;NULL;Beverages;Fermented beverages
Other bread;NULL;Cereals and cereal products;Other breads
Breakfast cereal;NULL;Cereals and cereal products;Cereal products
Other soy product;NULL;Soy;Soy products
Other cereal product;NULL;Cereals and cereal products;Cereal products
Pasta;NULL;Cereals and cereal products;Cereal products
Biscuit;NULL;Cereals and cereal products;Cereal products
Sourdough;NULL;Cereals and cereal products;Doughs
Spirit;NULL;Beverages;Distilled beverages
Fortified wine;NULL;Beverages;Fortified wines
Other alcoholic beverage;NULL;Beverages;Alcoholic beverages
Abalone;Haliotis;Aquatic foods;Mollusks
Abiyuch;Crateva religiosa;Fruits;Tropical fruits
Acerola;Malpighia emarginata;Fruits;Tropical fruits
Acorn;Quercus;Nuts;Nuts
Winter squash;Cucurbita maxima;Gourds;Gourds
Agar;Eucheuma;Aquatic foods;Seaweed
Red king crab;Paralithodes camtschaticus;Aquatic foods;Crustaceans
Alfalfa;Medicago sativa;Herbs and Spices;Herbs
Allspice;Pimenta dioica;Herbs and Spices;Spices
Amaranth;Amaranthus;Herbs and Spices;Herbs
Arrowhead;Sagittaria latifolia;Vegetables;Tubers
Arrowroot;Maranta arundinacea;Vegetables;Tubers
Asian pear;Pyrus pyrifolia;Fruits;Pomes
Atlantic herring;Clupea harengus harengus;Aquatic foods;Fishes
Atlantic mackerel;Scomber scombrus;Aquatic foods;Fishes
Painted comber;Serranus scriba;Aquatic foods;Fishes
Atlantic pollock;Pollachius pollachius;Aquatic foods;Fishes
Atlantic wolffish;Anarhichas lupus;Aquatic foods;Fishes
Bamboo shoots;Phyllostachys edulis;Vegetables;Shoot vegetables
Striped bass;Morone saxatilis;Aquatic foods;Fishes
Beaver;Castor canadensis;Animal foods;Rodents
Beech nut;Fagus;Nuts;Nuts
Beluga whale;Delphinapterus leucas;Aquatic foods;Cetaceans
Bison;Bison bison;Animal foods;Bovines
Black bear;Ursus americanus;Animal foods;Other mammals
Alaska blackfish;Dallia pectoralis;Aquatic foods;Fishes
Blue crab;Callinectes sapidus;Aquatic foods;Crustaceans
Blue mussel;Mytilus edulis;Aquatic foods;Mollusks
Northern bluefin tuna;Thunnus thynnus;Aquatic foods;Fishes
Bluefish;Pomatomus saltatrix;Aquatic foods;Fishes
Wild boar;Sus scrofa;Animal foods;Swine
Bowhead whale;Balaena mysticetus;Aquatic foods;Cetaceans
Breadfruit;Artocarpus altilis;Fruits;Tropical fruits
Breadnut tree seed;Brosimum alicastrum;Herbs and Spices;Other seeds
Rapini;Brassica ruvo;Vegetables;Cabbages
Brown bear;Ursus arctos;Animal foods;Other mammals
Buffalo;Bubalus bubalis;Animal foods;Bovines
Burbot;Lota lota;Aquatic foods;Fishes
Giant butterbur;Petasites japonicus;Vegetables;Other vegetables
American butterfish;Peprilus triacanthus;Aquatic foods;Fishes
Butternut;Juglans cinerea;Nuts;Nuts
Butternut squash;Cucurbita moschata;Gourds;Gourds
Calabash;Lagenaria siceraria;Gourds;Gourds
Cardoon;Cynara cardunculus;Vegetables;Shoot vegetables
Caribou;Rangifer tarandus;Animal foods;Venison
Natal plum;Carissa macrocarpa;Fruits;Tropical fruits
Carob;Ceratonia siliqua;Vegetables;Other vegetables
Common carp;Cyprinus carpio;Aquatic foods;Fishes
Cassava;Manihot esculenta;Vegetables;Tubers
Channel catfish;Ictalurus punctatus;Aquatic foods;Fishes
Chayote;Sechium edule;Gourds;Gourds
Cherimoya;Annona cherimola;Fruits;Tropical fruits
Chervil;Anthriscus cerefolium;Herbs and Spices;Spices
Chia;Salvia hispanica;Herbs and Spices;Other seeds
Chicken (Cock, Hen, Rooster);Gallus gallus;Animal foods;Poultry
Chinese broccoli;Brassica alboglabra;Vegetables;Cabbages
Chinese chestnut;Castanea mollissima;Nuts;Nuts
Chinese water chestnut;Eleocharis dulcis;Vegetables;Other vegetables
Garland chrysanthemum;Chrysanthemum coronarium;Vegetables;Leaf vegetables
Cisco;Coregonus artedi;Aquatic foods;Fishes
Nuttall cockle;Clinocardium nuttallii;Aquatic foods;Mollusks
Coconut;Cocos nucifera;Fruits;Tropical fruits
Pacific cod;Gadus macrocephalus;Aquatic foods;Fishes
Atlantic cod;Gadus morhua;Aquatic foods;Fishes
Common octopus;Octopus vulgaris;Aquatic foods;Mollusks
Corn salad;Valerianella locusta;Vegetables;Leaf vegetables
Cottonseed;Gossypium;Herbs and Spices;Oilseed crops
Catjang pea;Vigna unguiculata ssp. cylindrica;Pulses;Peas
Malus (Crab apple);Malus;Fruits;Pomes
Squashberry;Viburnum edule;Fruits;Berries
Atlantic croaker;Micropogonias undulatus;Aquatic foods;Fishes
Cusk;Brosme brosme;Aquatic foods;Fishes
Cuttlefish;Sepiidae;Aquatic foods;Mollusks
Mule deer;Odocoileus;Animal foods;Venison
Devilfish;Myoxocephalus;Aquatic foods;Fishes
Dock;Rumex;Herbs and Spices;Herbs
Dolphin fish;Coryphaena hippurus;Aquatic foods;Fishes
Freshwater drum;Aplodinotus grunniens;Aquatic foods;Fishes
Mallard duck;Anas platyrhynchos;Animal foods;Poultry
Dungeness crab;Cancer magister;Aquatic foods;Crustaceans
Durian;Durio zibethinus;Fruits;Tropical fruits
Eastern oyster;Crassostrea virginica;Aquatic foods;Mollusks
Freshwater eel;Anguilla;Aquatic foods;Fishes
Elderberry;Sambucus;Fruits;Berries
Elk;Cervus canadensis;Animal foods;Venison
Emu;Dromaius novaehollandiae;Animal foods;Poultry
Oregon yampah;Perideridia oregana;Vegetables;Root vegetables
European anchovy;Engraulis encrasicolus;Aquatic foods;Fishes
European chestnut;Castanea sativa;Nuts;Nuts
Turbot;Scophthalmus maximus;Aquatic foods;Fishes
Fireweed;Chamerion angustifolium;Herbs and Spices;Herbs
Florida pompano;Trachinotus carolinus;Aquatic foods;Fishes
Ginkgo nuts;Ginkgo biloba;Herbs and Spices;Other seeds
Greylag goose;Anser anser;Animal foods;Poultry
Grape;Vitis;Fruits;Berries
Greenland halibut/turbot;Reinhardtius hippoglossoides;Aquatic foods;Fishes
Groundcherry;Physalis;Vegetables;Fruit vegetables
Grouper;Epinephelus;Aquatic foods;Fishes
Guinea hen;Numida meleagris;Animal foods;Poultry
Haddock;Melanogrammus aeglefinus;Aquatic foods;Fishes
Hippoglossus (Common halibut);Hippoglossus;Aquatic foods;Fishes
Hazelnut;Corylus;Nuts;Nuts
Hickory nut;Carya;Nuts;Nuts
Horse;Equus caballus;Animal foods;Equines
Horseradish tree;Moringa oleifera;Vegetables;Other vegetables
Alaska blueberry;Vaccinium alaskaense;Fruits;Berries
Hyacinth bean;Lablab purpureus;Pulses;Beans
Irish moss;Chondrus crispus;Aquatic foods;Seaweed
Pacific jack mackerel;Trachurus symmetricus;Aquatic foods;Fishes
Jackfruit;Artocarpus heterophyllus;Fruits;Tropical fruits
Japanese chestnut;Castanea crenata;Nuts;Nuts
Java plum;Syzygium cumini;Fruits;Tropical fruits
Jerusalem artichoke;Helianthus tuberosus;Vegetables;Tubers
Jujube;Ziziphus zizyphus;Fruits;Other fruits
Jute;Corchorus olitorius;Vegetables;Leaf vegetables
Kale;Brassica napus var. pabularia;Vegetables;Cabbages
Kelp;Laminaria;Aquatic foods;Seaweed
King mackerel;Scomberomorus cavalla;Aquatic foods;Fishes
Kumquat;Fortunella;Fruits;Tropical fruits
Lambsquarters;Chenopodium album;Vegetables;Leaf vegetables
Leather chiton;Katharina tunicata;Aquatic foods;Mollusks
Wild leek;Allium ampeloprasum;Vegetables;Onion-family vegetables
Common ling;Molva molva;Aquatic foods;Fishes
Lingcod;Ophiodon elongatus;Aquatic foods;Fishes
American lobster;Homarus americanus;Aquatic foods;Crustaceans
Loganberry;Rubus loganobaccus;Fruits;Berries
Lotus;Nelumbo;Herbs and Spices;Other seeds
Sacred lotus;Nelumbo nucifera;Vegetables;Other vegetables
White lupine;Lupinus albus;Pulses;Other pulses
Malabar spinach;Basella alba;Vegetables;Leaf vegetables
Mammee apple;Mammea americana;Fruits;Tropical fruits
Purple mangosteen;Garcinia mangostana;Fruits;Tropical fruits
Alpine sweetvetch;Hedysarum alpinum;Vegetables;Root vegetables
Milkfish;Chanos chanos;Aquatic foods;Fishes
Monkfish;Lophius piscatorius;Aquatic foods;Fishes
Moose;Alces alces;Animal foods;Venison
Moth bean;Vigna aconitifolia;Pulses;Beans
Mountain yam;Dioscorea pentaphylla;Vegetables;Tubers
Striped mullet;Mugil cephalus;Aquatic foods;Fishes
Muskrat;Ondatra zibethicus;Animal foods;Rodents
White mustard;Sinapis alba;Herbs and Spices;Spices
Mustard spinach;Brassica perviridis;Vegetables;Cabbages
New Zealand spinach;Tetragonia tetragonioides;Vegetables;Leaf vegetables
Nopal;Opuntia cochenillifera;Vegetables;Other vegetables
Ocean pout;Zoarces americanus;Aquatic foods;Fishes
North Pacific giant octopus;Enteroctopus dofleini;Aquatic foods;Mollusks
Ohelo berry;Vaccinium reticulatum;Fruits;Berries
Okra;Abelmoschus esculentus;Vegetables;Other vegetables
Tunicate;Tunicata;Aquatic foods;Other aquatic foods
Opossum;Didelphis virginiana;Animal foods;Marsupials
Ostrich;Struthio camelus;Animal foods;Poultry
Spotted seal;Phoca largha;Aquatic foods;Pinnipeds
Pacific herring;Clupea pallasii;Aquatic foods;Fishes
Pacific oyster;Crassostrea gigas;Aquatic foods;Mollusks
Pacific rockfish;Sebastes;Aquatic foods;Fishes
Velvet duck;Melanitta fusca;Animal foods;Poultry
Pepper (C. frutescens);Capsicum annuum var. annuum;Vegetables;Fruit vegetables
Common persimmon;Diospyros virginiana;Fruits;Tropical fruits
Pheasant;Phasianus colchicus;Animal foods;Poultry
Northern pike;Esox lucius;Aquatic foods;Fishes
Pili nut;Canarium ovatum;Nuts;Nuts
Colorado pinyon;Pinus edulis;Nuts;Nuts
Pitanga;Eugenia uniflora;Fruits;Tropical fruits
Plains prickly pear;Opuntia macrorhiza;Fruits;Tropical fruits
French plantain;Musa X paradisiaca;Fruits;Tropical fruits
American pokeweed;Phytolacca americana;Vegetables;Shoot vegetables
Polar bear;Ursus maritimus;Animal foods;Other mammals
Opium poppy;Papaver somniferum;Herbs and Spices;Spices
Prairie turnip;Pediomelum esculentum;Vegetables;Root vegetables
Prickly pear;Opuntia;Fruits;Tropical fruits
Quinoa;Chenopodium quinoa;Herbs and Spices;Other seeds
European rabbit;Oryctolagus;Animal foods;Lagomorphs
Raccoon;Procyon lotor;Animal foods;Other mammals
Rainbow smelt;Osmerus mordax;Aquatic foods;Fishes
Rainbow trout;Oncorhynchus mykiss;Aquatic foods;Fishes
Malabar plum;Syzygium jambos;Fruits;Tropical fruits
Rose hip;Rosa;Herbs and Spices;Herbs
Roselle;Hibiscus sabdariffa;Herbs and Spices;Herbs
Orange roughy;Hoplostethus atlanticus;Aquatic foods;Fishes
Sablefish;Anoplopoma fimbria;Aquatic foods;Fishes
Pink salmon;Oncorhynchus gorbuscha;Aquatic foods;Fishes
Chum salmon;Oncorhynchus keta;Aquatic foods;Fishes
Coho salmon;Oncorhynchus kisutch;Aquatic foods;Fishes
Sockeye salmon;Oncorhynchus nerka;Aquatic foods;Fishes
Chinook salmon;Oncorhynchus tshawytscha;Aquatic foods;Fishes
Atlantic salmon;Salmo salar;Aquatic foods;Fishes
Salmonberry;Rubus spectabilis;Fruits;Berries
Common salsify;Tragopogon porrifolius;Vegetables;Root vegetables
Sapodilla;Manilkara zapota;Fruits;Tropical fruits
Mamey sapote;Pouteria sapota;Fruits;Tropical fruits
Spanish mackerel;Scomberomorus maculatus;Aquatic foods;Fishes
Pacific sardine;Sardinops sagax;Aquatic foods;Fishes
Scallop;Pectinidae;Aquatic foods;Mollusks
Scup;Stenotomus chrysops;Aquatic foods;Fishes
Sea cucumber;Parastichopus californicus;Aquatic foods;Other aquatic foods
Steller sea lion;Eumetopias jubatus;Aquatic foods;Pinnipeds
Bearded seal;Erignathus barbatus;Aquatic foods;Pinnipeds
Ringed seal;Pusa hispida;Aquatic foods;Pinnipeds
Seatrout;Cynoscion;Aquatic foods;Fishes
Sesbania flower;Sesbania bispinosa;Vegetables;Other vegetables
American shad;Alosa sapidissima;Aquatic foods;Fishes
Shark;Squaliformes;Aquatic foods;Fishes
Sheefish;Stenodus leucichthys;Aquatic foods;Fishes
Sheep (Mutton, Lamb);Ovis aries;Animal foods;Ovis
Sheepshead;Archosargus probatocephalus;Aquatic foods;Fishes
Hedge mustard;Sisymbrium;Herbs and Spices;Other seeds
Skipjack tuna;Katsuwonus pelamis;Aquatic foods;Fishes
Snapper;Lutjanidae;Aquatic foods;Fishes
Soursop;Annona muricata;Fruits;Tropical fruits
Spelt;Triticum spelta;Cereals and cereal products;Cereals
Spirulina;Spirulina;Aquatic foods;Seaweed
Squab;Columba;Animal foods;Poultry
Squirrel;Sciuridae;Animal foods;Rodents
Strawberry guava;Psidium cattleianum;Fruits;Berries
Greater sturgeon;Acipenser;Aquatic foods;Fishes
White sucker;Catostomus commersonii;Aquatic foods;Fishes
Sugar apple;Annona squamosa;Fruits;Tropical fruits
Pumpkinseed sunfish;Lepomis gibbosus;Aquatic foods;Fishes
Swordfish;Xiphias gladius;Aquatic foods;Fishes
Taro;Colocasia esculenta;Vegetables;Root vegetables
Teff;Eragrostis tef;Herbs and Spices;Herbs
Tilefish;Lopholatilus chamaeleonticeps;Aquatic foods;Fishes
Mexican groundcherry;Physalis philadelphica var. immaculata;Vegetables;Fruit vegetables
Towel gourd;Luffa aegyptiaca;Gourds;Gourds
Salmonidae (Salmon, Trout);Salmonidae;Aquatic foods;Fishes
Turkey;Meleagris gallopavo;Animal foods;Poultry
Cattle (Beef, Veal);Bos taurus;Animal foods;Bovines
Walleye;Sander vitreus;Aquatic foods;Fishes
Alaska pollock;Theragra chalcogramma;Aquatic foods;Fishes
Wasabi;Wasabia japonica;Herbs and Spices;Spices
Wax gourd;Benincasa hispida;Gourds;Gourds
Whelk;Buccinidae;Aquatic foods;Mollusks
Coalfish pollock;Pollachius virens;Aquatic foods;Fishes
Broad whitefish;Coregonus nasus;Aquatic foods;Fishes
Whitefish;Coregonus;Aquatic foods;Fishes
Whiting;Merlangius merlangus;Aquatic foods;Fishes
Wild rice;Zizania;Cereals and cereal products;Cereals
Tea leaf willow;Salix pulchra;Herbs and Spices;Herbs
Winged bean;Psophocarpus tetragonolobus;Pulses;Beans
Yam;Dioscorea;Vegetables;Tubers
Jicama;Pachyrhizus erosus;Vegetables;Root vegetables
Yautia;Xanthosoma sagittifolium;Vegetables;Leaf vegetables
Yellowfin tuna;Thunnus albacares;Aquatic foods;Fishes
Yellowtail amberjack;Seriola lalandi;Aquatic foods;Fishes
Pollock;Pollachius;Aquatic foods;Fishes
Albacore tuna;Thunnus alalunga;Aquatic foods;Fishes
Gadus (Common cod);Gadus;Aquatic foods;Fishes
Atlantic halibut;Hippoglossus hippoglossus;Aquatic foods;Fishes
Pacific halibut;Hippoglossus stenolepis;Aquatic foods;Fishes
Pacific salmon;Oncorhynchus;Aquatic foods;Fishes
Smelt;Osmeridae;Aquatic foods;Fishes
Clupeinae (Herring, Sardine, Sprat);Clupeinae;Aquatic foods;Fishes
Spiny lobster;Palinuridae;Aquatic foods;Crustaceans
Snow crab;Chionoecetes opilio;Aquatic foods;Crustaceans
Black-eyed pea;Vigna unguiculata ssp. unguiculata;Pulses;Peas
Deer;Cervidae;Animal foods;Venison
Macadamia nut;Macadamia;Nuts;Nuts
Percoidei (Bass and others);Percoidei;Aquatic foods;Fishes
Perciformes (Perch-like fishes);Perciformes;Aquatic foods;Fishes
Arctic ground squirrel;Urocitellus parryii;Animal foods;Rodents
Rabbit;Leporidae;Animal foods;Lagomorphs
Domestic goat;Capra aegagrus hircus;Animal foods;Caprae
Beefalo;Bos taurus X Bison bison;Animal foods;Bovines
Antelope;Artiodactyla;Animal foods;Venison
Bivalvia (Clam, Mussel, Oyster);Bivalvia;Aquatic foods;Mollusks
Squid;Teuthida;Aquatic foods;Mollusks
Shrimp;Caridea;Aquatic foods;Crustaceans
Crayfish;Astacidea;Aquatic foods;Crustaceans
Flatfish;Pleuronectiformes;Aquatic foods;Fishes
Domestic pig (Piglet, Pork);Sus scrofa domestica;Animal foods;Swine
Walrus;Odobenus rosmarus;Aquatic foods;Pinnipeds
Alaska wild rhubarb;Polygonum alpinum;Vegetables;Stalk vegetables
Oriental wheat;Triticum turanicum;Cereals and cereal products;Cereals
Yardlong bean;Vigna unguiculata ssp. sesquipedalis;Pulses;Peas
Great horned owl;Bubo virginianus;Animal foods;Poultry
Quail;Phasianidae;Animal foods;Poultry
Boysenberry;Rubus ursinus X idaeus;Fruits;Berries
Persian lime;Citrus latifolia;Fruits;Citrus
Feijoa;Feijoa sellowiana;Fruits;Tropical fruits
Rowal;Pangium edule;Herbs and Spices;Other seeds
Jew's ear;Auricularia auricula-judae;Vegetables;Mushrooms
Common mushroom;Agaricus bisporus;Vegetables;Mushrooms
Shiitake;Lentinus edodes;Vegetables;Mushrooms
Purple laver;Porphyra laciniata;Aquatic foods;Seaweed
Wakame;Undaria pinnatifida;Aquatic foods;Seaweed
Enokitake;Flammulina velutipes;Vegetables;Mushrooms
Epazote;Dysphania ambrosioides;Herbs and Spices;Herbs
Oyster mushroom;Pleurotus ostreatus;Vegetables;Mushrooms
Cloud ear fungus;Auricularia polytricha;Vegetables;Mushrooms
Maitake;Grifola frondosa;Vegetables;Mushrooms
Ostrich fern;Matteuccia struthiopteris;Vegetables;Leaf vegetables
Spot croaker;Leiostomus xanthurus;Aquatic foods;Fishes
Sourdock;Rumex articus;Herbs and Spices;Herbs
Tinda;Citrullus lanatus var. fistulosus;Gourds;Gourds
Atlantic menhaden;Brevoortia tyrannus;Aquatic foods;Fishes
Wheat;Triticum;Cereals and cereal products;Cereals
Common chokecherry;Prunus virginiana;Fruits;Drupes
Agave;Agave;Vegetables;Other vegetables
Narrowleaf cattail;Typha angustifolia;Vegetables;Other vegetables
Jellyfish;Scyphozoa;Aquatic foods;Other aquatic foods
Anchovy;Engraulidae;Aquatic foods;Fishes
Blue whiting;Micromesistius poutassou;Aquatic foods;Fishes
Carp bream;Abramis brama;Aquatic foods;Fishes
Chanterelle;Cantharellus cibarius;Vegetables;Mushrooms
Sturgeon;Acipenseridae;Aquatic foods;Fishes
Charr;Salvelinus;Aquatic foods;Fishes
Cinnamon;Cinnamomum;Herbs and Spices;Spices
Crab;Brachyura;Aquatic foods;Crustaceans
Common dab;Limanda limanda;Aquatic foods;Fishes
Spiny dogfish;Squalus acanthias;Aquatic foods;Fishes
Anatidae (Duck, Goose, Swan);Anatidae;Animal foods;Poultry
Anguilliformes (Eel);Anguilliformes;Aquatic foods;Fishes
True frog;Ranidae;Aquatic foods;Amphibians
Garfish;Belone belone;Aquatic foods;Fishes
Gadiformes (Cod, Hake);Gadiformes;Aquatic foods;Fishes
Mountain hare;Lepus timidus;Animal foods;Lagomorphs
Lake trout;Salvelinus namaycush;Aquatic foods;Fishes
Lemon sole;Microstomus kitt;Aquatic foods;Fishes
Clawed lobster;Nephropidae;Aquatic foods;Crustaceans
Lumpsucker;Cyclopteridae;Aquatic foods;Fishes
Scombridae (Bonito, Mackerel, Tuna);Scombridae;Aquatic foods;Fishes
Marine mussel;Mytilidae;Aquatic foods;Mollusks
Norway haddock;Sebastes viviparus;Aquatic foods;Fishes
Norway lobster;Nephrops norvegicus;Aquatic foods;Crustaceans
Norway pout;Trisopterus esmarkii;Aquatic foods;Fishes
Oil palm;Elaeis;Herbs and Spices;Oilseed crops
True oyster;Ostreidae;Aquatic foods;Mollusks
Sago palm;Metroxylon sagu;Herbs and Spices;Oilseed crops
Persimmon;Diospyros;Fruits;Tropical fruits
Pikeperch;Sander lucioperca;Aquatic foods;Fishes
Pleuronectidae (Dab, Halibut, Plaice);Pleuronectidae;Aquatic foods;Fishes
Rock ptarmigan;Lagopus muta;Animal foods;Poultry
Pacific ocean perch;Sebastes alutus;Aquatic foods;Fishes
Black salsify;Scorzonera hispanica;Vegetables;Root vegetables
True seal;Phocidae;Aquatic foods;Pinnipeds
Red algae;Rhodophyta;Aquatic foods;Seaweed
Kombu;Saccharina japonica;Aquatic foods;Seaweed
Snail;Gastropoda;Aquatic foods;Mollusks
True sole;Soleidae;Aquatic foods;Fishes
Catfish;Siluriformes;Aquatic foods;Fishes
Thistle;Cirsium;Vegetables;Root vegetables
Thunnus (Common tuna);Thunnus;Aquatic foods;Fishes
Walnut;Juglans;Nuts;Nuts
Cetacea (Dolphin, Porpoise, Whale);Cetacea;Aquatic foods;Cetaceans
Columbidae (Dove, Pigeon);Columbidae;Animal foods;Poultry
Conch;Strombidae;Aquatic foods;Mollusks
Grape wine;NULL;Beverages;Fermented beverages
Berry wine;NULL;Beverages;Fermented beverages
Other wine;NULL;Beverages;Fermented beverages
Apple cider;NULL;Beverages;Fermented beverages
Liquor;NULL;Beverages;Distilled beverages
Cheese;NULL;Milk and milk products;Fermented milk products
Milk (Cow);;Milk and milk products;Unfermented milks
Eggs;NULL;Eggs;Eggs
Yogurt;NULL;Milk and milk products;Fermented milk products
Bean;NULL;Pulses;Beans
Vodka;NULL;Beverages;Distilled beverages
Whisky;NULL;Beverages;Distilled beverages
Ice cream;NULL;Confectioneries;Frozen desserts
Gin;NULL;Beverages;Distilled beverages
Honey;NULL;Confectioneries;Other confectioneries
Liquorice;NULL;Confectioneries;Candies
Vinegar;NULL;Baking goods;Seasonings
Rum;NULL;Beverages;Distilled beverages
Port wine;NULL;Beverages;Fortified wines
Vermouth;NULL;Beverages;Fortified wines
Sherry;NULL;Beverages;Fortified wines
Madeira wine;NULL;Beverages;Fortified wines
Nougat;NULL;Confectioneries;Other confectioneries
Toffee;NULL;Confectioneries;Other confectioneries
Cake;NULL;Confectioneries;Desserts
Pizza;NULL;Dishes;Other dishes
Ymer;NULL;Milk and milk products;Fermented milk products
Other snack food;NULL;Snack foods;Snack foods
Crisp bread;NULL;Cereals and cereal products;Flat breads
Pastry;NULL;Confectioneries;Desserts
Dragée;NULL;Confectioneries;Candies
Chewing gum;NULL;Confectioneries;Candies
Marzipan;NULL;Confectioneries;Other confectioneries
Salad dressing;NULL;Baking goods;Dressings
Sauce;NULL;Baking goods;Sauces
Salt;NULL;Baking goods;Seasonings
Butter;NULL;Milk and milk products;Other milk products
Butter substitute;NULL;Baking goods;Substitutes
Cream;NULL;Milk and milk products;Other milk products
Sugar;NULL;Baking goods;Sugars
Sausage;NULL;Dishes;Ground meat
Meatball;NULL;Dishes;Ground meat
Mustard;NULL;Baking goods;Condiments
Pate;NULL;Dishes;Ground meat
Sugar substitute;NULL;Baking goods;Substitutes
Meat bouillon;NULL;Baking goods;Baking goods
Other meat product;NULL;Animal foods;Meat products
Whey;NULL;Milk and milk products;Other milk products
Casein;NULL;Milk and milk products;Other milk products
Fruit preserve;NULL;Fruits;Fruit products
Leavening agent;NULL;Baking goods;Baking goods
Marshmallow;NULL;Confectioneries;Candies
Gelatin;NULL;Baking goods;Baking goods
Water;NULL;Beverages;Waters
Other fish product;NULL;Aquatic foods;Fish products
Milk (Human);NULL;Milk and milk products;Unfermented milks
Other beverage;NULL;Beverages;Other beverages
Baby food;NULL;Baby foods;Baby foods
Dumpling;NULL;Dishes;Other dishes
Soup;NULL;Dishes;Other dishes
Other vegetable product;NULL;Vegetables;Vegetable products
Unclassified food or beverage;NULL;Unclassified;Unclassified
Syrup;NULL;Baking goods;Baking goods
Tallow;NULL;Fats and oils;Animal fats
Remoulade;NULL;Baking goods;Condiments
Chocolate spread;NULL;Confectioneries;Spreads
Fruit gum;NULL;Confectioneries;Candies
Curry powder;NULL;Herbs and Spices;Herb and spice mixtures
Other candy;NULL;Confectioneries;Candies
Meringue;NULL;Confectioneries;Other confectioneries
Lard;NULL;Fats and oils;Animal fats
Other animal fat;NULL;Fats and oils;Animal fats
Other cocoa product;NULL;Cocoa and cocoa products;Cocoa products
Cocoa butter;NULL;Cocoa and cocoa products;Cocoa products
Cocoa powder;NULL;Cocoa and cocoa products;Cocoa products
Cocoa liquor;NULL;Cocoa and cocoa products;Cocoa products
Chocolate;NULL;Cocoa and cocoa products;Cocoa products
Hot chocolate;NULL;Cocoa and cocoa products;Cocoa products
Dried milk;NULL;Milk and milk products;Other milk products
Milk (Other mammals);NULL;Milk and milk products;Unfermented milks
Kefir;NULL;Milk and milk products;Fermented milks
Buttermilk;NULL;Milk and milk products;Fermented milks
Other fermented milk;NULL;Milk and milk products;Fermented milks
Soy sauce;NULL;Soy;Soy products
Miso;NULL;Soy;Soy products
Tofu;NULL;Soy;Soy products
Zwieback;NULL;Cereals and cereal products;Leavened breads
Roe;NULL;Aquatic foods;Roe
Cichlidae (Tilapia);Cichlidae;Aquatic foods;Fishes
Icing;NULL;Confectioneries;Other confectioneries
Snack bar;NULL;Snack foods;Snack foods
Green turtle;Chelonia mydas;Aquatic foods;Other aquatic foods
Energy drink;NULL;Beverages;Nutritional beverages
Burrito;NULL;Dishes;Tex-Mex cuisine
Hamburger;NULL;Dishes;Sandwiches
Baked beans;NULL;Dishes;Other dishes
Chili;NULL;Dishes;Tex-Mex cuisine
Taco;NULL;Dishes;Tex-Mex cuisine
Tortilla;NULL;Cereals and cereal products;Flat breads
Nachos;NULL;Dishes;Tex-Mex cuisine
Processed cheese;NULL;Milk and milk products;Fermented milk products
Salad;NULL;Dishes;Other dishes
Cream substitute;NULL;Baking goods;Substitutes
Dulce de leche;NULL;Confectioneries;Spreads
Topping;NULL;Baking goods;Baking goods
Sweet custard;NULL;Confectioneries;Milk desserts
Egg roll;NULL;Dishes;Asian cuisine
Heart of palm;NULL;Vegetables;Other vegetables
Popcorn;NULL;Snack foods;Snack foods
Potato chip;NULL;Snack foods;Snack foods
Tortilla chip;NULL;Snack foods;Snack foods
Corn chip;NULL;Snack foods;Snack foods
Hibiscus tea;Hibiscus sabbariffa;Teas;Herbal teas
Stew;NULL;Dishes;Other dishes
Gelatin dessert;NULL;Confectioneries;Desserts
Junket;NULL;Confectioneries;Milk desserts
Falafel;NULL;Dishes;Other dishes
Frybread;NULL;Dishes;Other dishes
Other frozen dessert;NULL;Confectioneries;Frozen desserts
Lasagna;NULL;Dishes;Pasta dishes
Morchella (Morel);Morchellaceae;Vegetables;Mushrooms
Pancake;NULL;Dishes;Other dishes
Pectin;NULL;Baking goods;Baking goods
Pudding;NULL;Confectioneries;Desserts
Waffle;NULL;Dishes;Other dishes
Soy milk;NULL;Soy;Soy products
Meatloaf;NULL;Dishes;Ground meat
Sake;NULL;Beverages;Fermented beverages
Cocktail;NULL;Beverages;Alcoholic beverages
Couscous;NULL;Dishes;Berber cuisine
Bulgur;NULL;Cereals and cereal products;Cereal products
Coffee substitute;NULL;Baking goods;Substitutes
Coffee mocha;NULL;Coffee and coffee products;Coffee products
Chimichanga;NULL;Dishes;Mexican cuisine
Semolina;NULL;Cereals and cereal products;Cereal products
Tapioca pearl;NULL;Baking goods;Baking goods
Tostada;NULL;Dishes;Mexican cuisine
Quesadilla;NULL;Dishes;Mexican cuisine
Baked potato;NULL;Dishes;Potato dishes
Hot dog;NULL;Dishes;Sandwiches
Spread;NULL;Baking goods;Baking goods
Enchilada;NULL;Dishes;Mexican cuisine
Egg substitute;NULL;Baking goods;Substitutes
Nutritional drink;NULL;Beverages;Nutritional beverages
Other sandwich;NULL;Dishes;Sandwiches
Ketchup;NULL;Baking goods;Condiments
Breakfast sandwich;NULL;Dishes;Sandwiches
Adobo;NULL;Baking goods;Seasonings
Macaroni and cheese;NULL;Dishes;Pasta dishes
Butterfat;NULL;Milk and milk products;Other milk products
Horned melon;Cucumis metuliferus;Gourds;Gourds
Hushpuppy;NULL;Dishes;American cuisine
Fruit juice;NULL;Beverages;Other beverages
Relish;NULL;Baking goods;Condiments
Other fruit product;NULL;Fruits;Fruit products
Fruit salad;NULL;Fruits;Fruit products
Soy yogurt;NULL;Soy;Soy products
Vegetarian food;NULL;Dishes;Other dishes
Veggie burger;NULL;Dishes;Sandwiches
Cold cut;NULL;Dishes;Ground meat
Mixed nuts;NULL;Nuts;Nuts
Canola;NULL;Herbs and spices;Oilseed crops
Babassu palm;Attalea speciosa;Herbs and Spices;Oilseed crops
Cupuaçu;Theobroma grandiflorum;Herbs and Spices;Oilseed crops
Shea tree;Vitellaria paradoxa;Herbs and Spices;Oilseed crops
Oil-seed Camellia;Camellia oleifera;Herbs and Spices;Oilseed crops
Ucuhuba;Virola surinamensis;Herbs and Spices;Oilseed crops
Phyllo dough;NULL;Baking goods;Baking goods
Cooking oil;NULL;Baking goods;Baking goods
Pie crust;NULL;Baking goods;Wrappers
Pie filling;NULL;Baking goods;Baking goods
Pie;NULL;Confectioneries;Desserts
Shortening;NULL;Fats and oils;Vegetable fats
Soy cream;NULL;Soy;Soy products
Ice cream cone;NULL;Baking goods;Wrappers
Molasses;NULL;Baking goods;Baking goods
Cracker;NULL;Snack foods;Snack foods
Nance;Byrsonima crassifolia;Fruits;Tropical fruits
Naranjilla;Solanum quitoense;Fruits;Tropical fruits
Natto;NULL;Soy;Soy products
Ravioli;NULL;Dishes;Pasta dishes
Scrapple;NULL;Dishes;American cuisine
Other pasta dish;NULL;Dishes;Pasta dishes
Succotash;NULL;Dishes;American cuisine
Tamale;NULL;Dishes;Latin American cuisine
Rice cake;NULL;Dishes;Asian cuisine
Tree fern;Cyathea;Vegetables;Other vegetables
Evaporated milk;NULL;Milk and milk products;Other milk products
Flour;NULL;Cereals and cereal products;Cereal products
Akutaq;NULL;Confectioneries;Desserts
Dough;NULL;Cereals and cereal products;Doughs
Pita bread;NULL;Cereals and cereal products;Flat breads
Focaccia;NULL;Cereals and cereal products;Flat breads
Bagel;NULL;Cereals and cereal products;Leavened breads
Other bread product;NULL;Cereals and cereal products;Bread products
Piki bread;NULL;Cereals and cereal products;Flat breads
French toast;NULL;Cereals and cereal products;Leavened breads
Wheat bread;NULL;Cereals and cereal products;Leavened breads
Rye bread;NULL;Cereals and cereal products;Leavened breads
Oat bread;;Cereals and cereal products;Leavened breads
Potato bread;NULL;Cereals and cereal products;Other breads
Cornbread;NULL;Cereals and cereal products;Flat breads
Corn grits;NULL;Cereals and cereal products;Cereal products
Multigrain bread;NULL;Cereals and cereal products;Leavened breads
Rice bread;NULL;Cereals and cereal products;Leavened breads
Pan dulce;NULL;Cereals and cereal products;Leavened breads
Raisin bread;NULL;Cereals and cereal products;Sweet breads
Wonton wrapper;NULL;Baking goods;Wrappers
Trail mix;NULL;Snack foods;Snack foods
Greenthread tea;Thelesperma;Teas;Herbal teas
Fruit-flavor drink;NULL;Beverages;Other beverages
Vegetable juice;NULL;Beverages;Other beverages
Horchata;NULL;Beverages;Other beverages
Soft drink;NULL;Beverages;Other beverages
Frozen yogurt;NULL;Confectioneries;Frozen desserts
Milkshake;NULL;Confectioneries;Frozen desserts
Chocolate mousse;NULL;Confectioneries;Desserts
Dripping;NULL;Fats and oils;Animal fats
Pupusa;NULL;Dishes;Latin American cuisine
Empanada;NULL;Dishes;Latin American cuisine
Arepa;NULL;Dishes;Latin American cuisine
Ascidians;Ascidiacea;Aquatic foods;Other aquatic foods
Gefilte fish;NULL;Dishes;Jewish cuisine
Yellow pond-lily;Nuphar lutea;Herbs and Spices;Herbs
Fish burger;NULL;Dishes;Sandwiches
Other dish;NULL;Dishes;Other dishes
Pot pie;NULL;Dishes;Other dishes
Stuffing;NULL;Baking goods;Baking goods
Edible shell;NULL;Baking goods;Wrappers
Fudge;NULL;Confectioneries;Candies
Candy bar;NULL;Confectioneries;Candies
Condensed milk;NULL;Milk and milk products;Other milk products
Margarine;NULL;Fats and oils;Vegetable fats
Margarine-like spread;NULL;Fats and oils;Vegetable fats
Hummus;NULL;Dishes;Levantine cuisine
Potato puffs;NULL;Dishes;Potato dishes
Potato gratin;NULL;Dishes;Potato dishes
Milk substitute;NULL;Baking goods;Substitutes
Pepper (C. pubescens);Capsicum pubescens;Vegetables;Fruit vegetables
Soft-necked garlic;Allium sativum L. var. sativum;Herbs and Spices;Herbs
Cabbage;Brassica oleracea var. capitata;Vegetables;Cabbages
Chinese bayberry;Myrica rubra;Fruits;Berries
Mushrooms;NULL;Vegetables;Mushrooms
Alcoholic beverages;NULL;Beverages;Alcoholic beverages
Onion-family vegetables;NULL;Vegetables;Onion-family vegetables
Pomes;NULL;Fruits;Pomes
Brassicas;NULL;Vegetables;Brassicas
Cereals and cereal products;NULL;Cereals and cereal products;Cereals and cereal products
Citrus;NULL;Fruits;Citrus
Cocoa and cocoa products;NULL;Cocoa and cocoa products;Cocoa and cocoa products
Coffee and coffee products;NULL;Coffee and coffee products;Coffee and coffee products
Crustaceans;NULL;Aquatic foods;Crustaceans
Milk and milk products;NULL;Milk and milk products;Milk and milk products
Fats and oils;NULL;Fats and oils;Fats and oils
Fishes;NULL;Aquatic foods;Fishes
Herbs and Spices;NULL;Herbs and Spices;Herbs and Spices
Pulses;;Pulses;Pulses
Animal foods;NULL;Animal foods;Animal foods
Mollusks;NULL;Aquatic foods;Mollusks
Nuts;NULL;Nuts;Nuts
Beverages;NULL;Beverages;Beverages
Fruits;NULL;Fruits;Fruits
Green vegetables;NULL;Vegetables;Green vegetables
Root vegetables;NULL;Vegetables;Root vegetables
Sunburst squash (pattypan squash);Cucurbita pepo var. clypeata;Gourds;Gourds
Green zucchini;Cucurbita pepo var. cylindrica;Gourds;Gourds
Yellow zucchini;Cucurbita pepo var. cylindrica;Gourds;Gourds
Green bell pepper;Capsicum annuum;Vegetables;Fruit vegetables
Yellow bell pepper;Capsicum annuum;Vegetables;Fruit vegetables
Orange bell pepper;Capsicum annuum;Vegetables;Fruit vegetables
Red bell pepper;Capsicum annuum;Vegetables;Fruit vegetables
Italian sweet red pepper;Capsicum annuum;Vegetables;Fruit vegetables
Yellow wax bean;Phaseolus vulgaris;Pulses;Beans
Green bean;Phaseolus vulgaris;Pulses;Beans
Saskatoon berry;Amelanchier alnifolia;Fruits;Berries
Nanking cherry;Prunus tomentosa;Fruits;Berries
Japanese pumpkin;Cucurbita maxima;Gourds;Gourds
White cabbage;Brassica oleracea L. var. capitata L. f. alba DC.;Vegetables;Cabbages
Romaine lettuce;Lactuca sativa L. var. longifolia;Vegetables;Leaf vegetables
dumplings;;;
muesli;;;
milk;;;
1 FOOD NAME SCIENTIFIC NAME GROUP SUB GROUP
2 Angelica Angelica keiskei Herbs and Spices Herbs
3 Savoy cabbage Brassica oleracea var. sabauda Vegetables Cabbages
4 Silver linden Tilia argentea Herbs and Spices Herbs
5 Kiwi Actinidia chinensis Fruits Tropical fruits
6 Allium (Onion) Allium Vegetables Onion-family vegetables
7 Garden onion Allium cepa Vegetables Onion-family vegetables
8 Leek Allium porrum Vegetables Onion-family vegetables
9 Garlic Allium sativum Herbs and Spices Herbs
10 Chives Allium schoenoprasum Herbs and Spices Herbs
11 Lemon verbena Aloysia triphylla Herbs and Spices Herbs
12 Cashew nut Anacardium occidentale Nuts Nuts
13 Pineapple Ananas comosus Fruits Tropical fruits
14 Dill Anethum graveolens Herbs and Spices Herbs
15 Custard apple Annona reticulata Fruits Tropical fruits
16 Wild celery Apium graveolens Herbs and Spices Spices
17 Peanut Arachis hypogaea Nuts Nuts
18 Burdock Arctium lappa Vegetables Root vegetables
19 Horseradish Armoracia rusticana Herbs and Spices Spices
20 Tarragon Artemisia dracunculus Herbs and Spices Herbs
21 Mugwort Artemisia vulgaris Herbs and Spices Herbs
22 Asparagus Asparagus officinalis Vegetables Shoot vegetables
23 Oat Avena sativa Cereals and cereal products Cereals
24 Star fruit Averrhoa carambola Fruits Tropical fruits
25 Brazil nut Bertholletia excelsa Nuts Nuts
26 Common beet Beta vulgaris Vegetables Leaf vegetables
27 Borage Borago officinalis Herbs and Spices Oilseed crops
28 Chinese mustard Brassica juncea Vegetables Cabbages
29 Swede Brassica napus Vegetables Root vegetables
30 Rape Brassica napus var. napus Vegetables Root vegetables
31 Common cabbage Brassica oleracea Vegetables Cabbages
32 Cauliflower Brassica oleracea var. botrytis Vegetables Cabbages
33 Brussel sprouts Brassica oleracea var. gemmifera Vegetables Cabbages
34 Kohlrabi Brassica oleracea var. gongylodes Vegetables Root vegetables
35 Broccoli Brassica oleracea var. italica Vegetables Cabbages
36 Chinese cabbage Brassica rapa Vegetables Cabbages
37 Turnip Brassica rapa var. rapa Herbs and Spices Herbs
38 Pigeon pea Cajanus cajan Pulses Peas
39 Tea Camellia sinensis Teas Teas
40 Capers Capparis spinosa Herbs and Spices Spices
41 Pepper (C. annuum) Capsicum annuum Vegetables Fruit vegetables
42 Papaya Carica papaya Fruits Tropical fruits
43 Safflower Carthamus tinctorius Herbs and Spices Oilseed crops
44 Caraway Carum carvi Herbs and Spices Spices
45 Pecan nut Carya illinoinensis Nuts Nuts
46 Chestnut Castanea Nuts Nuts
47 Roman camomile Chamaemelum nobile Herbs and Spices Herbs
48 Chickpea Cicer arietinum Pulses Peas
49 Endive Cichorium endivia Vegetables Leaf vegetables
50 Chicory Cichorium intybus Vegetables Root vegetables
51 Chinese cinnamon Cinnamomum aromaticum Herbs and Spices Spices
52 Ceylon cinnamon Cinnamomum verum Herbs and Spices Spices
53 Watermelon Citrullus lanatus Gourds Gourds
54 Lime Citrus aurantiifolia Fruits Citrus
55 Lemon Citrus limon Fruits Citrus
56 Pummelo Citrus maxima Fruits Citrus
57 Mandarin orange (Clementine, Tangerine) Citrus reticulata Fruits Citrus
58 Sweet orange Citrus sinensis Fruits Citrus
59 Coffee Coffea Coffee and coffee products Coffee
60 Arabica coffee Coffea arabica Coffee and coffee products Coffee
61 Robusta coffee Coffea canephora Coffee and coffee products Coffee
62 Coriander Coriandrum sativum Herbs and Spices Herbs
63 Common hazelnut Corylus avellana Nuts Nuts
64 Saffron Crocus sativus Herbs and Spices Spices
65 Muskmelon Cucumis melo Gourds Gourds
66 Cucumber Cucumis sativus Gourds Gourds
67 Cucurbita (Gourd) Cucurbita Gourds Gourds
68 Cumin Cuminum cyminum Herbs and Spices Spices
69 Turmeric Curcuma longa Herbs and Spices Spices
70 Quince Cydonia oblonga Fruits Pomes
71 Lemon grass Cymbopogon citratus Herbs and Spices Herbs
72 Globe artichoke Cynara scolymus Vegetables Shoot vegetables
73 Wild carrot Daucus carota Vegetables Root vegetables
74 Japanese persimmon Diospyros kaki Fruits Tropical fruits
75 Cardamom Elettaria cardamomum Herbs and Spices Spices
76 Black crowberry Empetrum nigrum Fruits Berries
77 Loquat Eriobotrya japonica Fruits Tropical fruits
78 Rocket salad (ssp.) Eruca vesicaria ssp. sativa Vegetables Leaf vegetables
79 Wax apple Eugenia Fruits Tropical fruits
80 Common buckwheat Fagopyrum esculentum Cereals and cereal products Cereals
81 Tartary buckwheat Fagopyrum tataricum Cereals and cereal products Cereals
82 Fig Ficus carica Fruits Other fruits
83 Fennel Foeniculum vulgare Herbs and Spices Herbs
84 Strawberry Fragaria X ananassa Fruits Berries
85 Black huckleberry Gaylussacia baccata Fruits Berries
86 Soy bean Glycine max Soy Soy
87 Sunflower Helianthus annuus Herbs and Spices Oilseed crops
88 Sea-buckthornberry Hippophae rhamnoides Fruits Berries
89 Barley Hordeum vulgare Cereals and cereal products Cereals
90 Hyssop Hyssopus officinalis Herbs and Spices Herbs
91 Star anise Illicium verum Herbs and Spices Spices
92 Swamp cabbage Ipomoea aquatica Vegetables Leaf vegetables
93 Sweet potato Ipomoea batatas Vegetables Tubers
94 Black walnut Juglans nigra Nuts Nuts
95 Common walnut Juglans regia Nuts Nuts
96 Lettuce Lactuca sativa Vegetables Leaf vegetables
97 Grass pea Lathyrus sativus Pulses Peas
98 Sweet bay Laurus nobilis Herbs and Spices Herbs
99 Lentils Lens culinaris Pulses Lentils
100 Garden cress Lepidium sativum Vegetables Leaf vegetables
101 Lovage Levisticum officinale Herbs and Spices Herbs
102 Flaxseed Linum usitatissimum Herbs and Spices Oilseed crops
103 Mexican oregano Lippia graveolens Herbs and Spices Herbs
104 Lichee Litchi chinensis Fruits Tropical fruits
105 Lupine Lupinus Pulses Other pulses
106 Apple Malus pumila Fruits Pomes
107 Mango Mangifera indica Fruits Tropical fruits
108 German camomile Matricaria recutita Herbs and Spices Herbs
109 Lemon balm Melissa officinalis Herbs and Spices Herbs
110 Mentha (Mint) Mentha Herbs and Spices Herbs
111 Orange mint Mentha aquatica Herbs and Spices Herbs
112 Cornmint Mentha arvensis Herbs and Spices Herbs
113 Spearmint Mentha spicata Herbs and Spices Herbs
114 Peppermint Mentha X piperita Herbs and Spices Herbs
115 Medlar Mespilus germanica Fruits Pomes
116 Bitter gourd Momordica charantia Gourds Gourds
117 Mulberry Morus Fruits Berries
118 Black mulberry Morus nigra Fruits Berries
119 Nutmeg Myristica fragrans Herbs and Spices Spices
120 Sweet basil Ocimum basilicum Herbs and Spices Herbs
121 Evening primrose Oenothera biennis Herbs and Spices Oilseed crops
122 Olive Olea europaea Vegetables Fruit vegetables
123 Sweet marjoram Origanum majorana Herbs and Spices Herbs
124 Pot marjoram Origanum onites Herbs and Spices Herbs
125 Common oregano Origanum vulgare Herbs and Spices Herbs
126 Rice Oryza sativa Cereals and cereal products Cereals
127 Millet Panicum miliaceum Cereals and cereal products Cereals
128 Poppy Papaver Herbs and Spices Oilseed crops
129 Passion fruit Passiflora edulis Fruits Tropical fruits
130 Parsnip Pastinaca sativa Vegetables Root vegetables
131 Avocado Persea americana Vegetables Fruit vegetables
132 Parsley Petroselinum crispum Herbs and Spices Herbs
133 Scarlet bean Phaseolus coccineus Pulses Beans
134 Lima bean Phaseolus lunatus Pulses Beans
135 Common bean Phaseolus vulgaris Pulses Beans
136 Date Phoenix dactylifera Fruits Other fruits
137 Black chokeberry Photinia melanocarpa Fruits Berries
138 Anise Pimpinella anisum Herbs and Spices Herbs
139 Pine nut Pinus Nuts Nuts
140 Pepper (Spice) Piper nigrum Herbs and Spices Spices
141 Pistachio Pistacia vera Nuts Nuts
142 Common pea Pisum sativum Pulses Peas
143 Purslane Portulaca oleracea Herbs and Spices Herbs
144 Prunus (Cherry, Plum) Prunus Fruits Drupes
145 Apricot Prunus armeniaca Fruits Drupes
146 Sweet cherry Prunus avium Fruits Drupes
147 Sour cherry Prunus cerasus Fruits Drupes
148 European plum Prunus domestica Fruits Drupes
149 Almond Prunus dulcis Nuts Nuts
150 Peach Prunus persica Fruits Drupes
151 Guava Psidium guajava Fruits Tropical fruits
152 Pomegranate Punica granatum Fruits Tropical fruits
153 Pear Pyrus communis Fruits Pomes
154 Radish Raphanus sativus Vegetables Root vegetables
155 Garden rhubarb Rheum rhabarbarum Vegetables Stalk vegetables
156 Blackcurrant Ribes nigrum Fruits Berries
157 Redcurrant Ribes rubrum Fruits Berries
158 Gooseberry Ribes uva-crispa Fruits Berries
159 Watercress Rorippa nasturtium-aquaticum Herbs and Spices Herbs
160 Rosemary Rosmarinus officinalis Herbs and Spices Herbs
161 Rubus (Blackberry, Raspberry) Rubus Fruits Berries
162 Cloudberry Rubus chamaemorus Fruits Berries
163 Red raspberry Rubus idaeus Fruits Berries
164 Black raspberry Rubus occidentalis Fruits Berries
165 Sorrel Rumex acetosa Herbs and Spices Herbs
166 Common sage Salvia officinalis Herbs and Spices Herbs
167 Black elderberry Sambucus nigra Fruits Berries
168 Summer savory Satureja hortensis Herbs and Spices Herbs
169 Winter savory Satureja montana Herbs and Spices Herbs
170 Rye Secale cereale Cereals and cereal products Cereals
171 Sesame Sesamum orientale Herbs and Spices Oilseed crops
172 Garden tomato Solanum lycopersicum Vegetables Fruit vegetables
173 Cherry tomato Solanum lycopersicum var. cerasiforme Vegetables Fruit vegetables
174 Garden tomato (var.) Solanum lycopersicum var. lycopersicum Vegetables Fruit vegetables
175 Eggplant Solanum melongena Vegetables Fruit vegetables
176 Potato Solanum tuberosum Vegetables Tubers
177 Rowanberry Sorbus aucuparia Fruits Berries
178 Sorghum Sorghum bicolor Cereals and cereal products Cereals
179 Spinach Spinacia oleracea Vegetables Leaf vegetables
180 Cloves Syzygium aromaticum Herbs and Spices Spices
181 Tamarind Tamarindus indica Fruits Tropical fruits
182 Dandelion Taraxacum officinale Herbs and Spices Herbs
183 Cocoa bean Theobroma cacao Cocoa and cocoa products Cocoa
184 Common thyme Thymus vulgaris Herbs and Spices Herbs
185 Linden Tilia Herbs and Spices Herbs
186 Small-leaf linden Tilia cordata Herbs and Spices Herbs
187 Fenugreek Trigonella foenum-graecum Herbs and Spices Herbs
188 Common wheat Triticum aestivum Cereals and cereal products Cereals
189 Vaccinium (Blueberry, Cranberry, Huckleberry) Vaccinium Fruits Berries
190 Lowbush blueberry Vaccinium angustifolium Fruits Berries
191 Sparkleberry Vaccinium arboreum Fruits Berries
192 Highbush blueberry Vaccinium corymbosum Fruits Berries
193 American cranberry Vaccinium macrocarpon Fruits Berries
194 Bilberry Vaccinium myrtillus Fruits Berries
195 Lingonberry Vaccinium vitis-idaea Fruits Berries
196 Vanilla Vanilla Herbs and Spices Spices
197 Common verbena Verbena officinalis Herbs and Spices Herbs
198 Broad bean Vicia faba Pulses Beans
199 Adzuki bean Vigna angularis Pulses Beans
200 Gram bean Vigna mungo Pulses Beans
201 Mung bean Vigna radiata Pulses Beans
202 Climbing bean Vigna umbellata Pulses Beans
203 Cowpea Vigna unguiculata Pulses Peas
204 Muscadine grape Vitis rotundifolia Fruits Berries
205 Common grape Vitis vinifera Fruits Berries
206 Corn Zea mays Cereals and cereal products Cereals
207 Ginger Zingiber officinale Herbs and Spices Spices
208 Arctic blackberry Rubus arcticus Fruits Berries
209 Banana Musa acuminata Fruits Tropical fruits
210 Bayberry Myrica Fruits Berries
211 Elliott's blueberry Vaccinium elliottii Fruits Berries
212 Canada blueberry Vaccinium myrtilloides Fruits Berries
213 Bog bilberry Vaccinium uliginosum Fruits Berries
214 Buffalo currant Ribes aureum var. villosum Fruits Berries
215 Celeriac Apium graveolens var. rapaceum Vegetables Root vegetables
216 Celery stalks Apium graveolens var. dulce Vegetables Stalk vegetables
217 Chinese chives Allium tuberosum Herbs and Spices Herbs
218 European cranberry Vaccinium oxycoccos Fruits Berries
219 Deerberry Vaccinium stamineum Fruits Berries
220 Ginseng Panax Herbs and Spices Spices
221 Cascade huckleberry Vaccinium deliciosum Fruits Berries
222 Oval-leaf huckleberry Vaccinium ovalifolium Fruits Berries
223 Evergreen huckleberry Vaccinium ovatum Fruits Berries
224 Red huckleberry Vaccinium parvifolium Fruits Berries
225 Longan Dimocarpus longan Fruits Tropical fruits
226 Macadamia nut (M. tetraphylla) Macadamia tetraphylla Nuts Nuts
227 Garden onion (var.) Allium cepa var. cepa Vegetables Onion-family vegetables
228 Summer grape Vitis aestivalis Fruits Berries
229 Fox grape Vitis labrusca Fruits Berries
230 Nectarine Prunus persica var. nucipersica Fruits Drupes
231 Peach (var.) Prunus persica var. persica Fruits Drupes
232 Pepper (C. baccatum) Capsicum baccatum var. baccatum Vegetables Fruit vegetables
233 Pepper (C. chinense) Capsicum chinense Vegetables Fruit vegetables
234 Pepper (Capsicum) Capsicum Vegetables Fruit vegetables
235 Rambutan Nephelium lappaceum Fruits Tropical fruits
236 Red rice Oryza rufipogon Cereals and cereal products Cereals
237 Annual wild rice Zizania aquatica Cereals and cereal products Cereals
238 Swiss chard Beta vulgaris ssp. cicla Vegetables Leaf vegetables
239 Lemon thyme Thymus pulegioides Herbs and Spices Herbs
240 Tronchuda cabbage Brassica oleracea var. costata Vegetables Cabbages
241 Japanese walnut Juglans ailanthifolia Nuts Nuts
242 Welsh onion Allium fistulosum Herbs and Spices Herbs
243 Hard wheat Triticum durum Cereals and cereal products Cereals
244 Shallot Allium ascalonicum Vegetables Onion-family vegetables
245 Rocket salad Eruca vesicaria Vegetables Leaf vegetables
246 Carrot Daucus carota ssp. sativus Vegetables Root vegetables
247 Triticale X Triticosecale rimpaui Cereals and cereal products Cereals
248 Black cabbage Brassica oleracea var. viridis Vegetables Cabbages
249 Half-highbush blueberry Vaccinium angustifolium X Vaccinium corymbosum Fruits Berries
250 Celery leaves Apium graveolens var. secalinum Herbs and Spices Herbs
251 Chicory leaves Cichorium intybus var. foliosum Vegetables Leaf vegetables
252 Komatsuna Brassica rapa var. perviridis Vegetables Cabbages
253 Pak choy Brassica rapa var. chinensis Vegetables Cabbages
254 Napa cabbage Brassica rapa var. pekinensis Vegetables Cabbages
255 Chicory roots Cichorium intybus var. sativum Vegetables Root vegetables
256 Grapefruit/Pummelo hybrid Citrus paradisi X Citrus maxima Fruits Citrus
257 Grapefruit Citrus X paradisi Fruits Citrus
258 Jostaberry Ribes × nidigrolaria Fruits Berries
259 Kai-lan Brassica oleracea var. alboglabra Vegetables Cabbages
260 Italian oregano Origanum X majoricum Herbs and Spices Herbs
261 Oxheart cabbage Brassica oleracea var. conica Vegetables Cabbages
262 Daikon radish Raphanus sativus var. longipinnatus Vegetables Root vegetables
263 Black radish Raphanus sativus var. niger Vegetables Root vegetables
264 Radish (var.) Raphanus sativus var. sativus Vegetables Root vegetables
265 Red beetroot Beta vulgaris var. rubra Vegetables Root vegetables
266 Sweet rowanberry Grataegosorbus mitschurinii Fruits Berries
267 Pineappple sage Salvia elegans Herbs and Spices Herbs
268 Skunk currant Ribes glandulosum Fruits Berries
269 Beer NULL Beverages Fermented beverages
270 Other bread NULL Cereals and cereal products Other breads
271 Breakfast cereal NULL Cereals and cereal products Cereal products
272 Other soy product NULL Soy Soy products
273 Other cereal product NULL Cereals and cereal products Cereal products
274 Pasta NULL Cereals and cereal products Cereal products
275 Biscuit NULL Cereals and cereal products Cereal products
276 Sourdough NULL Cereals and cereal products Doughs
277 Spirit NULL Beverages Distilled beverages
278 Fortified wine NULL Beverages Fortified wines
279 Other alcoholic beverage NULL Beverages Alcoholic beverages
280 Abalone Haliotis Aquatic foods Mollusks
281 Abiyuch Crateva religiosa Fruits Tropical fruits
282 Acerola Malpighia emarginata Fruits Tropical fruits
283 Acorn Quercus Nuts Nuts
284 Winter squash Cucurbita maxima Gourds Gourds
285 Agar Eucheuma Aquatic foods Seaweed
286 Red king crab Paralithodes camtschaticus Aquatic foods Crustaceans
287 Alfalfa Medicago sativa Herbs and Spices Herbs
288 Allspice Pimenta dioica Herbs and Spices Spices
289 Amaranth Amaranthus Herbs and Spices Herbs
290 Arrowhead Sagittaria latifolia Vegetables Tubers
291 Arrowroot Maranta arundinacea Vegetables Tubers
292 Asian pear Pyrus pyrifolia Fruits Pomes
293 Atlantic herring Clupea harengus harengus Aquatic foods Fishes
294 Atlantic mackerel Scomber scombrus Aquatic foods Fishes
295 Painted comber Serranus scriba Aquatic foods Fishes
296 Atlantic pollock Pollachius pollachius Aquatic foods Fishes
297 Atlantic wolffish Anarhichas lupus Aquatic foods Fishes
298 Bamboo shoots Phyllostachys edulis Vegetables Shoot vegetables
299 Striped bass Morone saxatilis Aquatic foods Fishes
300 Beaver Castor canadensis Animal foods Rodents
301 Beech nut Fagus Nuts Nuts
302 Beluga whale Delphinapterus leucas Aquatic foods Cetaceans
303 Bison Bison bison Animal foods Bovines
304 Black bear Ursus americanus Animal foods Other mammals
305 Alaska blackfish Dallia pectoralis Aquatic foods Fishes
306 Blue crab Callinectes sapidus Aquatic foods Crustaceans
307 Blue mussel Mytilus edulis Aquatic foods Mollusks
308 Northern bluefin tuna Thunnus thynnus Aquatic foods Fishes
309 Bluefish Pomatomus saltatrix Aquatic foods Fishes
310 Wild boar Sus scrofa Animal foods Swine
311 Bowhead whale Balaena mysticetus Aquatic foods Cetaceans
312 Breadfruit Artocarpus altilis Fruits Tropical fruits
313 Breadnut tree seed Brosimum alicastrum Herbs and Spices Other seeds
314 Rapini Brassica ruvo Vegetables Cabbages
315 Brown bear Ursus arctos Animal foods Other mammals
316 Buffalo Bubalus bubalis Animal foods Bovines
317 Burbot Lota lota Aquatic foods Fishes
318 Giant butterbur Petasites japonicus Vegetables Other vegetables
319 American butterfish Peprilus triacanthus Aquatic foods Fishes
320 Butternut Juglans cinerea Nuts Nuts
321 Butternut squash Cucurbita moschata Gourds Gourds
322 Calabash Lagenaria siceraria Gourds Gourds
323 Cardoon Cynara cardunculus Vegetables Shoot vegetables
324 Caribou Rangifer tarandus Animal foods Venison
325 Natal plum Carissa macrocarpa Fruits Tropical fruits
326 Carob Ceratonia siliqua Vegetables Other vegetables
327 Common carp Cyprinus carpio Aquatic foods Fishes
328 Cassava Manihot esculenta Vegetables Tubers
329 Channel catfish Ictalurus punctatus Aquatic foods Fishes
330 Chayote Sechium edule Gourds Gourds
331 Cherimoya Annona cherimola Fruits Tropical fruits
332 Chervil Anthriscus cerefolium Herbs and Spices Spices
333 Chia Salvia hispanica Herbs and Spices Other seeds
334 Chicken (Cock, Hen, Rooster) Gallus gallus Animal foods Poultry
335 Chinese broccoli Brassica alboglabra Vegetables Cabbages
336 Chinese chestnut Castanea mollissima Nuts Nuts
337 Chinese water chestnut Eleocharis dulcis Vegetables Other vegetables
338 Garland chrysanthemum Chrysanthemum coronarium Vegetables Leaf vegetables
339 Cisco Coregonus artedi Aquatic foods Fishes
340 Nuttall cockle Clinocardium nuttallii Aquatic foods Mollusks
341 Coconut Cocos nucifera Fruits Tropical fruits
342 Pacific cod Gadus macrocephalus Aquatic foods Fishes
343 Atlantic cod Gadus morhua Aquatic foods Fishes
344 Common octopus Octopus vulgaris Aquatic foods Mollusks
345 Corn salad Valerianella locusta Vegetables Leaf vegetables
346 Cottonseed Gossypium Herbs and Spices Oilseed crops
347 Catjang pea Vigna unguiculata ssp. cylindrica Pulses Peas
348 Malus (Crab apple) Malus Fruits Pomes
349 Squashberry Viburnum edule Fruits Berries
350 Atlantic croaker Micropogonias undulatus Aquatic foods Fishes
351 Cusk Brosme brosme Aquatic foods Fishes
352 Cuttlefish Sepiidae Aquatic foods Mollusks
353 Mule deer Odocoileus Animal foods Venison
354 Devilfish Myoxocephalus Aquatic foods Fishes
355 Dock Rumex Herbs and Spices Herbs
356 Dolphin fish Coryphaena hippurus Aquatic foods Fishes
357 Freshwater drum Aplodinotus grunniens Aquatic foods Fishes
358 Mallard duck Anas platyrhynchos Animal foods Poultry
359 Dungeness crab Cancer magister Aquatic foods Crustaceans
360 Durian Durio zibethinus Fruits Tropical fruits
361 Eastern oyster Crassostrea virginica Aquatic foods Mollusks
362 Freshwater eel Anguilla Aquatic foods Fishes
363 Elderberry Sambucus Fruits Berries
364 Elk Cervus canadensis Animal foods Venison
365 Emu Dromaius novaehollandiae Animal foods Poultry
366 Oregon yampah Perideridia oregana Vegetables Root vegetables
367 European anchovy Engraulis encrasicolus Aquatic foods Fishes
368 European chestnut Castanea sativa Nuts Nuts
369 Turbot Scophthalmus maximus Aquatic foods Fishes
370 Fireweed Chamerion angustifolium Herbs and Spices Herbs
371 Florida pompano Trachinotus carolinus Aquatic foods Fishes
372 Ginkgo nuts Ginkgo biloba Herbs and Spices Other seeds
373 Greylag goose Anser anser Animal foods Poultry
374 Grape Vitis Fruits Berries
375 Greenland halibut/turbot Reinhardtius hippoglossoides Aquatic foods Fishes
376 Groundcherry Physalis Vegetables Fruit vegetables
377 Grouper Epinephelus Aquatic foods Fishes
378 Guinea hen Numida meleagris Animal foods Poultry
379 Haddock Melanogrammus aeglefinus Aquatic foods Fishes
380 Hippoglossus (Common halibut) Hippoglossus Aquatic foods Fishes
381 Hazelnut Corylus Nuts Nuts
382 Hickory nut Carya Nuts Nuts
383 Horse Equus caballus Animal foods Equines
384 Horseradish tree Moringa oleifera Vegetables Other vegetables
385 Alaska blueberry Vaccinium alaskaense Fruits Berries
386 Hyacinth bean Lablab purpureus Pulses Beans
387 Irish moss Chondrus crispus Aquatic foods Seaweed
388 Pacific jack mackerel Trachurus symmetricus Aquatic foods Fishes
389 Jackfruit Artocarpus heterophyllus Fruits Tropical fruits
390 Japanese chestnut Castanea crenata Nuts Nuts
391 Java plum Syzygium cumini Fruits Tropical fruits
392 Jerusalem artichoke Helianthus tuberosus Vegetables Tubers
393 Jujube Ziziphus zizyphus Fruits Other fruits
394 Jute Corchorus olitorius Vegetables Leaf vegetables
395 Kale Brassica napus var. pabularia Vegetables Cabbages
396 Kelp Laminaria Aquatic foods Seaweed
397 King mackerel Scomberomorus cavalla Aquatic foods Fishes
398 Kumquat Fortunella Fruits Tropical fruits
399 Lambsquarters Chenopodium album Vegetables Leaf vegetables
400 Leather chiton Katharina tunicata Aquatic foods Mollusks
401 Wild leek Allium ampeloprasum Vegetables Onion-family vegetables
402 Common ling Molva molva Aquatic foods Fishes
403 Lingcod Ophiodon elongatus Aquatic foods Fishes
404 American lobster Homarus americanus Aquatic foods Crustaceans
405 Loganberry Rubus loganobaccus Fruits Berries
406 Lotus Nelumbo Herbs and Spices Other seeds
407 Sacred lotus Nelumbo nucifera Vegetables Other vegetables
408 White lupine Lupinus albus Pulses Other pulses
409 Malabar spinach Basella alba Vegetables Leaf vegetables
410 Mammee apple Mammea americana Fruits Tropical fruits
411 Purple mangosteen Garcinia mangostana Fruits Tropical fruits
412 Alpine sweetvetch Hedysarum alpinum Vegetables Root vegetables
413 Milkfish Chanos chanos Aquatic foods Fishes
414 Monkfish Lophius piscatorius Aquatic foods Fishes
415 Moose Alces alces Animal foods Venison
416 Moth bean Vigna aconitifolia Pulses Beans
417 Mountain yam Dioscorea pentaphylla Vegetables Tubers
418 Striped mullet Mugil cephalus Aquatic foods Fishes
419 Muskrat Ondatra zibethicus Animal foods Rodents
420 White mustard Sinapis alba Herbs and Spices Spices
421 Mustard spinach Brassica perviridis Vegetables Cabbages
422 New Zealand spinach Tetragonia tetragonioides Vegetables Leaf vegetables
423 Nopal Opuntia cochenillifera Vegetables Other vegetables
424 Ocean pout Zoarces americanus Aquatic foods Fishes
425 North Pacific giant octopus Enteroctopus dofleini Aquatic foods Mollusks
426 Ohelo berry Vaccinium reticulatum Fruits Berries
427 Okra Abelmoschus esculentus Vegetables Other vegetables
428 Tunicate Tunicata Aquatic foods Other aquatic foods
429 Opossum Didelphis virginiana Animal foods Marsupials
430 Ostrich Struthio camelus Animal foods Poultry
431 Spotted seal Phoca largha Aquatic foods Pinnipeds
432 Pacific herring Clupea pallasii Aquatic foods Fishes
433 Pacific oyster Crassostrea gigas Aquatic foods Mollusks
434 Pacific rockfish Sebastes Aquatic foods Fishes
435 Velvet duck Melanitta fusca Animal foods Poultry
436 Pepper (C. frutescens) Capsicum annuum var. annuum Vegetables Fruit vegetables
437 Common persimmon Diospyros virginiana Fruits Tropical fruits
438 Pheasant Phasianus colchicus Animal foods Poultry
439 Northern pike Esox lucius Aquatic foods Fishes
440 Pili nut Canarium ovatum Nuts Nuts
441 Colorado pinyon Pinus edulis Nuts Nuts
442 Pitanga Eugenia uniflora Fruits Tropical fruits
443 Plains prickly pear Opuntia macrorhiza Fruits Tropical fruits
444 French plantain Musa X paradisiaca Fruits Tropical fruits
445 American pokeweed Phytolacca americana Vegetables Shoot vegetables
446 Polar bear Ursus maritimus Animal foods Other mammals
447 Opium poppy Papaver somniferum Herbs and Spices Spices
448 Prairie turnip Pediomelum esculentum Vegetables Root vegetables
449 Prickly pear Opuntia Fruits Tropical fruits
450 Quinoa Chenopodium quinoa Herbs and Spices Other seeds
451 European rabbit Oryctolagus Animal foods Lagomorphs
452 Raccoon Procyon lotor Animal foods Other mammals
453 Rainbow smelt Osmerus mordax Aquatic foods Fishes
454 Rainbow trout Oncorhynchus mykiss Aquatic foods Fishes
455 Malabar plum Syzygium jambos Fruits Tropical fruits
456 Rose hip Rosa Herbs and Spices Herbs
457 Roselle Hibiscus sabdariffa Herbs and Spices Herbs
458 Orange roughy Hoplostethus atlanticus Aquatic foods Fishes
459 Sablefish Anoplopoma fimbria Aquatic foods Fishes
460 Pink salmon Oncorhynchus gorbuscha Aquatic foods Fishes
461 Chum salmon Oncorhynchus keta Aquatic foods Fishes
462 Coho salmon Oncorhynchus kisutch Aquatic foods Fishes
463 Sockeye salmon Oncorhynchus nerka Aquatic foods Fishes
464 Chinook salmon Oncorhynchus tshawytscha Aquatic foods Fishes
465 Atlantic salmon Salmo salar Aquatic foods Fishes
466 Salmonberry Rubus spectabilis Fruits Berries
467 Common salsify Tragopogon porrifolius Vegetables Root vegetables
468 Sapodilla Manilkara zapota Fruits Tropical fruits
469 Mamey sapote Pouteria sapota Fruits Tropical fruits
470 Spanish mackerel Scomberomorus maculatus Aquatic foods Fishes
471 Pacific sardine Sardinops sagax Aquatic foods Fishes
472 Scallop Pectinidae Aquatic foods Mollusks
473 Scup Stenotomus chrysops Aquatic foods Fishes
474 Sea cucumber Parastichopus californicus Aquatic foods Other aquatic foods
475 Steller sea lion Eumetopias jubatus Aquatic foods Pinnipeds
476 Bearded seal Erignathus barbatus Aquatic foods Pinnipeds
477 Ringed seal Pusa hispida Aquatic foods Pinnipeds
478 Seatrout Cynoscion Aquatic foods Fishes
479 Sesbania flower Sesbania bispinosa Vegetables Other vegetables
480 American shad Alosa sapidissima Aquatic foods Fishes
481 Shark Squaliformes Aquatic foods Fishes
482 Sheefish Stenodus leucichthys Aquatic foods Fishes
483 Sheep (Mutton, Lamb) Ovis aries Animal foods Ovis
484 Sheepshead Archosargus probatocephalus Aquatic foods Fishes
485 Hedge mustard Sisymbrium Herbs and Spices Other seeds
486 Skipjack tuna Katsuwonus pelamis Aquatic foods Fishes
487 Snapper Lutjanidae Aquatic foods Fishes
488 Soursop Annona muricata Fruits Tropical fruits
489 Spelt Triticum spelta Cereals and cereal products Cereals
490 Spirulina Spirulina Aquatic foods Seaweed
491 Squab Columba Animal foods Poultry
492 Squirrel Sciuridae Animal foods Rodents
493 Strawberry guava Psidium cattleianum Fruits Berries
494 Greater sturgeon Acipenser Aquatic foods Fishes
495 White sucker Catostomus commersonii Aquatic foods Fishes
496 Sugar apple Annona squamosa Fruits Tropical fruits
497 Pumpkinseed sunfish Lepomis gibbosus Aquatic foods Fishes
498 Swordfish Xiphias gladius Aquatic foods Fishes
499 Taro Colocasia esculenta Vegetables Root vegetables
500 Teff Eragrostis tef Herbs and Spices Herbs
501 Tilefish Lopholatilus chamaeleonticeps Aquatic foods Fishes
502 Mexican groundcherry Physalis philadelphica var. immaculata Vegetables Fruit vegetables
503 Towel gourd Luffa aegyptiaca Gourds Gourds
504 Salmonidae (Salmon, Trout) Salmonidae Aquatic foods Fishes
505 Turkey Meleagris gallopavo Animal foods Poultry
506 Cattle (Beef, Veal) Bos taurus Animal foods Bovines
507 Walleye Sander vitreus Aquatic foods Fishes
508 Alaska pollock Theragra chalcogramma Aquatic foods Fishes
509 Wasabi Wasabia japonica Herbs and Spices Spices
510 Wax gourd Benincasa hispida Gourds Gourds
511 Whelk Buccinidae Aquatic foods Mollusks
512 Coalfish pollock Pollachius virens Aquatic foods Fishes
513 Broad whitefish Coregonus nasus Aquatic foods Fishes
514 Whitefish Coregonus Aquatic foods Fishes
515 Whiting Merlangius merlangus Aquatic foods Fishes
516 Wild rice Zizania Cereals and cereal products Cereals
517 Tea leaf willow Salix pulchra Herbs and Spices Herbs
518 Winged bean Psophocarpus tetragonolobus Pulses Beans
519 Yam Dioscorea Vegetables Tubers
520 Jicama Pachyrhizus erosus Vegetables Root vegetables
521 Yautia Xanthosoma sagittifolium Vegetables Leaf vegetables
522 Yellowfin tuna Thunnus albacares Aquatic foods Fishes
523 Yellowtail amberjack Seriola lalandi Aquatic foods Fishes
524 Pollock Pollachius Aquatic foods Fishes
525 Albacore tuna Thunnus alalunga Aquatic foods Fishes
526 Gadus (Common cod) Gadus Aquatic foods Fishes
527 Atlantic halibut Hippoglossus hippoglossus Aquatic foods Fishes
528 Pacific halibut Hippoglossus stenolepis Aquatic foods Fishes
529 Pacific salmon Oncorhynchus Aquatic foods Fishes
530 Smelt Osmeridae Aquatic foods Fishes
531 Clupeinae (Herring, Sardine, Sprat) Clupeinae Aquatic foods Fishes
532 Spiny lobster Palinuridae Aquatic foods Crustaceans
533 Snow crab Chionoecetes opilio Aquatic foods Crustaceans
534 Black-eyed pea Vigna unguiculata ssp. unguiculata Pulses Peas
535 Deer Cervidae Animal foods Venison
536 Macadamia nut Macadamia Nuts Nuts
537 Percoidei (Bass and others) Percoidei Aquatic foods Fishes
538 Perciformes (Perch-like fishes) Perciformes Aquatic foods Fishes
539 Arctic ground squirrel Urocitellus parryii Animal foods Rodents
540 Rabbit Leporidae Animal foods Lagomorphs
541 Domestic goat Capra aegagrus hircus Animal foods Caprae
542 Beefalo Bos taurus X Bison bison Animal foods Bovines
543 Antelope Artiodactyla Animal foods Venison
544 Bivalvia (Clam, Mussel, Oyster) Bivalvia Aquatic foods Mollusks
545 Squid Teuthida Aquatic foods Mollusks
546 Shrimp Caridea Aquatic foods Crustaceans
547 Crayfish Astacidea Aquatic foods Crustaceans
548 Flatfish Pleuronectiformes Aquatic foods Fishes
549 Domestic pig (Piglet, Pork) Sus scrofa domestica Animal foods Swine
550 Walrus Odobenus rosmarus Aquatic foods Pinnipeds
551 Alaska wild rhubarb Polygonum alpinum Vegetables Stalk vegetables
552 Oriental wheat Triticum turanicum Cereals and cereal products Cereals
553 Yardlong bean Vigna unguiculata ssp. sesquipedalis Pulses Peas
554 Great horned owl Bubo virginianus Animal foods Poultry
555 Quail Phasianidae Animal foods Poultry
556 Boysenberry Rubus ursinus X idaeus Fruits Berries
557 Persian lime Citrus latifolia Fruits Citrus
558 Feijoa Feijoa sellowiana Fruits Tropical fruits
559 Rowal Pangium edule Herbs and Spices Other seeds
560 Jew's ear Auricularia auricula-judae Vegetables Mushrooms
561 Common mushroom Agaricus bisporus Vegetables Mushrooms
562 Shiitake Lentinus edodes Vegetables Mushrooms
563 Purple laver Porphyra laciniata Aquatic foods Seaweed
564 Wakame Undaria pinnatifida Aquatic foods Seaweed
565 Enokitake Flammulina velutipes Vegetables Mushrooms
566 Epazote Dysphania ambrosioides Herbs and Spices Herbs
567 Oyster mushroom Pleurotus ostreatus Vegetables Mushrooms
568 Cloud ear fungus Auricularia polytricha Vegetables Mushrooms
569 Maitake Grifola frondosa Vegetables Mushrooms
570 Ostrich fern Matteuccia struthiopteris Vegetables Leaf vegetables
571 Spot croaker Leiostomus xanthurus Aquatic foods Fishes
572 Sourdock Rumex articus Herbs and Spices Herbs
573 Tinda Citrullus lanatus var. fistulosus Gourds Gourds
574 Atlantic menhaden Brevoortia tyrannus Aquatic foods Fishes
575 Wheat Triticum Cereals and cereal products Cereals
576 Common chokecherry Prunus virginiana Fruits Drupes
577 Agave Agave Vegetables Other vegetables
578 Narrowleaf cattail Typha angustifolia Vegetables Other vegetables
579 Jellyfish Scyphozoa Aquatic foods Other aquatic foods
580 Anchovy Engraulidae Aquatic foods Fishes
581 Blue whiting Micromesistius poutassou Aquatic foods Fishes
582 Carp bream Abramis brama Aquatic foods Fishes
583 Chanterelle Cantharellus cibarius Vegetables Mushrooms
584 Sturgeon Acipenseridae Aquatic foods Fishes
585 Charr Salvelinus Aquatic foods Fishes
586 Cinnamon Cinnamomum Herbs and Spices Spices
587 Crab Brachyura Aquatic foods Crustaceans
588 Common dab Limanda limanda Aquatic foods Fishes
589 Spiny dogfish Squalus acanthias Aquatic foods Fishes
590 Anatidae (Duck, Goose, Swan) Anatidae Animal foods Poultry
591 Anguilliformes (Eel) Anguilliformes Aquatic foods Fishes
592 True frog Ranidae Aquatic foods Amphibians
593 Garfish Belone belone Aquatic foods Fishes
594 Gadiformes (Cod, Hake) Gadiformes Aquatic foods Fishes
595 Mountain hare Lepus timidus Animal foods Lagomorphs
596 Lake trout Salvelinus namaycush Aquatic foods Fishes
597 Lemon sole Microstomus kitt Aquatic foods Fishes
598 Clawed lobster Nephropidae Aquatic foods Crustaceans
599 Lumpsucker Cyclopteridae Aquatic foods Fishes
600 Scombridae (Bonito, Mackerel, Tuna) Scombridae Aquatic foods Fishes
601 Marine mussel Mytilidae Aquatic foods Mollusks
602 Norway haddock Sebastes viviparus Aquatic foods Fishes
603 Norway lobster Nephrops norvegicus Aquatic foods Crustaceans
604 Norway pout Trisopterus esmarkii Aquatic foods Fishes
605 Oil palm Elaeis Herbs and Spices Oilseed crops
606 True oyster Ostreidae Aquatic foods Mollusks
607 Sago palm Metroxylon sagu Herbs and Spices Oilseed crops
608 Persimmon Diospyros Fruits Tropical fruits
609 Pikeperch Sander lucioperca Aquatic foods Fishes
610 Pleuronectidae (Dab, Halibut, Plaice) Pleuronectidae Aquatic foods Fishes
611 Rock ptarmigan Lagopus muta Animal foods Poultry
612 Pacific ocean perch Sebastes alutus Aquatic foods Fishes
613 Black salsify Scorzonera hispanica Vegetables Root vegetables
614 True seal Phocidae Aquatic foods Pinnipeds
615 Red algae Rhodophyta Aquatic foods Seaweed
616 Kombu Saccharina japonica Aquatic foods Seaweed
617 Snail Gastropoda Aquatic foods Mollusks
618 True sole Soleidae Aquatic foods Fishes
619 Catfish Siluriformes Aquatic foods Fishes
620 Thistle Cirsium Vegetables Root vegetables
621 Thunnus (Common tuna) Thunnus Aquatic foods Fishes
622 Walnut Juglans Nuts Nuts
623 Cetacea (Dolphin, Porpoise, Whale) Cetacea Aquatic foods Cetaceans
624 Columbidae (Dove, Pigeon) Columbidae Animal foods Poultry
625 Conch Strombidae Aquatic foods Mollusks
626 Grape wine NULL Beverages Fermented beverages
627 Berry wine NULL Beverages Fermented beverages
628 Other wine NULL Beverages Fermented beverages
629 Apple cider NULL Beverages Fermented beverages
630 Liquor NULL Beverages Distilled beverages
631 Cheese NULL Milk and milk products Fermented milk products
632 Milk (Cow) Milk and milk products Unfermented milks
633 Eggs NULL Eggs Eggs
634 Yogurt NULL Milk and milk products Fermented milk products
635 Bean NULL Pulses Beans
636 Vodka NULL Beverages Distilled beverages
637 Whisky NULL Beverages Distilled beverages
638 Ice cream NULL Confectioneries Frozen desserts
639 Gin NULL Beverages Distilled beverages
640 Honey NULL Confectioneries Other confectioneries
641 Liquorice NULL Confectioneries Candies
642 Vinegar NULL Baking goods Seasonings
643 Rum NULL Beverages Distilled beverages
644 Port wine NULL Beverages Fortified wines
645 Vermouth NULL Beverages Fortified wines
646 Sherry NULL Beverages Fortified wines
647 Madeira wine NULL Beverages Fortified wines
648 Nougat NULL Confectioneries Other confectioneries
649 Toffee NULL Confectioneries Other confectioneries
650 Cake NULL Confectioneries Desserts
651 Pizza NULL Dishes Other dishes
652 Ymer NULL Milk and milk products Fermented milk products
653 Other snack food NULL Snack foods Snack foods
654 Crisp bread NULL Cereals and cereal products Flat breads
655 Pastry NULL Confectioneries Desserts
656 Dragée NULL Confectioneries Candies
657 Chewing gum NULL Confectioneries Candies
658 Marzipan NULL Confectioneries Other confectioneries
659 Salad dressing NULL Baking goods Dressings
660 Sauce NULL Baking goods Sauces
661 Salt NULL Baking goods Seasonings
662 Butter NULL Milk and milk products Other milk products
663 Butter substitute NULL Baking goods Substitutes
664 Cream NULL Milk and milk products Other milk products
665 Sugar NULL Baking goods Sugars
666 Sausage NULL Dishes Ground meat
667 Meatball NULL Dishes Ground meat
668 Mustard NULL Baking goods Condiments
669 Pate NULL Dishes Ground meat
670 Sugar substitute NULL Baking goods Substitutes
671 Meat bouillon NULL Baking goods Baking goods
672 Other meat product NULL Animal foods Meat products
673 Whey NULL Milk and milk products Other milk products
674 Casein NULL Milk and milk products Other milk products
675 Fruit preserve NULL Fruits Fruit products
676 Leavening agent NULL Baking goods Baking goods
677 Marshmallow NULL Confectioneries Candies
678 Gelatin NULL Baking goods Baking goods
679 Water NULL Beverages Waters
680 Other fish product NULL Aquatic foods Fish products
681 Milk (Human) NULL Milk and milk products Unfermented milks
682 Other beverage NULL Beverages Other beverages
683 Baby food NULL Baby foods Baby foods
684 Dumpling NULL Dishes Other dishes
685 Soup NULL Dishes Other dishes
686 Other vegetable product NULL Vegetables Vegetable products
687 Unclassified food or beverage NULL Unclassified Unclassified
688 Syrup NULL Baking goods Baking goods
689 Tallow NULL Fats and oils Animal fats
690 Remoulade NULL Baking goods Condiments
691 Chocolate spread NULL Confectioneries Spreads
692 Fruit gum NULL Confectioneries Candies
693 Curry powder NULL Herbs and Spices Herb and spice mixtures
694 Other candy NULL Confectioneries Candies
695 Meringue NULL Confectioneries Other confectioneries
696 Lard NULL Fats and oils Animal fats
697 Other animal fat NULL Fats and oils Animal fats
698 Other cocoa product NULL Cocoa and cocoa products Cocoa products
699 Cocoa butter NULL Cocoa and cocoa products Cocoa products
700 Cocoa powder NULL Cocoa and cocoa products Cocoa products
701 Cocoa liquor NULL Cocoa and cocoa products Cocoa products
702 Chocolate NULL Cocoa and cocoa products Cocoa products
703 Hot chocolate NULL Cocoa and cocoa products Cocoa products
704 Dried milk NULL Milk and milk products Other milk products
705 Milk (Other mammals) NULL Milk and milk products Unfermented milks
706 Kefir NULL Milk and milk products Fermented milks
707 Buttermilk NULL Milk and milk products Fermented milks
708 Other fermented milk NULL Milk and milk products Fermented milks
709 Soy sauce NULL Soy Soy products
710 Miso NULL Soy Soy products
711 Tofu NULL Soy Soy products
712 Zwieback NULL Cereals and cereal products Leavened breads
713 Roe NULL Aquatic foods Roe
714 Cichlidae (Tilapia) Cichlidae Aquatic foods Fishes
715 Icing NULL Confectioneries Other confectioneries
716 Snack bar NULL Snack foods Snack foods
717 Green turtle Chelonia mydas Aquatic foods Other aquatic foods
718 Energy drink NULL Beverages Nutritional beverages
719 Burrito NULL Dishes Tex-Mex cuisine
720 Hamburger NULL Dishes Sandwiches
721 Baked beans NULL Dishes Other dishes
722 Chili NULL Dishes Tex-Mex cuisine
723 Taco NULL Dishes Tex-Mex cuisine
724 Tortilla NULL Cereals and cereal products Flat breads
725 Nachos NULL Dishes Tex-Mex cuisine
726 Processed cheese NULL Milk and milk products Fermented milk products
727 Salad NULL Dishes Other dishes
728 Cream substitute NULL Baking goods Substitutes
729 Dulce de leche NULL Confectioneries Spreads
730 Topping NULL Baking goods Baking goods
731 Sweet custard NULL Confectioneries Milk desserts
732 Egg roll NULL Dishes Asian cuisine
733 Heart of palm NULL Vegetables Other vegetables
734 Popcorn NULL Snack foods Snack foods
735 Potato chip NULL Snack foods Snack foods
736 Tortilla chip NULL Snack foods Snack foods
737 Corn chip NULL Snack foods Snack foods
738 Hibiscus tea Hibiscus sabbariffa Teas Herbal teas
739 Stew NULL Dishes Other dishes
740 Gelatin dessert NULL Confectioneries Desserts
741 Junket NULL Confectioneries Milk desserts
742 Falafel NULL Dishes Other dishes
743 Frybread NULL Dishes Other dishes
744 Other frozen dessert NULL Confectioneries Frozen desserts
745 Lasagna NULL Dishes Pasta dishes
746 Morchella (Morel) Morchellaceae Vegetables Mushrooms
747 Pancake NULL Dishes Other dishes
748 Pectin NULL Baking goods Baking goods
749 Pudding NULL Confectioneries Desserts
750 Waffle NULL Dishes Other dishes
751 Soy milk NULL Soy Soy products
752 Meatloaf NULL Dishes Ground meat
753 Sake NULL Beverages Fermented beverages
754 Cocktail NULL Beverages Alcoholic beverages
755 Couscous NULL Dishes Berber cuisine
756 Bulgur NULL Cereals and cereal products Cereal products
757 Coffee substitute NULL Baking goods Substitutes
758 Coffee mocha NULL Coffee and coffee products Coffee products
759 Chimichanga NULL Dishes Mexican cuisine
760 Semolina NULL Cereals and cereal products Cereal products
761 Tapioca pearl NULL Baking goods Baking goods
762 Tostada NULL Dishes Mexican cuisine
763 Quesadilla NULL Dishes Mexican cuisine
764 Baked potato NULL Dishes Potato dishes
765 Hot dog NULL Dishes Sandwiches
766 Spread NULL Baking goods Baking goods
767 Enchilada NULL Dishes Mexican cuisine
768 Egg substitute NULL Baking goods Substitutes
769 Nutritional drink NULL Beverages Nutritional beverages
770 Other sandwich NULL Dishes Sandwiches
771 Ketchup NULL Baking goods Condiments
772 Breakfast sandwich NULL Dishes Sandwiches
773 Adobo NULL Baking goods Seasonings
774 Macaroni and cheese NULL Dishes Pasta dishes
775 Butterfat NULL Milk and milk products Other milk products
776 Horned melon Cucumis metuliferus Gourds Gourds
777 Hushpuppy NULL Dishes American cuisine
778 Fruit juice NULL Beverages Other beverages
779 Relish NULL Baking goods Condiments
780 Other fruit product NULL Fruits Fruit products
781 Fruit salad NULL Fruits Fruit products
782 Soy yogurt NULL Soy Soy products
783 Vegetarian food NULL Dishes Other dishes
784 Veggie burger NULL Dishes Sandwiches
785 Cold cut NULL Dishes Ground meat
786 Mixed nuts NULL Nuts Nuts
787 Canola NULL Herbs and spices Oilseed crops
788 Babassu palm Attalea speciosa Herbs and Spices Oilseed crops
789 Cupuaçu Theobroma grandiflorum Herbs and Spices Oilseed crops
790 Shea tree Vitellaria paradoxa Herbs and Spices Oilseed crops
791 Oil-seed Camellia Camellia oleifera Herbs and Spices Oilseed crops
792 Ucuhuba Virola surinamensis Herbs and Spices Oilseed crops
793 Phyllo dough NULL Baking goods Baking goods
794 Cooking oil NULL Baking goods Baking goods
795 Pie crust NULL Baking goods Wrappers
796 Pie filling NULL Baking goods Baking goods
797 Pie NULL Confectioneries Desserts
798 Shortening NULL Fats and oils Vegetable fats
799 Soy cream NULL Soy Soy products
800 Ice cream cone NULL Baking goods Wrappers
801 Molasses NULL Baking goods Baking goods
802 Cracker NULL Snack foods Snack foods
803 Nance Byrsonima crassifolia Fruits Tropical fruits
804 Naranjilla Solanum quitoense Fruits Tropical fruits
805 Natto NULL Soy Soy products
806 Ravioli NULL Dishes Pasta dishes
807 Scrapple NULL Dishes American cuisine
808 Other pasta dish NULL Dishes Pasta dishes
809 Succotash NULL Dishes American cuisine
810 Tamale NULL Dishes Latin American cuisine
811 Rice cake NULL Dishes Asian cuisine
812 Tree fern Cyathea Vegetables Other vegetables
813 Evaporated milk NULL Milk and milk products Other milk products
814 Flour NULL Cereals and cereal products Cereal products
815 Akutaq NULL Confectioneries Desserts
816 Dough NULL Cereals and cereal products Doughs
817 Pita bread NULL Cereals and cereal products Flat breads
818 Focaccia NULL Cereals and cereal products Flat breads
819 Bagel NULL Cereals and cereal products Leavened breads
820 Other bread product NULL Cereals and cereal products Bread products
821 Piki bread NULL Cereals and cereal products Flat breads
822 French toast NULL Cereals and cereal products Leavened breads
823 Wheat bread NULL Cereals and cereal products Leavened breads
824 Rye bread NULL Cereals and cereal products Leavened breads
825 Oat bread Cereals and cereal products Leavened breads
826 Potato bread NULL Cereals and cereal products Other breads
827 Cornbread NULL Cereals and cereal products Flat breads
828 Corn grits NULL Cereals and cereal products Cereal products
829 Multigrain bread NULL Cereals and cereal products Leavened breads
830 Rice bread NULL Cereals and cereal products Leavened breads
831 Pan dulce NULL Cereals and cereal products Leavened breads
832 Raisin bread NULL Cereals and cereal products Sweet breads
833 Wonton wrapper NULL Baking goods Wrappers
834 Trail mix NULL Snack foods Snack foods
835 Greenthread tea Thelesperma Teas Herbal teas
836 Fruit-flavor drink NULL Beverages Other beverages
837 Vegetable juice NULL Beverages Other beverages
838 Horchata NULL Beverages Other beverages
839 Soft drink NULL Beverages Other beverages
840 Frozen yogurt NULL Confectioneries Frozen desserts
841 Milkshake NULL Confectioneries Frozen desserts
842 Chocolate mousse NULL Confectioneries Desserts
843 Dripping NULL Fats and oils Animal fats
844 Pupusa NULL Dishes Latin American cuisine
845 Empanada NULL Dishes Latin American cuisine
846 Arepa NULL Dishes Latin American cuisine
847 Ascidians Ascidiacea Aquatic foods Other aquatic foods
848 Gefilte fish NULL Dishes Jewish cuisine
849 Yellow pond-lily Nuphar lutea Herbs and Spices Herbs
850 Fish burger NULL Dishes Sandwiches
851 Other dish NULL Dishes Other dishes
852 Pot pie NULL Dishes Other dishes
853 Stuffing NULL Baking goods Baking goods
854 Edible shell NULL Baking goods Wrappers
855 Fudge NULL Confectioneries Candies
856 Candy bar NULL Confectioneries Candies
857 Condensed milk NULL Milk and milk products Other milk products
858 Margarine NULL Fats and oils Vegetable fats
859 Margarine-like spread NULL Fats and oils Vegetable fats
860 Hummus NULL Dishes Levantine cuisine
861 Potato puffs NULL Dishes Potato dishes
862 Potato gratin NULL Dishes Potato dishes
863 Milk substitute NULL Baking goods Substitutes
864 Pepper (C. pubescens) Capsicum pubescens Vegetables Fruit vegetables
865 Soft-necked garlic Allium sativum L. var. sativum Herbs and Spices Herbs
866 Cabbage Brassica oleracea var. capitata Vegetables Cabbages
867 Chinese bayberry Myrica rubra Fruits Berries
868 Mushrooms NULL Vegetables Mushrooms
869 Alcoholic beverages NULL Beverages Alcoholic beverages
870 Onion-family vegetables NULL Vegetables Onion-family vegetables
871 Pomes NULL Fruits Pomes
872 Brassicas NULL Vegetables Brassicas
873 Cereals and cereal products NULL Cereals and cereal products Cereals and cereal products
874 Citrus NULL Fruits Citrus
875 Cocoa and cocoa products NULL Cocoa and cocoa products Cocoa and cocoa products
876 Coffee and coffee products NULL Coffee and coffee products Coffee and coffee products
877 Crustaceans NULL Aquatic foods Crustaceans
878 Milk and milk products NULL Milk and milk products Milk and milk products
879 Fats and oils NULL Fats and oils Fats and oils
880 Fishes NULL Aquatic foods Fishes
881 Herbs and Spices NULL Herbs and Spices Herbs and Spices
882 Pulses Pulses Pulses
883 Animal foods NULL Animal foods Animal foods
884 Mollusks NULL Aquatic foods Mollusks
885 Nuts NULL Nuts Nuts
886 Beverages NULL Beverages Beverages
887 Fruits NULL Fruits Fruits
888 Green vegetables NULL Vegetables Green vegetables
889 Root vegetables NULL Vegetables Root vegetables
890 Sunburst squash (pattypan squash) Cucurbita pepo var. clypeata Gourds Gourds
891 Green zucchini Cucurbita pepo var. cylindrica Gourds Gourds
892 Yellow zucchini Cucurbita pepo var. cylindrica Gourds Gourds
893 Green bell pepper Capsicum annuum Vegetables Fruit vegetables
894 Yellow bell pepper Capsicum annuum Vegetables Fruit vegetables
895 Orange bell pepper Capsicum annuum Vegetables Fruit vegetables
896 Red bell pepper Capsicum annuum Vegetables Fruit vegetables
897 Italian sweet red pepper Capsicum annuum Vegetables Fruit vegetables
898 Yellow wax bean Phaseolus vulgaris Pulses Beans
899 Green bean Phaseolus vulgaris Pulses Beans
900 Saskatoon berry Amelanchier alnifolia Fruits Berries
901 Nanking cherry Prunus tomentosa Fruits Berries
902 Japanese pumpkin Cucurbita maxima Gourds Gourds
903 White cabbage Brassica oleracea L. var. capitata L. f. alba DC. Vegetables Cabbages
904 Romaine lettuce Lactuca sativa L. var. longifolia Vegetables Leaf vegetables
905 dumplings
906 muesli
907 milk

5000
assets/gsm_nr_01.list Normal file

File diff suppressed because it is too large Load Diff

5000
assets/gsm_nr_02.list Normal file

File diff suppressed because it is too large Load Diff

5000
assets/gsm_nr_03.list Normal file

File diff suppressed because it is too large Load Diff

5000
assets/gsm_nr_04.list Normal file

File diff suppressed because it is too large Load Diff

BIN
assets/jpeg_ext.tar Normal file

Binary file not shown.

View File

@ -0,0 +1,4 @@
[Network]
VirtualEthernet=yes
Private=yes
Bridge=br0

34
assets/nspawn/full.yaml Normal file
View File

@ -0,0 +1,34 @@
{{- $architecture := or .architecture "amd64" -}}
{{- $suite := or .suite "bullseye" -}}
{{ $image := or .image (printf "debian_full-%s-%s.tgz" $suite $architecture) }}
architecture: {{ $architecture }}
actions:
- action: debootstrap
suite: {{ $suite }}
components:
- main
mirror: http://deb.debian.org/debian
# variant: minbase
- action: apt
recommends: false
packages:
- adduser
- sudo
- systemd-container
- net-tools
- htop
- vim-nox
- tmux
- action: run
description: Set hostname
chroot: true
command: echo debian-{{ $suite }}-{{ $architecture }} > /etc/hostname
- action: pack
file: {{ $image }}
compression: gz

View File

@ -0,0 +1,94 @@
{{- $architecture := or .architecture "amd64" -}}
{{- $suite := or .suite "bullseye" -}}
{{ $image := or .image (printf "debian_full_network-%s-%s.tgz" $suite $architecture) }}
architecture: {{ $architecture }}
actions:
- action: debootstrap
suite: {{ $suite }}
components:
- main
mirror: http://deb.debian.org/debian
# variant: minbase
- action: apt
recommends: false
packages:
- systemd-container
- adduser
- sudo
- htop
- vim-nox
- tmux
- grub-efi
- initramfs-tools
- linux-image-amd64
- action: run
description: enable essential systemd services
chroot: true
command: systemctl enable systemd-networkd systemd-resolved
- action: run
description: symlink resolv.conf
chroot: true
command: touch /etc/resolv.conf && rm /etc/resolv.conf && ln -s /var/run/systemd/resolve/resolv.conf /etc/resolv.conf
- action: run
description: Set hostname
chroot: true
command: echo debian-{{ $suite }}-{{ $architecture }} > /etc/hostname
- action: pack
file: {{ $image }}
compression: gz
- action: image-partition
imagename: {{ $image }}.img
imagesize: 2GB
partitiontype: gpt
mountpoints:
- mountpoint: /
partition: root
- mountpoint: /boot/efi
partition: efi
flags: [ boot ]
partitions:
- name: efi
fs: vfat
start: 1MiB
end: 513MiB
options: [ x-systemd.automount ]
parttype: C12A7328-F81F-11D2-BA4B-00A0C93EC93B # ESP guid
- name: root
# parttype: 4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709 # linux root x86_64
parttype: 0FC63DAF-8483-4772-8E79-3D69D8477DE4 # linux partition
fs: ext4
start: 513MiB
end: 1999MB
- action: filesystem-deploy
description: Deploying filesystem onto image
setup-kernel-cmdline: true
setup-fstab: true
# - action: run
# chroot: true
# command: grub-install --target=x86_64-efi --no-nvram /dev/vda
#
# - action: run
# chroot: true
# command: update-grub
#
# - action: run
# chroot: true
# command: mkdir -p /boot/efi/EFI/BOOT && cp /boot/efi/EFI/debian/grubx64.efi /boot/efi/EFI/BOOT/BOOTX64.EFI
#
# - action: run
# chroot: true
# command: update-initramfs -u
#
# - action: run
# chroot: true
# command: sed -i 's/vda/sda/g' /boot/grub/grub.cfg

37
assets/nspawn/img.yaml Normal file
View File

@ -0,0 +1,37 @@
architecture: "amd4"
{{- $architecture := or .architecture "amd64" }}
{{- $tar := or .tar "none"}}
{{- $image := or .image "debian_irisib_amd64" }}
actions:
- action: unpack
file: {{ $tar }}
- action: image-partition
imagename: {{ $image }}.img
imagesize: 3GB
partitiontype: gpt
mountpoints:
- mountpoint: /
partition: root
- mountpoint: /boot/efi
partition: efi
flags: [ boot ]
partitions:
- name: efi
fs: vfat
start: 1MiB
end: 513MiB
options: [ x-systemd.automount ]
parttype: C12A7328-F81F-11D2-BA4B-00A0C93EC93B # ESP guid
- name: root
parttype: 0FC63DAF-8483-4772-8E79-3D69D8477DE4 # linux partition
fs: ext4
start: 513MiB
end: 2999MB
- action: filesystem-deploy
description: Deploying filesystem onto image
setup-kernel-cmdline: true
setup-fstab: true

View File

@ -0,0 +1,18 @@
[Distribution]
Distribution=debian
Release=bullseye
[Output]
Format=gpt_ext4
Bootable=yes
Output=image.raw
[Packages]
Packages=
openssh-client
vim-nox
[Validation]
Password=waldek

31
assets/nspawn/simple.yaml Normal file
View File

@ -0,0 +1,31 @@
{{- $architecture := or .architecture "arm64" -}}
{{- $suite := or .suite "bullseye" -}}
{{ $image := or .image (printf "debian-%s-%s.tgz" $suite $architecture) }}
architecture: {{ $architecture }}
actions:
- action: debootstrap
suite: {{ $suite }}
components:
- main
mirror: http://deb.debian.org/debian
variant: minbase
- action: apt
recommends: false
packages:
- adduser
- sudo
- systemd-container
- net-tools
- action: run
description: Set hostname
chroot: true
command: echo debian-{{ $suite }}-{{ $architecture }} > /etc/hostname
- action: pack
file: {{ $image }}
compression: gz

2155
assets/packages.list Normal file

File diff suppressed because it is too large Load Diff

13
assets/processes_ex_01.py Normal file
View File

@ -0,0 +1,13 @@
import time
import os
start_ts = time.time()
loops = 0
while True:
time.sleep(1)
loops += 1
tick_ts = time.time()
delta = int(tick_ts - start_ts)
pid = os.getpid()
print("I'm {} and I've been running for {} seconds and did {} loops".format(pid, delta, loops))

23
assets/processes_ex_02.py Normal file
View File

@ -0,0 +1,23 @@
import time
import os
import random
start_ts = time.time()
loops = 0
while True:
time.sleep(1)
loops += 1
tick_ts = time.time()
delta = int(tick_ts - start_ts)
pid = os.getpid()
print("I'm {} and I've been running for {} seconds and did {} loops".format(pid, delta, loops))
chance = random.randint(0, 20)
if chance == 5:
response = input("I need some input...")
if len(response) == 0:
exit(0)
else:
print("thanks for the response, I'll reset my counter and continue now...")
start_ts = time.time()
loops = 0

18
assets/processes_ex_03.py Normal file
View File

@ -0,0 +1,18 @@
import time
import os
import signal
def alarm_handler(signum, frame):
print("I'm an alarm hear me ring! (my ID is {})".format(signum))
def main():
print("I'm {}".format(os.getpid()))
while True:
time.sleep(1)
if __name__ == "__main__":
signal.signal(signal.SIGALRM, alarm_handler)
try:
main()
except Exception as e:
print(e)

BIN
assets/shasum.tar Normal file

Binary file not shown.

View File

@ -0,0 +1,36 @@
market Salad
mircocity case
diy plantboxes 4
market Soup
books shell scripting bible
books advanced python
market Dressings 2
mircocity monitor 4
diy bulbs 10
market Oil 2
market Pasta 4
diy nails 50
market Cheese
market Dairy
market Condiments
diy hose
mircocity hdd 6
mircocity motherboard
mircocity ssd
diy hammer
mircocity cpu
market Sauces 6
mircocity tablet
market Bread
diy bucket
market Rice
diy drill
market Seafood
market Meat
market Eggs 12
diy soil
market Cereal
mircocity keyboard
mircocity ram 4
mircocity graphics card
diy screws 75

Binary file not shown.

BIN
assets/systemd_sequence.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

BIN
assets/tree.tar Normal file

Binary file not shown.

View File

@ -571,7 +571,69 @@ steve@debian:/home/waldek$
## `umask` ## `umask`
TODO When you create a **new** file of directory, there are created with default permissions according to the `umask`.
```
waldek@helloworld:~$ whatis umask
umask (2) - set file mode creation mask
waldek@helloworld:~$ umask
0022
waldek@helloworld:~$ touch new_file && ls -l new_file
-rw-r--r-- 1 waldek waldek 0 Jun 15 15:02 new_file
waldek@helloworld:~$ mkdir new_folder && ls -la new_folder
total 8
drwxr-xr-x 2 waldek waldek 4096 Jun 15 15:03 .
drwxr-xr-x 59 waldek waldek 4096 Jun 15 15:03 ..
waldek@helloworld:~$
```
The `new_file` has a octal permission of `644` and the `new_folder` `755`.
I can change my `umask` as follows.
```
waldek@helloworld:~$ rm -r new_f*
waldek@helloworld:~$ umask 000
waldek@helloworld:~$ touch new_file && ls -l new_file
-rw-rw-rw- 1 waldek waldek 0 Jun 15 15:08 new_file
waldek@helloworld:~$ mkdir new_folder && ls -la new_folder
total 8
drwxrwxrwx 2 waldek waldek 4096 Jun 15 15:08 .
drwxr-xr-x 59 waldek waldek 4096 Jun 15 15:08 ..
waldek@helloworld:~$
```
The permissions changed!
The `new_file` now has a octal permission of `666` and the `new_folder` `777`.
Do you see a pattern here?
The `umask` value is subtracted from the [POSIX](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap01.html#tag_17_01_01_04) defined base permissions which are `666` for a file and `777` for a directory.
One more example to drive it home.
```
waldek@helloworld:~$ rm new_f*
rm: cannot remove 'new_folder': Is a directory
waldek@helloworld:~$ rm -r new_f*
waldek@helloworld:~$ umask 777
waldek@helloworld:~$ touch new_file && ls -l new_file
---------- 1 waldek waldek 0 Jun 15 15:11 new_file
waldek@helloworld:~$ mkdir new_folder && ls -la new_folder
ls: cannot open directory 'new_folder': Permission denied
waldek@helloworld:~$
```
Can you explain me why we get a `Permission denied` message?
Some of you might have noticed the `umask` returns **4** digits.
This is because there is an additional permission bit we have not covered yet.
If you want to dig into it I suggest [this](https://wiki.debian.org/Permissions#Section_2:_UNIX_permissions_explained) page on the Debian wiki where I got the following quote from.
> The first of the 4 octal digits which represent permissions contains the setuid and setgid bits. These can be used to override some of the defaults described above but it is not worth getting into details other than to note that the user private groups project collaboration idiom (see below) depends on the behavior of the setgid bit.
## Advanced permissions
| type | value |
| ---- | ----- |
| sticky bit | 1 |
| setgid | 2 |
| setuid | 4 |
## Essential programs ## Essential programs

View File

@ -984,8 +984,7 @@ waldek@hellodebian:~/Documents$
## Links ## Links
TODO TODO - symlinks
# Editors # Editors
@ -1188,7 +1187,7 @@ waldek@debian:~$
``` ```
You'll probably be a bit confused by the `|` part of the commands above. You'll probably be a bit confused by the `|` part of the commands above.
Don't worry, give it a few hours paragraphs and it will become fully transparent! Don't worry, give it a few hours and it will hopefully become fully transparent!
Next, there is a very high probability that the commands above don't immediately work for you. Next, there is a very high probability that the commands above don't immediately work for you.
This is because `locate` functions with a database which needs to be updated from time to time. This is because `locate` functions with a database which needs to be updated from time to time.
@ -1330,14 +1329,14 @@ waldek@debian:~$
Adding the `--color` argument to `grep` will make the matched patterns jump out with a color, depending on the color scheme of your terminal. Adding the `--color` argument to `grep` will make the matched patterns jump out with a color, depending on the color scheme of your terminal.
## Wildcards and regular expressions ## Wild cards and regular expressions
Both are quite related and for simplicities sake you can view regular expressions as wildcards on steroids. Both are quite related and for simplicities sake you can view regular expressions as wild cards on steroids.
A more detailed explaination can be found [here](https://unix.stackexchange.com/questions/57957/how-do-regular-expressions-differ-from-wildcards-used-to-filter-files). A more detailed explanation can be found [here](https://unix.stackexchange.com/questions/57957/how-do-regular-expressions-differ-from-wildcards-used-to-filter-files).
### Wildcards ### Wild cards
The syntax for wildcards is rater simple and also goes by the name of [globbing](https://en.wikipedia.org/wiki/Globbing) of [filename expansion](https://www.gnu.org/software/bash/manual/html_node/Filename-Expansion.html). The syntax for wild cards is rater simple and also goes by the name of [globbing](https://en.wikipedia.org/wiki/Globbing) of [filename expansion](https://www.gnu.org/software/bash/manual/html_node/Filename-Expansion.html).
The most important rules to remember are the following. The most important rules to remember are the following.
| character | meaning | | character | meaning |
@ -1382,7 +1381,7 @@ waldek@helloworld:~$
I hid a lot of words in [this](../assets/find_words_in_here.txt) file. I hid a lot of words in [this](../assets/find_words_in_here.txt) file.
How many can you find? How many can you find?
What do they all have in common? What do they all have in common?
Can you count the occurences? Can you count the occurrences?
* [exercise from Linux long](https://gitea.86thumbs.net/waldek/linux_course_doc/src/branch/master/modules/qualifying/learning_regex.md) * [exercise from Linux long](https://gitea.86thumbs.net/waldek/linux_course_doc/src/branch/master/modules/qualifying/learning_regex.md)
@ -1392,7 +1391,34 @@ TODO
# Pipes and redirects # Pipes and redirects
TODO basic overview I mentioned before that `bash` only knows *characters*.
It was kind of a lie.
`bash` only knows **bytes** at it's input and output.
If these bytes can be interpreted as *characters* you'll see readable output on your terminal, if not you'll see some gibberish.
An example.
```
waldek@helloworld:~$ echo "$(dd if=/dev/urandom bs=64 count=1 status=none)"
<EFBFBD>B<EFBFBD><EFBFBD>-<2D>j<EFBFBD><6A><EFBFBD><EFBFBD><EFBFBD><EFBFBD>s<EFBFBD>Ɠ8<C693><38>J<EFBFBD>!
<20>ד<EFBFBD>7d<37>/<2F>X<EFBFBD><58><EFBFBD><EFBFBD>!@{<7B>{R<><52><EFBFBD><EFBFBD><EFBFBD><EFBFBD>J):<3A>sB<73><42>+c<>1<EFBFBD>
waldek@helloworld:~$
```
Recognise this *gibberish*?
It's very similar to the output we got when reading a binary file no?
The command above generates 64 random bytes and print them to the screen.
We can do the same for a string and can use `pv` to get some statistics.
```
waldek@helloworld:~$ whatis pv
pv (1) - monitor the progress of data through a pipe
waldek@helloworld:~$ echo "hello world" | pv
hello world
12.0 B 0:00:00 [ 116KiB/s ] [ <=> ]
waldek@helloworld:~$
```
Don't worry about the `|` symbol, that's up next!
## Redirecting ## Redirecting
@ -1640,7 +1666,41 @@ waldek@debian:~$ grep -R waldek /etc/ &> files_with_my_name
waldek@debian:~$ waldek@debian:~$
``` ```
TODO - input redirection ### Input redirection
This is a bit more exotic but widely used in scripting.
I personally don't use it that often on the command line.
But we can demonstrate it's behaviour with a simple TCP server.
In a **first** terminal I run the following command.
If you try this out you'll see it *hang* after hitting enter, this is normal, the server is now listening for incoming connections
```
waldek@helloworld:~$ cat message
hello world!
I'm a text file...
waldek@helloworld:~$ cat < message
hello world!
I'm a text file...
waldek@helloworld:~$ nc -l -p 9999 < message && echo "done serving the file"
done serving the file
waldek@helloworld:~$
```
In a **second** terminal I now connect to this server.
I receive the content of the text file here and when I hit `ctrl-c` I break the connection.
The first terminal will now continue and say `done serving the file`.
```
waldek@helloworld:~$ nc localhost 9999
hello world!
I'm a text file...
^C
waldek@helloworld:~$
```
## Piping ## Piping
@ -1743,8 +1803,68 @@ Most of these pipes are not actually *useful* but I hope they illustrate the fle
# Ideas # Ideas
* find unique phone numbers
* find valid mobile phone numbers [based on](https://en.wikipedia.org/wiki/Telephone_numbers_in_Belgium#Mobile_numbers)
* find valid IP addresses
* find all ugly filenames and replace with better names (replace with \_) * find all ugly filenames and replace with better names (replace with \_)
* regex crossword puzzle
# Exercises
At this stage you have the necessary skills to juggle with text data.
Below are some mini exercises to help you put your knowledge into practice.
There are more things you can by now so if you can think of extra challenges by all means try them out!
Practice makes perfect!
## Mini exercise 1
Download [this](../assets/shopping_random.list) shopping list and extract me the following.
1. different shops I need to go to, sorted by amount of items to get at each shop
2. list of item of one shop but, ordered by how many times I need the item
3. list of only the items I need multiples of
4. think of some additional creative was of extracting information or maybe make a few lists yourself
## Mini exercise 2
Download [this](../assets/gsm_nr_01.list) list of Belgian cell phone numbers and extract me the following.
1. count of cell phones by different operators
2. print only the numbers that occur multiple times
2. of the double ones, which is the most frequent operator?
Can you do the same with these lists?
1. [easy](../assets/gsm_nr_02.list)
1. [medium](../assets/gsm_nr_03.list)
1. [hard](../assets/gsm_nr_04.list)
## Mini exercise 3
[This](../assets/fail2ban.log) file is a real logfile for one of my servers.
Can you make me a few interesting lists?
1. extract all different type of jails
2. how many bans per jail?
3. which date had the most bans?
4. which countries are these attacks coming from? (this is pretty hard with your current knowledge but search for some information on the internet!)
## Mini exercise 4
Download [this](../assets/generic-food.csv) list of food and show me some stats!
1. count the different food groups and sort by most popular
2. do the same for the subgroups
3. list the three most popular genetic families
## Mini exercise 5
A [list](../assets/broken_ip_01.list) of IP addresses got corrupted during a copy.
Can you clean it up please?
[Here](../assets/broken_ip_02.list) is a more complicated one...
## Mini exercise 6
[Here](../assets/packages.list) is a list of all installed and uninstalled packages from one of my computers.
Can you list me all the different linux kernel images I installed in a logical order?
# Ideas
* find all ugly filenames and replace with better names (replace with \_)

38
generate_md.py Executable file
View File

@ -0,0 +1,38 @@
#!/usr/bin/python3
import re
INPUT = "readme.md"
OUTPUT = "homework/todo_template.md"
URL = "https://gitea.86thumbs.net/waldek/linux_introduction/src/branch/master/"
if __name__ == "__main__":
with open(INPUT, "r") as fp:
src = []
for line in fp.readlines():
src.append(line)
data = []
for nr, line in zip(range(0, len(src)), src):
stripped = line.strip()
stripped = stripped.replace("*", "")
stripped = stripped.strip()
if "====" in line:
data.append("# {}".format(src[nr - 1]))
if "(./" in stripped:
topic = stripped[stripped.find("[")+1:stripped.find("]")]
url = stripped.replace("(./", "({}".format(URL))
url = re.sub("\[.*\]", "[Link]", url)
url = " * {} to course documentation".format(url)
header = "## {}".format(topic)
notes = "### Student notes:"
data.append(header)
data.append(url)
data.append(notes)
data.append("TODO")
with open(OUTPUT, "w") as fp:
for line in data:
fp.write("{}\n\n".format(line))

11
generate_toc.py Normal file → Executable file
View File

@ -1,3 +1,5 @@
#!/usr/bin/python3
import subprocess import subprocess
@ -8,7 +10,8 @@ INPUT = [
"essential/introduction_to_linux.md", "essential/introduction_to_linux.md",
"essential/introduction_to_the_commandline.md", "essential/introduction_to_the_commandline.md",
"essential/introduction_to_administration.md", "essential/introduction_to_administration.md",
"advanced/learning_bash_scripting.md" "advanced/learning_bash_scripting.md",
"advanced/learning_shells.md",
] ]
CMD = "gh-md-toc" CMD = "gh-md-toc"
FILTER = "(#" FILTER = "(#"
@ -17,14 +20,16 @@ TITLE = "Table of Contents"
if __name__ == "__main__": if __name__ == "__main__":
try: try:
p = subprocess.Popen([CMD], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) p = subprocess.Popen(CMD.split(), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output, err = p.communicate() output, err = p.communicate()
except Exception as e: except Exception as e:
print("please install {}".format(LINK)) print("please install {}".format(LINK))
exit() exit()
CONTENT = [] CONTENT = []
for f in INPUT: for f in INPUT:
p = subprocess.Popen([CMD, f], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) cmd = CMD.split()
cmd.append(f)
p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output, err = p.communicate() output, err = p.communicate()
output = output.decode().split("\n") output = output.decode().split("\n")
for line in output: for line in output:

31
homework/readme.md Normal file
View File

@ -0,0 +1,31 @@
# Homework
Over the summer break I advise you to do the following.
1. **practice** what we have learned so far
2. **document** your findings, questions, problems
In order to *help* you a bit I made a markdown template you can use to go over all the topics we touched on and I left some space for you to make your own notes.
You can find this file [here](./todo_template.md).
We did not dive too deep into `git` but if possible I highly recommend to push your notes to the [gitea](https://gitea.86thumbs.net).
This way you can share your findings with your fellow students **and** I can keep an eye on your progress.
## Books
* [The Linux command line](https://linuxcommand.org/index.php) is one of *the* best resources to get good at `bash`
1. the main book can be downloaded in pdf [here](https://sourceforge.net/projects/linuxcommand/files/TLCL/19.01/TLCL-19.01.pdf/download)
2. a second book can be downloaded [here](https://sourceforge.net/projects/linuxcommand/files/AWTLCL/21.10/AWTLCL-21.10.pdf/download)
* [The Debian system administrator handbook](https://debian-handbook.info/browse/stable/) is a super reference for all things Debian
* [Unix and Linux System Administration Handbook](https://www.amazon.de/-/en/Evi-Nemeth/dp/0134277554/ref=sr_1_1?keywords=linux+administration&qid=1657794033&s=books&sprefix=linux+admi%2Cstripbooks%2C81&sr=1-1) is **not free** but a very complete handbook with a more general overview
## Online challenges
* regex [crossword](https://m.regexcrossword.com/) puzzles can be a fun way to get better at regexes
* the [cmdchallenge](https://cmdchallenge.com/) is a fun way to get better at pipes and basic commands
* you could continue [bandit](https://overthewire.org/wargames/bandit/) for general practice
* level [27-28](https://overthewire.org/wargames/bandit/bandit28.html) switches the game up and is all about `git`, you'll need to do some deep diving and I recommend the main [documentation](https://git-scm.com/docs/gittutorial) as a starting point
## Extra info
* you could try and set up `vim` with some plugins to make it a proper [IDE](https://en.wikipedia.org/wiki/Integrated_development_environment); my setup can be found [here](https://gitea.86thumbs.net/waldek/linux_course_doc/src/branch/master/modules/qualifying/learning_vim_configuration.md)
* example project by [Abdellah](https://gitea.86thumbs.net/Abdellah/Project_Hypervisor_KVM_Virtualization) as inspiration for your final project

1207
homework/todo_template.md Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,40 @@
# links and ideas # links and ideas
* [info](https://un.curl.dev/) about working in open source
* grep and regex [exercises](https://github.com/learnbyexample/Command-line-text-processing/tree/master/exercises/GNU_grep)
* systemd-nspawn doc and exercises
* [hub](https://hub.nspawn.org/images/)
* [tutorial](https://blog.selectel.com/systemd-containers-introduction-systemd-nspawn/)
* [docker nspawn](https://seanmcgary.com/posts/run-docker-containers-with-systemd-nspawn)
* [debian](https://wiki.debian.org/nspawn)
* [arch](https://wiki.archlinux.org/title/systemd-nspawn#Use_a_%22macvlan%22_or_%22ipvlan%22_interface)
* [systemd-sysext](https://0pointer.net/blog/testing-my-system-code-in-usr-without-modifying-usr.html)
* [mkosi](http://0pointer.net/blog/mkosi-a-tool-for-generating-os-images.html) tutorial for building images
* show usage of `systemd-run`
* exercise on minimal wayland configuration
* [history of command line arguments](https://blog.liw.fi/posts/2022/05/07/unix-cli/) * [history of command line arguments](https://blog.liw.fi/posts/2022/05/07/unix-cli/)
* [systemd-sysext](https://0pointer.net/blog/testing-my-system-code-in-usr-without-modifying-usr.html)
* do a mini class on barshrc customisation, prompts, zsh and ohmyzsh
* class on dpkg, apt, and .deb introspection * class on dpkg, apt, and .deb introspection
* class on compiling a simple program, maybe recompiling a kernel * class on compiling a simple program, maybe recompiling a kernel
* exercise on how to take a physical system and convert it to a VM * exercise on how to take a physical system and convert it to a VM
* munin plugin design exercise * munin plugin design exercise
* advanced [bash](https://tldp.org/LDP/abs/html/index.html) scripting
* make a minimal sway installation usable (wayland focused)
* maybe same but with i3
* journald-remote exercise with https!
* setup automated install of debian
* gpg/pass/paper-key tutorial
* bash [completion](https://iridakos.com/programming/2018/03/01/bash-programmable-completion-tutorial)
* flatpak is not the [future](https://ludocode.com/blog/flatpak-is-not-the-future)
* [gameshell](https://github.com/phyver/GameShell)
* big [list](https://training-course-material.com/training/Debian_exercises) of course with exercises
* [systemd-boot](https://blobfolio.com/2018/replace-grub2-with-systemd-boot-on-ubuntu-18-04/) tutorial
* goaccess script for log [interpretation](https://github.com/stockrt/nginx2goaccess/blob/master/nginx2goaccess.sh)
* advanced [htop](https://peteris.rocks/blog/htop/)
* systemd [tips and tricks](https://www.freedesktop.org/wiki/Software/systemd/TipsAndTricks/)
* dbus [user session](https://serverfault.com/questions/892465/starting-systemd-services-sharing-a-session-d-bus-on-headless-system) for headless machines
## started
* do a mini class on barshrc customisation, prompts, zsh and ohmyzsh
test

View File

@ -2,3 +2,4 @@
Welcome! Welcome!
You should not do this...

View File

@ -2,6 +2,7 @@
Welcome! Welcome!
Essential: introduction to linux Essential: introduction to linux
================= =================
@ -23,7 +24,7 @@ Essential: introduction to linux
* [Exercise](./essential/introduction_to_linux.md#exercise-1) * [Exercise](./essential/introduction_to_linux.md#exercise-1)
* [Guest additions](./essential/introduction_to_linux.md#guest-additions) * [Guest additions](./essential/introduction_to_linux.md#guest-additions)
<!-- Created by https://github.com/ekalinin/github-markdown-toc --> Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)
Essential: introduction to the commandline Essential: introduction to the commandline
@ -59,18 +60,27 @@ Essential: introduction to the commandline
* [The hard way](./essential/introduction_to_the_commandline.md#the-hard-way) * [The hard way](./essential/introduction_to_the_commandline.md#the-hard-way)
* [Exercise](./essential/introduction_to_the_commandline.md#exercise-5) * [Exercise](./essential/introduction_to_the_commandline.md#exercise-5)
* [Searching inside files](./essential/introduction_to_the_commandline.md#searching-inside-files) * [Searching inside files](./essential/introduction_to_the_commandline.md#searching-inside-files)
* [Wildcards and regular expressions](./essential/introduction_to_the_commandline.md#wildcards-and-regular-expressions) * [Wild cards and regular expressions](./essential/introduction_to_the_commandline.md#wild-cards-and-regular-expressions)
* [Wildcards](./essential/introduction_to_the_commandline.md#wildcards) * [Wild cards](./essential/introduction_to_the_commandline.md#wild-cards)
* [Exercise](./essential/introduction_to_the_commandline.md#exercise-6) * [Exercise](./essential/introduction_to_the_commandline.md#exercise-6)
* [Exercise](./essential/introduction_to_the_commandline.md#exercise-7) * [Exercise](./essential/introduction_to_the_commandline.md#exercise-7)
* [Regular expressions](./essential/introduction_to_the_commandline.md#regular-expressions) * [Regular expressions](./essential/introduction_to_the_commandline.md#regular-expressions)
* [Pipes and redirects](./essential/introduction_to_the_commandline.md#pipes-and-redirects) * [Pipes and redirects](./essential/introduction_to_the_commandline.md#pipes-and-redirects)
* [Redirecting](./essential/introduction_to_the_commandline.md#redirecting) * [Redirecting](./essential/introduction_to_the_commandline.md#redirecting)
* [Input redirection](./essential/introduction_to_the_commandline.md#input-redirection)
* [Piping](./essential/introduction_to_the_commandline.md#piping) * [Piping](./essential/introduction_to_the_commandline.md#piping)
* [Text manipulation](./essential/introduction_to_the_commandline.md#text-manipulation) * [Text manipulation](./essential/introduction_to_the_commandline.md#text-manipulation)
* [Ideas](./essential/introduction_to_the_commandline.md#ideas) * [Ideas](./essential/introduction_to_the_commandline.md#ideas)
* [Exercises](./essential/introduction_to_the_commandline.md#exercises)
* [Mini exercise 1](./essential/introduction_to_the_commandline.md#mini-exercise-1)
* [Mini exercise 2](./essential/introduction_to_the_commandline.md#mini-exercise-2)
* [Mini exercise 3](./essential/introduction_to_the_commandline.md#mini-exercise-3)
* [Mini exercise 4](./essential/introduction_to_the_commandline.md#mini-exercise-4)
* [Mini exercise 5](./essential/introduction_to_the_commandline.md#mini-exercise-5)
* [Mini exercise 6](./essential/introduction_to_the_commandline.md#mini-exercise-6)
* [Ideas](./essential/introduction_to_the_commandline.md#ideas-1)
<!-- Created by https://github.com/ekalinin/github-markdown-toc --> Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)
Essential: introduction to administration Essential: introduction to administration
@ -92,7 +102,7 @@ Essential: introduction to administration
* [SSH and SFTP](./essential/introduction_to_administration.md#ssh-and-sftp) * [SSH and SFTP](./essential/introduction_to_administration.md#ssh-and-sftp)
* [Bandit](./essential/introduction_to_administration.md#bandit) * [Bandit](./essential/introduction_to_administration.md#bandit)
<!-- Created by https://github.com/ekalinin/github-markdown-toc --> Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)
Advanced: learning bash scripting Advanced: learning bash scripting
@ -105,9 +115,8 @@ Advanced: learning bash scripting
* [With read](./advanced/learning_bash_scripting.md#with-read) * [With read](./advanced/learning_bash_scripting.md#with-read)
* [Coding challenge - Secret input](./advanced/learning_bash_scripting.md#coding-challenge---secret-input) * [Coding challenge - Secret input](./advanced/learning_bash_scripting.md#coding-challenge---secret-input)
* [read multiple variables](./advanced/learning_bash_scripting.md#read-multiple-variables) * [read multiple variables](./advanced/learning_bash_scripting.md#read-multiple-variables)
* [Exercise - unpack values](./advanced/learning_bash_scripting.md#exercise---unpack-values)
* [With command line arguments](./advanced/learning_bash_scripting.md#with-command-line-arguments) * [With command line arguments](./advanced/learning_bash_scripting.md#with-command-line-arguments)
* [From a file](./advanced/learning_bash_scripting.md#from-a-file)
* [From a pipe](./advanced/learning_bash_scripting.md#from-a-pipe)
* [Coding Challenge - output the exact output below](./advanced/learning_bash_scripting.md#coding-challenge---output-the-exact-output-below) * [Coding Challenge - output the exact output below](./advanced/learning_bash_scripting.md#coding-challenge---output-the-exact-output-below)
* [More math!](./advanced/learning_bash_scripting.md#more-math) * [More math!](./advanced/learning_bash_scripting.md#more-math)
* [The let keyword](./advanced/learning_bash_scripting.md#the-let-keyword) * [The let keyword](./advanced/learning_bash_scripting.md#the-let-keyword)
@ -116,17 +125,64 @@ Advanced: learning bash scripting
* [Variable length](./advanced/learning_bash_scripting.md#variable-length) * [Variable length](./advanced/learning_bash_scripting.md#variable-length)
* [If Statements - How to make decisions within your Bash script.](./advanced/learning_bash_scripting.md#if-statements---how-to-make-decisions-within-your-bash-script) * [If Statements - How to make decisions within your Bash script.](./advanced/learning_bash_scripting.md#if-statements---how-to-make-decisions-within-your-bash-script)
* [How does it work behind the scenes?](./advanced/learning_bash_scripting.md#how-does-it-work-behind-the-scenes) * [How does it work behind the scenes?](./advanced/learning_bash_scripting.md#how-does-it-work-behind-the-scenes)
* [exit status](./advanced/learning_bash_scripting.md#exit-status)
* [test](./advanced/learning_bash_scripting.md#test)
* [Nested if statements](./advanced/learning_bash_scripting.md#nested-if-statements) * [Nested if statements](./advanced/learning_bash_scripting.md#nested-if-statements)
* [Coding challenge - File information](./advanced/learning_bash_scripting.md#coding-challenge---file-information)
* [A <em>modern</em> version of test](./advanced/learning_bash_scripting.md#a-modern-version-of-test) * [A <em>modern</em> version of test](./advanced/learning_bash_scripting.md#a-modern-version-of-test)
* [[[ ]]](./advanced/learning_bash_scripting.md#--) * [[[ ]]](./advanced/learning_bash_scripting.md#--)
* [(( ))](./advanced/learning_bash_scripting.md#---1) * [(( ))](./advanced/learning_bash_scripting.md#---1)
* [&amp;&amp; and ||](./advanced/learning_bash_scripting.md#-and--) * [&amp;&amp; and ||](./advanced/learning_bash_scripting.md#-and--)
* [Coding challenge - File information](./advanced/learning_bash_scripting.md#coding-challenge---file-information)
* [Coding challenge - pipe or argument?](./advanced/learning_bash_scripting.md#coding-challenge---pipe-or-argument)
* [Loops - A variety of ways to perform repetitive tasks.](./advanced/learning_bash_scripting.md#loops---a-variety-of-ways-to-perform-repetitive-tasks) * [Loops - A variety of ways to perform repetitive tasks.](./advanced/learning_bash_scripting.md#loops---a-variety-of-ways-to-perform-repetitive-tasks)
* [while loop](./advanced/learning_bash_scripting.md#while-loop)
* [Read from a file with a while loop](./advanced/learning_bash_scripting.md#read-from-a-file-with-a-while-loop)
* [Read from a pipe with a while loop](./advanced/learning_bash_scripting.md#read-from-a-pipe-with-a-while-loop)
* [for loop](./advanced/learning_bash_scripting.md#for-loop)
* [Counter loops with for](./advanced/learning_bash_scripting.md#counter-loops-with-for)
* [Finicky behaviour](./advanced/learning_bash_scripting.md#finicky-behaviour)
* [break and continue](./advanced/learning_bash_scripting.md#break-and-continue)
* [Coding challenge - pipe or argument plus action!](./advanced/learning_bash_scripting.md#coding-challenge---pipe-or-argument-plus-action)
* [Coding challenge - Rename files](./advanced/learning_bash_scripting.md#coding-challenge---rename-files)
* [Coding challenge - Rename jpeg files](./advanced/learning_bash_scripting.md#coding-challenge---rename-jpeg-files)
* [Coding challenge - Remove duplicate files](./advanced/learning_bash_scripting.md#coding-challenge---remove-duplicate-files)
* [Coding challenge - File tree](./advanced/learning_bash_scripting.md#coding-challenge---file-tree)
* [Coding challenge - Compare and move](./advanced/learning_bash_scripting.md#coding-challenge---compare-and-move)
* [Coding challenge - Guess the number](./advanced/learning_bash_scripting.md#coding-challenge---guess-the-number)
* [Functions - Reuse code to make life easier.](./advanced/learning_bash_scripting.md#functions---reuse-code-to-make-life-easier) * [Functions - Reuse code to make life easier.](./advanced/learning_bash_scripting.md#functions---reuse-code-to-make-life-easier)
* [defining a function](./advanced/learning_bash_scripting.md#defining-a-function)
* [function arguments](./advanced/learning_bash_scripting.md#function-arguments)
* [global vs local variable](./advanced/learning_bash_scripting.md#global-vs-local-variable)
* [return values](./advanced/learning_bash_scripting.md#return-values)
* [the command builtin](./advanced/learning_bash_scripting.md#the-command-builtin)
* [Coding challenge - Student reports](./advanced/learning_bash_scripting.md#coding-challenge---student-reports)
* [User Interface - Make your scripts user friendly.](./advanced/learning_bash_scripting.md#user-interface---make-your-scripts-user-friendly) * [User Interface - Make your scripts user friendly.](./advanced/learning_bash_scripting.md#user-interface---make-your-scripts-user-friendly)
* [Coding challenge - Address book](./advanced/learning_bash_scripting.md#coding-challenge---address-book)
* [Arrays in bash](./advanced/learning_bash_scripting.md#arrays-in-bash)
* [Python](./advanced/learning_bash_scripting.md#python) * [Python](./advanced/learning_bash_scripting.md#python)
* [Vim as an IDE](./advanced/learning_bash_scripting.md#vim-as-an-ide) * [Vim as an IDE](./advanced/learning_bash_scripting.md#vim-as-an-ide)
<!-- Created by https://github.com/ekalinin/github-markdown-toc --> Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)
Advanced: learning shells
=================
* [bash login](./advanced/learning_shells.md#bash-login)
* [which files are sources when](./advanced/learning_shells.md#which-files-are-sources-when)
* [A clean slate](./advanced/learning_shells.md#a-clean-slate)
* [Prompt customization](./advanced/learning_shells.md#prompt-customization)
* [Saving our changes](./advanced/learning_shells.md#saving-our-changes)
* [Decoding the <em>base</em> prompt](./advanced/learning_shells.md#decoding-the-base-prompt)
* [Alternative shells](./advanced/learning_shells.md#alternative-shells)
* [zsh](./advanced/learning_shells.md#zsh)
* [fish](./advanced/learning_shells.md#fish)
* [xonsh](./advanced/learning_shells.md#xonsh)
* [Shell completion](./advanced/learning_shells.md#shell-completion)
* [Frameworks](./advanced/learning_shells.md#frameworks)
* [oh my zsh](./advanced/learning_shells.md#oh-my-zsh)
* [oh my bash](./advanced/learning_shells.md#oh-my-bash)
* [xxh](./advanced/learning_shells.md#xxh)
Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)