Linux Foundations_LPI_Guide Flashcards
How is Debian GNU/Linux different from Ubuntu? Name two aspects.
The major difference
is the complexity of the user configuration that Ubuntu doesn’t require during the installation
process.
Another difference would be the stability of each distribution. Debian is considered to be more
stable compared to Ubuntu. This is because Debian receives fewer updates that are tested in
detail and the entire operating system is more stable. On the other hand, Ubuntu enables the
user to use the latest releases of software and all the new technologies.
What are the most common environments/platforms Linux is used for? Name three different
environments/platforms and name one distribution you can use for each.
smartphone, desktop and server. On smartphones, it can be used by distributions such as Android. On desktop and server, it can be
used by any distribution that is mostly suitable with the functionality of that machine, from
Debian, Ubuntu to CentOS and Red Hat Enterprise Linux.
You are planning to install a Linux distribution in a new environment. Name four things that
you should consider when choosing a distribution.
considered is cost,
performance,
scalability,
how stable it is
the hardware demand of the system.
Name three devices that the Android OS runs on, other than smartphones.
smart TVs,
tablet computers,
Android Auto and
smartwatches.
Explain three major advantages of cloud computing.
flexibility,
easy to recover
low use cost.
Cloud based services are easy to implement and scale, depending on the business
requirements.
It has a major advantage in backup and recovery solutions, as it enables
businesses to recover from incidents faster and with repocussion
subscription-based model
Considering cost and performance, which distributions are mostly suitable for a business that
aims to reduce licensing costs, while keeping performance at its highest? Explain why
CentOS.
incorporates all Red Hat products, which are further used within their commercial operating
system,
while being free to use.
Similarly, Ubuntu LTS releases guarantee support for a longer
period of time.
The stable versions of Debian GNU/Linux are also often used in enterprise
environments
What are the major advantages of the Raspberry Pi and which functions can they take in
business?
Raspberry Pi is small in size
is low cost
and can handle web traffic and many other functionalities.
It can be used as a server, a firewall
and can be used as the main board for robots, and many other small devices
What range of distributions does Amazon Cloud Services and Google Cloud offer? Name at least
three common ones and two different ones.
The common distributions between Amazon and Google Cloud Services are Ubuntu, CentOS
and Red Hat Enterprise Linux. Each cloud provider also offers specific distributions that the
other one doesn’t. Amazon has Amazon Linux and Kali Linux, while Google offers the use of
FreeBSD and Windows Servers.
Guided Exercises
1. For each of the following commands, identify whether it is associated with the Debian
packaging system or the Red Hat packaging system:
dpkg
rpm
apt-get
yum
dnf
dpkg ——–>Debian packaging system
rpm ———> Red Hat packaging system
apt-get—–> Debian packaging system
yum———> Red Hat packaging system
dnf ———>Red Hat packaging system
Define dnf
Which command could be used to install Blender on Ubuntu? After installation, how can the
program be executed?
The command apt-get install blender. The package name should be specified in
lowercase. The program can be executed directly from the terminal
Which application from the LibreOffice suite can be used to work with electronic
spreadsheets?
CALC
Which open-source web browser is used as the basis for the development of Google Chrome?
Chromium
SVG is an open standard for vector graphics. Which is the most popular application for editing
SVG files in Linux systems?
Inkscape
For each of the following file formats, write the name of an application able to open and edit
the corresponding file:
png
doc
xls
ppt
png——-> Gimp
doc——-> LibreOffice Writer
xls——–> LibreOffice Calc
ppt——-> LibreOffice Impress
Which software package allows file sharing between Linux and Windows machines over the
local network?
Samba
You know that configuration files are kept even if the associated package is removed from the
system. How could you automatically remove the package named cups and its configuration
files from a DEB based system?
apt-get purge cups
Suppose you have many TIFF image files and want to convert them to JPEG. Which software
package could be used to convert those files directly at the command line?
ImageMagick
Which software package do you need to install in order to be able to open Microsoft Word
documents sent to you by a Windows user?
LibreOffice or OpenOffice
Every year, linuxquestions.org promotes a survey about the most popular Linux applications.
Visit https://www.linuxquestions.org/questions/2018-linuxquestions-org-members-choice-
awards-128/ and find out which desktop applications are most popular among experienced
Linux users.
Browser: Firefox. Email client: Thunderbird. Media player: VLC. Raster graphics editor: GIMP
What are — in a nutshell — the “four freedoms” as defined by Richard Stallman and the Free
Software Foundation?
freedom 0———–> run the software
freedom 1———–> study and modify the software (source code)
freedom 2———–> distribute the software
freedom 3———–> distribute the modified software
What does the abbreviation FLOSS stand for?
Free/Libre Open Source Software
You have developed free software and want to ensure that the software itself, but also all
future results based on it, remain free as well. Which license do you choose?
CC BY———————->
GPL version 3———–> X
2-Clause BSD License———–>
LGPL———–>
GPL version 3 (GNU General Public License version 3)
Copyleft
Freedom
Which of the following licenses would you call permissive, which would you call copyleft?
Simplified BSD License permissive
GPL version 3 copyleft
CC BY permissive
CC BY-SA copyleft
You have written a web application and published it under a free license. How can you earn
money with your product? Name three possibilities.
◦ Dual licensing, e.g. by offering a chargeable “Business Edition”
◦ Offering hosting, service, and support
◦ Developing proprietary extensions for customers
Under which license (including version) are the following applications available?
Apache HTTP Server ——————> Apache License 2.0
MySQL Community Server———–> GPL 2
Wikipedia articles (English)———–> Creative Commons Attribution Share-Alike license (CC-BY-SA)
Mozilla Firefox Mozilla—————–> Public License 2.0
GIMP —————————————->GPL 3
You want to release your software under the GNU GPL v3. What steps should you follow?
◦ If necessary, secure yourself against the employer with a copyright waiver, for example, so
that you can specify the license.
◦ Add a copyright notice to each file.
◦ Add a file called COPYING with the full license text to your software.
◦ Add a reference to the license in each file
You have written proprietary software and would like to combine it with free software under the GPL version 3. Are you allowed to do this or what do you have to consider?
The FAQs of the Free Software Foundation provide information here: Provided that your proprietary software and the free software remain separate from each other, the combination is possible.
However, you have to make sure that this separation is technically guaranteed and recognizable for the users.
If you integrate the free software in such a way that it becomes part
of your product, you must also publish the product under the GPL according to the copyleft principle.
Why did the Free Software Foundation release the GNU Affero General Public License (GNU AGPL) as a supplement to the GNU GPL?
The GNU AGPL closes a license gap that arises especially with free software hosted on a server:
If a developer makes changes to the software, he is not obliged under the GPL to make these
changes accessible, since he allows access to the program, but does not “redistribute” on the
program in the GPL sense. The GNU AGPL, on the other hand, stipulates that the software must
be made available for download with all changes
Name three examples of free software, which are also offered as “Business Edition”, e.g. in a chargeable version
MySQL
Zammad
Nextcloud
You should use a “private window” in your browser if you want:
To browse completely anonymous on the
Internet
To leave no trace on the computer you’re
using
To activate TLS to avoid cookie tracking
In order to use DNT
To use cryptography during data transmission
To leave no trace on the computer you’re
using
What is OpenStack?
A project that allows the creation of private
IaaS
A project that allows the creation of private
PaaS
A project that allows the creation of private
SaaS
A hypervisor
An open source password manager
A project that allows the creation of private
IaaS
Which of the below options are valid disk encryption softwares?
RevealJS, EncFS and dm-crypt
dm-crypt and KeePass
EncFS and Bitwarden
EncFS and dm-crypt
TLS and dm-crypt
EncFS and dm-crypt
Select true or false for dm-crypt device encryption:
Files are encrypted before being written to the
disk.
true
Select true or false for dm-crypt device encryption:
The entire filesystem is an encrypted blob
true
Select true or false for dm-crypt device encryption:
Only files and directories are encrypted, not
symlinks
false
Select true or false for dm-crypt device encryption:
Don’t require root access
false
Select true or false for dm-crypt device encryption:
Is a block device encryption
true
Beamer is:
An encryption mechanism
A hypervisor
A virtualization software
An OpenStack component
A LaTeX presentation tool
A LaTeX presentation tool
Find what type the following commands are:
cd———->
cat———>
exit——–>
cd———-> Shell builtin
cat———> External command
exit——–> Shell builtin
With one command and using brace expansion in Bash (review the man page for Bash), create
5 files numbered 1 to 5 with the prefix game (game1, game2, …).
Ranges can be used to express the numbers from 1 to 5 within one command:
$ touch game{1..5}
$ ls
game1 game2 game3 game4 game5
Delete all 5 files that you just created with just one command, using a different special
character (review Pathname Expansion in the Bash man pages).
Since all files start with game and end in a single character (a number from 1 to 5 in this case),
? can be used as a special character for the last character in the filename:
$ rm game?
Is there any other way to make two commands interact with each other? What are those?
one command could write data to a file which is then processed by another command.
Linux can also collect the output of one command and use it as input for another command. This is called piping and we will learn more about it in a future lesson.
Create a local variable number.
Answers to Guided Exercises
1. Create a local variable number.
$ number=5
Create an environment variable ORDER, using one of the two above methods.
$ export ORDER=desc
Display both the variable names and their contents.
$ echo number
number
$ echo ORDER
ORDER
$ echo $number
5
$ echo $ORDER
desc
What are the scopes of the previously created variables?
The scope of the local variable number is the current shell only.
◦ The scope of the environment variable ORDER is the current shell and all the subshells
generated by it.
Create a local variable nr_files and assign the number of lines found in the /etc/passwd
file. Hint: Look into the command wc and command substitution and don’t forget about
quotation marks.
$ nr_files=wc -l /etc/passwd
Create an environment variable ME. Assign the USER variable’s value.
$ export ME=$USER
Append the HOME variable value to ME, having the : delimiter. Display the contents of the ME
variable.
$ ME=$ME:$HOME
$ echo $ME
user:/home/user
Using the date example above, create a variable called today and assign the date for one of the
time zones.
The following use the GMT and EST time zones as an example, but any time zone selection is
valid.
$ today=$(TZ=GMT date)
$ echo $today
Thu 31 Jan 15:07:35 GMT 2019
or
$ today=$(TZ=EST date)
$ echo $today
Thu 31 Jan 10:07:35 EST 2019
Create another variable called today1 and assign the system’s date to it.
Assuming that you are in GMT:
$ today1=$(date)
$ echo $today1
Thu 31 Jan 10:07:35 EST 2019
Display the path to the first 3 README files. Use the man command to identify the correct option
for locate.
$ locate -l 3 README
/etc/alternatives/README
/etc/init.d/README
/etc/rc0.d/README
Create a file called test in your home directory. Find its absolute path with the locate
command.
$ touch test
$ locate test
/home/user/test
Did you find it immediately? What did you have to do in order for locate to find it?
$ sudo updatedb
The file is newly created, therefore there is no record of it in the database.
Search for the test file that you previously created, using the find command. What syntax did
you use and what is the absolute path ?
$ find ~ -name test
or
$ find . -name test
/home/user/test
Display on the screen the present working directory, including the subfolders.
$ ls -R
Search within the tree for all files that end with a number.
$ find ~ -name “[0-9]”
$ locate “[0-9]”
Remove the entire directory tree with a single command
$ rm -r Documents Downloads Test test
For each of the following paths, identify whether it is absolute or relative:
/home/user/Downloads absolute
../Reports relative
/var absolute
docs relative
/ absolute
For each of the following paths, identify whether it is absolute or relative:
/home/user/Downloads————> absolute
../Reports ——————————->relative
/var —————————————>absolute
docs ————————————–>relative
/ ——————————————->absolute
Observe the following file structure. Note: Directories end with a slash (/) when tree is
invoked with the -F option. You will need elevated privileges in order to run the tree
command on the root (/) directory. The following is example output and is not indicative of a
full directory structure. Use it to answer the following questions:
$ sudo tree -F /
/
├── etc/
│ ├── network/
│ │ └── interfaces
│ ├── systemd/
│ │ ├── resolved.conf
│ │ ├── system/
│ │ ├── system.conf
│ │ ├── user/
│ │ └── user.conf
│ └── udev/
│ ├── rules.d/
│ └── udev.conf
└── home/
├── lost+found/
└── user/
└── Documents/
12 directories, 5 files
Enter the shortest possible command for each of the following:
◦ Your current location is root (/). Enter the command to navigate to lost+found within the
home directory (example):
$ cd home/lost+found
Enter the shortest possible command for each of the following:
◦ Your current location is root (/). Enter the command to navigate to the directory named network:
$ cd etc/network
Enter the shortest possible command for each of the following:
◦ Your current location is Documents. Navigate to the directory named etc:
$ cd /etc
Enter the shortest possible command for each of the following:
◦ Your current location is system. Navigate to the directory named user:
$ cd /home/user
Consider the following commands:
$ pwd
/etc/udev/rules.d
$ cd ../../systemd/user
$ cd ..
$ pwd
What is the output of the final pwd command?
/etc/systemd
Suppose a user has entered the following commands:
What cd command would allow you to enter this directory
$ mkdir “this is a test”
$ ls
this is a test
$ cd this\ is\ a\ test
Try this again, but after typing in cd this, press the TAB key. What is now displayed on the
prompt?
$ cd this\ is\ a\ test
This is an example of autocompletion, which is an invaluable tool not only for saving time, but
for preventing spelling errors.
Try to create a directory whose name contains a \ character. Display the directory’s name with
ls and delete the directory.
You can either escape the backslash using another backslash (\) or use single or double
quotes around the whole directory name:
$ mkdir my\dir
$ ls
‘my\dir’
$ rmdir ‘my\dir’
Here is a new command to try: du -h. Run this command and describe the output that it gives
you.
The du command will generate a list of all files and directories, and indicate the size of each.
For example, du -s will display the file size of all files, directories, and subdirectories for a
certain location.
On many Linux systems, you can type in ll and get the same output as you would if you typed
ls -l. Please note however that ll is not a command. For example, man ll will give you the
message that no manual entry exists for it. This is an example of an alias. Why might aliases be
useful to a user?
ll is an alias of ls -l. In Bash, we can use aliases to simplify commonly-used commands. ll is
often defined for you in Linux, but you can create your own as well.
What command will navigate into the network directory regardless of your current
location?
cd /etc/network
What command can user enter to navigate into their Documents directory from
/etc/udev? Use the shortest possible path
cd ~/Documents
What command can user enter to navigate into michael ‘s Music directory? Use the
shortest possible path:
cd ~michael/Music
What does -v do for mkdir, rm, and cp?
$ rm -v a b
removed ‘a’
removed ‘b’
$ mv -v a b
‘a’ -> ‘b’
$ cp -v b c
‘b’ -> ‘c’
What happens if you accidentally attempt to copy three files on the same command line to a
file that already exists instead of a directory?
Linux Essentials (Version 1.6) | 2.4 Creating, Moving and Deleting Files
Version: 2024-10-27 | Licensed under CC BY-NC-ND 4.0. | learning.lpi.org | 163
cp will refuse to do anything and output an error message:
$ touch a b c d
$ cp a b c d
cp: target ‘d’ is not a directory
What happens when you use mv to move a directory into itself?
You will get an error message telling you mv cannot do that.
$ mv a a
mv: cannot move ‘a’ to a subdirectory of itself, ‘a/a’