Linux Essentials Study Sheet
Linux Essentials Study Sheet
2015
LPI-‐Linux Essentials
Study Sheet
LPIC-1 Exam 101 – Study Sheet
1
LPIC-1 Exam 101 – Study Sheet
Introduction
This study sheet is intended to help you do a targeted review of key topics that are very likely to
be covered during your Linux Essentials LPI exam. This is not intended to replace any quizzes,
labs or lectures here at Linux Academy, but can be used as a final review just prior to your exam.
Topic 1: The Linux Community and a Career in Open Source (weight: 7)
1.1 Linux Evolution and Popular Operating Systems
Weight: 2
Description: Knowledge of Linux development and major distributions
§ A Linux Introductory
§ Linux was created by Linus Torvalds in 1991
§ It is similar but is not the same as the first open source minimal release of
Minix
§ Linus created the first Linux Kernel, BASH, GCC, and update utility – the
first Linux release.
§ Open Source Philosophy
§ The idea that Linux is Open Source means that its source code of the
kernel and programs is freely available to anyone to download, modify,
and redistribute.
§ The Free Software Foundation (FSF) started with this concept in what
made Linux popular in its early days.
§ Example of this: Unix, Windows and other large Operating Systems are
developed in house and the source code and documentation is very closed
to the outside world. You cannot modify it or redistribute. Open Source,
however, is open development and the source code can be modified and
redistributed.
§ Distributions
§ Linux has several releases of Linux “flavors”- different tools, applications
– known as distributions
§ Linux Kernel
2
LPIC-1 Exam 101 – Study Sheet
3
LPIC-1 Exam 101 – Study Sheet
§ Blender
§ Thunderbird
§ Firefox
§ GIMP
§ X Windows GUI desktop environments
§ KDE
§ GNOME
§ LXDE
§ Unity
§ XFCE
§ Server Applications
§ Apache HTTPD – The most popular and widely used web software used
today
§ NGINX – Widely used web server with built in load balancing
§ MySQL – Widely used open source database server
§ NFS
§ Samba
§ Common TCP ports:
§ P# Service Server Applications
§ 22 SSH OpenSSH
§ 23 Telnet TelnetD
§ 25 SMTP Postfix, Sendmail
§ 53 DNS Bind
§ 67 BOOTP, DHCP dnsmasq, dhcpd
§ 80 HTTP Apache, NGINX
§ 443 HTTPS Apache, NGINX
§ Mobile Applications
§ Great examples are applications that run on android (embedded Linux)
which runs on mobile games etc.
§ These could be “weather apps, fitness apps, mobile games” etc.
§ These mobile apps are usually installed and managed through a
store front application
§ Development Languages
§ Cathedral Model
§ Organized method of development
§ Each programmer is assigned a portion of the project
§ Source Code is closed DURING development then released openly
AFTER release
§ Bazaar Model
§ Less organized form of development
4
LPIC-1 Exam 101 – Study Sheet
§ The idea of using more developers with openness where the hope
is to give better results at the end project
§ Chaotic way of development
§ This is the model Linus Torvalds used when developing the first
Linux Kernel
§ Common Development Languages
§ C
§ Java
§ Perl
§ Python
§ PHP
§ Types of languages
§ Compiled Languages
§ To compile or (convert) a program written from its source code to
the machine code known as binary
§ Interpreted Languages
§ Writing in human form language type of code
§ Line-By-Line code that is one line at a time and not from the
complete compiled application
§ Assembly Language
§ Very low-level code like binary (1’s and 0’s)
§ Package Management Tools and Repositories
§ Visual tools and command line tools
§ dpkg, apt-get, rpm, yum
5
LPIC-1 Exam 101 – Study Sheet
6
LPIC-1 Exam 101 – Study Sheet
7
LPIC-1 Exam 101 – Study Sheet
§ Bounties – users can drive open source creation by offering to pay for new
software or new features in existing software
§ Donations – A lot of open source projects accept donations that help fund
their development.
§ Outside if these business methods a lot of open source projects come out of the
academics, non-for-profit organizations, governments, hobbyists and more.
Topic 2: Finding Your Way on a Linux System (weight: 9)
8
LPIC-1 Exam 101 – Study Sheet
§ bash – bourne again shell – the bash shell is an improved version of the sh shell
and is one of the most used today. Typically most Linux Distro’s default.
§ csh – C shell – the csh shell was originally developed for BSD Unix. Similar
Syntax to C programming.
§ tsch – tsch – the tsch shell is an improved version of the C shell. Default for most
FreeBSD systems.
§ zsh – Z shell – The Z shell is an improved version of the bash shell.
§ ksh – Korn Shell – The korn shell is an early shell that is similar to the C shell.
§ Toggle between shells:
§ Ctrl-Alt F1 Ctrl-Alt F6 _ return to the GUI environment with Ctrl-Alt-F7
§ Command Line Syntax
§ ls –a will show all files including hidden files
§ ls –d Directory Flag – will only list directories
§ ls –l long list of files and folders showing permissions string, owner, group,
size, and even the creation date
§ ls –R Recursive options; it displays a directory’s contents recursively
9
LPIC-1 Exam 101 – Study Sheet
ifconfig – This can manage our network card installed on our system and
§
can be used to display and modify our NIC config settings – only root can
use
§ ip addr – newer versions of Linux such as Red Hat CentOS to see NIC
settings
§ uname – This can return information about our Linux system and has
several options we can use known flags:
§ -s Displays the Linux kernel’s name
§ -n Displays the system’s hostname
§ -r Displays the Linux Kernel’s release number
§ -v Displays Linux Kernel’s version number
§ -m shows the system’s hardware architecture
§ -p processor type
§ -i hardware platform
§ -o operating system
§ -a will display all the information above at once
§ Command Line History
§ view the history of our command type: history
§ can change the config with HISTSIZE and HISTFILESIZE
§ example: export HISTFILESZIE=99999
§ Linux can do command line completion by starting command and then using the
tab key
§ SHELL configuration files:
§ /etc/bashrc Non-Login Shell system-wide functions and aliases
§ ~/.bashrc Non-Login Shell user-specific functions and alias
§ /etc/profile Login Shell system-wide shell env config param
§ ~/.bash_profile Login Shell user-specific shell preferences
§ ~/.bash_login Login Shell user-specific shell preferences
§ ~/.profile Login Shell user-specific shell preferences
§ ~/.bash_logout Login Shell user-specific shell preferences
10
LPIC-1 Exam 101 – Study Sheet
§ MANPATH
§ OLDPWD
§ OSTYPE
§ PATH
§ PSI
§ PWD
§ USER and USERNAME
§ You can view what a current Variable is with:
§ # echo $PATH
§ #echo $HOME
§ You can see current Environment Variables:
§ env –list variables
§ env | more will allow you to page through the output of these variables
§ set – will show all the variables HOWEVER in Alphabetical order
§ Editing Environment Variables
§ View path:
§ echo $PATH (will return)
§ /usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/user/.l
ocal/bin:/home/user/bin
§ We can add a folder to this path by adding to our $PATH
§ PATH=$PATH:/var/opt/
§ Change the path globally in the /etc/bashrc file
§ Globbing
§ the process of using wildcard characters for expanding non-specific file names.
§ an asterisk (*) matches any characters
§ $ ls *.jpg #list all JPEG files
§ $ ls ?..jpg #list JPEG files with 1 char name (eg a.jpg, 1.jpg)
§ [] brackets bracketed value can match any character within the set of []
§ $ rm [A-Z]*.jph #This Removes JPEG files that start with a capital
letter A through Z.
§ Quoting
§ There are three acting mechanisms or types: escape character, single
quotes, and double quotes.
§ (\) a non-quoted backslash is the escape character
§ <newline>
§ “ ” Enclosing your characters in a double quotes preserves the
literal value of ALL characters within those double quotes
EXCEPT the ( $,’,\. and if the history expansion is enabled. (!)
§ ‘ ‘ Enclosing your characters within single quotes preserves the
literal value of each character within the quotes
11
LPIC-1 Exam 101 – Study Sheet
12
LPIC-1 Exam 101 – Study Sheet
§ newer than man but offers help and information about utilities and programs like
man
13
LPIC-1 Exam 101 – Study Sheet
§ /home directory that contains the subdirectories that serve as home directories for our
user accounts that live on our linux system
§ /lib directory contains code libraries used by programs that live in /bin and /sbin
§ /media directory is used by some linux distros like OpenSUSE and Fedora to mount
internal devices, including optical drives and USB drives
§ /mnt directory is used by some linux distros to mount external drives like cd drives,
dvd drives, usb drives and more
§ /opt this directory contains files for some programs you install on the system
§ /proc this directory is different than the others in this list. The /proc doesn’t
actually exist in the file system… instead, it’s a pseudo-file system that is dynamically
created whenever it is accessed. It’s used to access process and other system information
from the linux kernel. Within the /proc, there are several subdirectories and each of
these subdirectories is identified with a number and not a name. These numbers actually
correspond to Process ID numbers or (PID) number of the associated software process
§ /root the /root directory is the root user’s home directory - the root’s home dir always
lives outside the rest of the OS’s user account’s home dirs
§ /sbin this directory contains important system management and administration files,
such as fdisk, fsch, ifconfig, ifconfig, init, mkfs, shutdown, and halt.
§ /srv this directory contains subdirectories where services running on the system
(like httpd for apache or even ftpd) actually save their files
§ /sys contains information about the hardware in your system
§ /tmp directory contains temporary files created by you or by the system
§ /usr contains application files; most of the application files used on your system are
stored in a subdirectory of /usr. These subdirectories include the following:
§ /usr/bin Most of your executable programs
§ /usr/lib Library files
§ /usr/lib64 64-bit versions of your library files
§ /usr/local locally installed software that you created yourself (used to
prevent it from being overwritten during a system update)
§ /usr/sbin system administration programs
§ /usr/share This is where Documentation and man page files reside
§ /var this directory contains our linux variable data, and linux log files
14
LPIC-1 Exam 101 – Study Sheet
15
LPIC-1 Exam 101 – Study Sheet
Topic 3: The Power of the Command Line (weight: 9)
16
LPIC-1 Exam 101 – Study Sheet
§tar-xvf backup.tar
§ -x extract from an archive
§ -f specify the file
§ Compress these tar files using:
§ gzip, gunzip, bzip, and bzip2
§ gzip and gunzip file extensions:
§ .gz
§ bzip2 extension
§ .bz2
§ Compress a file called file2.txt with GZIP:
§ gzip file2.txt
file2.txt.gz
§ Decompress the .gz files:
§ gunzip file2.txt.gz
or
gzip -d file2.txt.gz
§ Compress a file called file2.txt with BZIP2:
§ bzip2 file2.txt
file2.txt.bz2
§ Decompress the .bz2 file:
§ bunzip2 file2.txt.bz2
§ dd
§ dd can be used to create an image file of an entire hard disk.
§ Syntax: dd if=device_file of=output_file
§ Example
§ dd if=/dev/sdb of=/mnt/backdrive/drivebackup
17
LPIC-1 Exam 101 – Study Sheet
18
LPIC-1 Exam 101 – Study Sheet
19
LPIC-1 Exam 101 – Study Sheet
20
LPIC-1 Exam 101 – Study Sheet
§ /lib
§ dynamic libraries
§ /var/lib
21
LPIC-1 Exam 101 – Study Sheet
Description: Querying vital networking configuration and determining the basic requirements
for a computer on a Local Area Network (LAN)
§ Protocol – Is a common networking language that must be configured for
network hosts to communicate
§ The Internet Protocol (IP) – Works in conjunction with the TCP or the
UDP to fragment, transmit, defragment, and resequence network data
§ TCP – Core protocol to the internet protocol suite; provides reliable,
ordered, and error-checked delivery
§ UDP – User datagram protocol is a simple connectionless transmission
protocol that does not guarantee delivery
§ ICMP – Internet control message protocol is used to test and verify
network communications between hosts
§ The OSI Reference model is layers that break down the overall
compunction process into specific terms:
• Physical
• Data Link
• Network
• Transport
• Session
• Presentation
• Application
§ PORT – is a logical connection provided by TCP and UDP for the upper
layers – see common ports also in this study guide
• Ports are lumped in to:
§ well-known ports
§ registered ports
§ dynamic ports
§ Each host on your network must have a unique IP address that is assigned
to it as well as the correct subnet mask
§ Subnet mask – defines how much of a given host’s IP address is the
network address and how much is the IP address.
§ IP addresses are categorized into the following classes and default subnet
mask:
• Class A – 255.0.0.0
• Class B – 255.255.0.0
• Class C – 255.255.255.0
§ DNS servers – need resolve IP addresses to domain names
§ Public subnets – Must be globally unique and are registered IP addresses
§ Private subnets – are networks that are non-routable globally; they are not
registered IP addresses
22
LPIC-1 Exam 101 – Study Sheet
§ NAT – can be used to hide out private subnet and IP addresses and are
behind one or more publically unique globally accessed IP address
§ You can assigne an IP address to a Linux interface:
• ifconfig interface ip_address netmask subnet_mask broadcast
broadcast_address
§ We specify our DNS servers in our Linux file at /etc/resolv.conf file
§ ifdown is used to bring a Linux interface down
§ ifup is used to bring a Linux interface up
§ dhclient interface is used to dynamically assign an address to an interface
§ ping – is used to test connectivity between host
§ netstat – is used to view a network interface information using –a, -I, -r, -l
§ traceroute – used to trace the route that your packets follow to reach a
remote system
• example: traceroute 4.4.4.4 (traceroutes your location to googles DNS)
23
LPIC-1 Exam 101 – Study Sheet
24
LPIC-1 Exam 101 – Study Sheet
25
LPIC-1 Exam 101 – Study Sheet
-rw-r--r--
420 4 4
6 4 4 = 644
26
LPIC-1 Exam 101 – Study Sheet
permissions with 777. We add a sticky bit permission to this file and only
the owners that created files can delete their own files and not others.
§ Add the sticky bit to a folder:
§ chmof o+t nameoffolder
§ SUID
§ Set User ID
§ SUID: 4
§ SGID: 2
§ Example using Special Permission with the extra digit at the beginning:
§ chmod 6554 file1
§ This means that the SUID(4) and the SGID(2) so the total of the
first of the four digits would be 6. Also the owner and group have
(4) and execute permissions of (1) for a total of (5) in the second
and third digits. It furthermore says that the others are allowed to
read (4) but they can not modify or run (so the last digit total is 4);
so the total bits are 6554 for file1 shown above.
27
Richard Stallman founded the Free Software Foundation (FSF) in 1985 to advocate for software freedom, emphasizing that 'free' in the context of software should be understood as 'free as in speech, not free as in beer.' This perspective underscores the importance of freedoms related to use, modification, and redistribution of software. The FSF also promoted the General Public License (GPL), which was pivotal in granting end-users these freedoms, shaping the foundation for Open Source software culture .
File permissions in Linux enhance system security by controlling access to files and directories. Permissions are set using a combination of read, write, and execute rights, applied distinctly to the owner, group, and others. This granularity allows administrators to tailor access permissions precisely, thereby minimizing potential vulnerabilities. Enhanced security features like mutable sticky bits further protect system integrity by ensuring that only file creators or system administrators can modify or delete files within certain directories, regardless of the broader permissions set .
Open Source business models can survive and thrive by offering value-added services such as support, customization, and implementation to clients who use their freely available software. Companies may also employ a dual-licensing strategy, offering one open-source version and another with proprietary features, which allows monetization through differentiated offerings. Additionally, enterprises might diversify by offering multiple complementary products or services, thereby leveraging the open-source ecosystem to provide comprehensive solutions to their customers .
The Open Source philosophy fundamentally differs from proprietary software models like Unix and Windows in terms of transparency and user control. Open Source allows for the source code to be freely available to anyone to download, modify, and redistribute. This openness promotes collaborative development and innovation while keeping the process transparent. In contrast, proprietary software like Unix and Windows are developed in-house, often with source code that is not accessible to external developers, preventing modifications and redistribution by users .
The 'Cathedral' model is characterized by structured and organized software development, where the source code is closed during development and only released afterward. In contrast, the 'Bazaar' model employs an open, less organized approach where multiple developers contribute openly throughout the development process. Linus Torvalds utilized the Bazaar model to develop the first Linux Kernel, which was unique as it leveraged decentralized contributions, making Linux's development process more open and collaborative from its inception .
Package management tools like dpkg, apt-get, rpm, and yum significantly simplify software management in Linux distributions by automating the process of software installation, removal, and updating. These tools manage dependencies, ensuring that all required software components are present, reducing the likelihood of installation errors. They also offer user-friendly interfaces for managing packages, which can be especially beneficial in server administration by streamlining maintenance tasks and ensuring systems remain up-to-date with minimal manual intervention .
The ext4 filesystem offers several advantages over its predecessors ext2 and ext3, including improved performance, support for larger filesystem sizes, and enhanced stability and reliability. ext4 introduces features like delayed allocation and multi-block allocation, which optimize the allocation process and reduce fragmentation. It also provides backward compatibility with ext3, allowing for a smooth transition without data loss. However, the complexity introduced by additional features may result in slightly increased overhead compared to ext2 .
The GNU toolset and other core Unix tools are critical to the functionality of Linux operating systems. These tools provide essential utilities for system management, disk, and resource handling, which are necessary for the OS's operation. The inclusion of tools like X-Windows for graphical interface support and command-line utilities contributes to the robustness, efficiency, and adaptability of Linux distributions, highlighting their importance in maintaining system functionality and user interaction capabilities .
The GPLv2 license allows the Linux Kernel to be used on closed-source hardware like TiVo and Android devices. This means that while the hardware may have restrictions, such as a locked boot process, the kernel itself remains open and modifiable. However, the use of restrictive boot processes to prevent unauthorized kernel modifications, a practice allowed under GPLv2, is something the GPLv3 intended to address by prohibiting such loopholes .
The setup of user accounts and management in Linux enhances system security and user autonomy by allowing precise control over user permissions and access. Accounts stored in the /etc/passwd and /etc/shadow files ensure that user credentials are secure yet organized for administrative access. The ability to manage groups and set specific permissions on files enables customization of user environments, ensuring that users have access only to required resources, thereby reducing the risk of unauthorized data access and enhancing overall system security .