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