LPIC-1 / Linux+ Cheat Sheet


101 System Architecture 14%

101.1 Determine and Configure hardware settings (LCN-3 CTL-3)

  • Enable and disable integrated peripherals
  • Configure systems with or without external peripherals such as keyboards
  • Differentiate between the various types of mass storage devices
  • Set the correct hardware ID for different devices, especially the boot device
  • Know the differences between coldplug and hotplug devices
  • Determine hardware resources for devices
  • Tools and utilities to list various hardware information (e.g., lsusb, lspci, etc.)
  • Tools and utilities to manipulate USB devices
  • Conceptual understanding of sysfs, udev, hald, dbus
  • Terms: /sys, /proc, /dev, modprobe, lsmod, lspci, lsusb
  • BIOS - Basic I/O System - systim init, memory testing, low-level system-config, OS boot order (CD, floppy, HD, PXE), internal HW clock
  • /proc fs is kernel's status repository: interrupts, dma, ioports
  • Universal Serial Bus (USB)
    • lsusb [-t] [-vv] - t-tree view, vv-very verbose
    • Open Host Controller Interface (OHCI) - USB 1.1
    • Universal Host Controller Interface (UHCI) - USB 1.1 - 12 MBps - low+full speed
    • Enhanced Host Controller Interface (EHCI) - USB 2.0 - 480 MBps - high speed
    • Extensible Host Controller Interface (XHCI) - USB 3.0 - 4 GBps - super speed
    • Wireless Host Controller Interface (WHCI) - Wireless USB 1.0 - 480 MBps
    • Effective speed is lowest speed of device, cable and hub
    • Classes of USB devices :
      • Human Interface Device (HID) - Input devices: mice, keyboards, etc.)
      • Communications device - Modems
      • Mass storage device - Disk devices, flash readers, etc.
      • Audio - Sound devices
      • IrDA - Infrared devices
      • Printer - Printers and USB-to-parallel cables
    • Linux kernel supported USB in v2.3.x, backported to 2.2.18
    • Linux drivers may be host controller drivers (e.g. usb-ohci.o), class drivers (e.g. hid.o, usb-storage.o, printer.o, audio.o) or device-specific drivers
    • usbcore.o → host controller driver → class/device driver
    • Modularized USB drivers are loaded by the generic /sbin/hotplug kernel support
  • lsdev - shows hardware including IRQ info, I/O ports and DMA channels
  • lspci [-t] [-vv] - info about system’s PCI buses and installed PCI devices
  • A module is dynamically linked into the running kernel when it is loaded
    • insmod/rmmod - insert/remove mocule, no dependency checking
    • modprobe [-r] [-a] [-t type] - list, insert or remove modules. Does dependency checking.
    • lsmod - list modules modinfo module-object-file.o - info about a module file
  • sysfs is a RAM-based filesystem derived from ramfs. It provides a means to export kernel data structures to user space. mount -t sysfs sysfs /sys
  • The udev process uses sysfs info to create dynamic device files as kernel modules are loaded. /etc/udev.d holds rules to be applied when adding or removing a device.
  • D-Bus is an IPC system that uses sysfs to implement a message bus daemon used for broadcasting system events e.g.“new device added” or “printer queue changed”.
  • hal was a hw abstraction layer (hw access API) on top of udev using D-Bus. It has been deprecated and rolled into udev and the kernel.

101.2 Boot the System (LCN-4 CTL-5)

  • Provide common commands to the boot loader and options to the kernel at boot time
  • Demonstrate knowledge of the boot sequence from BIOS to boot completion
  • Check boot events in the log file
  • Terms: /var/log/messages, dmesg, BIOS, bootloader, kernel, init
  • Boot Loader (LILO or GRUB) launches the linux kernel, passing kernel parameters if needed (/etc/lilo.conf | /boot/grub/menu.lst | /boot/grub/grub.conf)
  • Module options (as well as aliases and post-install and pre-remove actions) are stored in /etc/modules.conf .
  • dmesg displays kernel messages logged at last system boot.
  • /var/log/messages contains all syslog messages.

101.3 Change runlevels and shutdown or reboot system (LCN-4 CTL-5)

  • Set the default run level
  • Change between run levels including single user mode
  • Shutdown and reboot from the command line
  • Alert users before switching run levels or other major system events
  • Properly terminate processes
  • Knowledge of basic features of systemd and Upstart
  • Terms: /etc/inittab, shutdown, init, /etc/init.d, telinit
  • When linux boots, first process is the init process which selects and switches to default runlevel.
  • Runlevels - 0=shutdown, 1/s/S=single-user_maintenance, 2=multi-user, 3=multi-user_no-X, 5=multi-user_with-X 6=reboot
  • On Debian, 2 is default and 3,5 are not used. On Redhat, 3 is the default.
  • /etc/rc script to change runlevels on redhat (also init/telinit script)
  • /etc/rc.sysinit (Redhat) or /etc/init.d/rcS (Debian) - system init script launched by init before system daemons
  • /etc/rc.local- local startup actions called at end of startup
  • /etc/init.d contains startup/shutdown scripts for all system services
  • /etc/rc0.d - /etc/rc6.d contain softlinks KNNservice or SNNservice specifying whether to start or stop services and in what order for that runlevel (done by init process). Kills done before starts.
  • /etc/inittab contains “id:N:initdefault:” for default runlevel N
  • runlevel shows current and previous runlevel
  • shutdown [options] time [warning message] - -f=fastboot -h=halt -r=reboot -F=force-startup-checks -k=just-send-warning . Time is “now” or “+N” in N minutes or absolute time e.g. 23:58.

102 Installation and Package Management 18%

102.1 Design hard disk layout (LCN-5 CTL-3)

  • Allocate filesystems and swap space to separate partitions or disks
  • Tailor the design to the intended use of the system
  • Ensure the /boot partition conforms to the hardware architecture requirements for booting
  • Knowledge of basic features of LVM
  • Terms: / (root) filesystem, /var filesystem, /home filesystem, swap space, mount points, partitions
  • choosing a disk layout for linux depends on amount of disk space, purpose of the system, size of the system and backup strategy. Some general guidelines are
    • If diskspace is limited, just /boot, / and /swap
    • /boot is a separate 50MB partition because older kernels/BIOS require kernels under a 1024 cylinder limit.
    • For larger systems keep / smaller/simpler to reduce risk of corruption.
    • Can use separate partitions for /var (to isolate system logs), /tmp (to isolate tempfiles), /home (for backup and RAIDing of user's data)
    • Using a separate partition for /usr allows it to be shared via read-only NFS which allows for saving space and easier maintenance of apps/updates.
  • Superblock on filesystem contains critical metadata so multiple redundant copies are kept.
  • Filesystems must be mounted (listed in filesystem table) before being accessible. /etc/fstab is a list of filesystems to mount on boot up.
  • Master Boot Record on first 512 bytes of first sector of disk contains info on partitions and bootup. Can be backed up and restored with
    dd if=/dev/hda of=~/mbr.txt count=1 bs=512
    dd if=~/mbr.txt of=/dev/hda count=1 bs=512
  • To backup/restore just the partition layout, use sfdisk
    sfdisk -d /dev/hda > partition_backup.txt
    sfdisk /dev/hda < partition_backup.txt
  • Linux may also be booted from Live USB which allows for persistent modifications. If the BIOS does nto support this, a bootable CD can be used first.
  • Swap space allows main memory to be temporarily copied to disk. As a starting point set swap to twice the memory size (at least the same size).

102.2 Install a boot manager (LCN-5 CTL-5)

  • Providing alternative boot locations and backup boot options
  • Install and configure a boot loader such as GRUB Legacy
  • Perform basic configuration changes for GRUB 2
  • Interact with the boot loader
  • Terms: /boot/grub/menu.lst, grub.cfg and other variations, grub-install, MBR, superblock
  • BIOS looks for and runs boot loader from first specified boot device.
  • Boot loader find and loads specified kernel (with specified kernel options) which loads required modules and starts system processes.
  • LILO is a 2-stage program
    • First stage is in 512-byte MBR or in the boot sector of a partition (if it is a secondary boot loader).
    • Second stage is in /boot/boot.b .
    • Map file locating kernel is in /boot/map
    • lilo command reads /etc/lilo.conf which contains kernel image locations, kernel options, the default boot disk etc. It encodes this information along with physical disk information and writes it into the boot files (MBR/boot-sector, boot.b and map).
  • GRUB is a multi-stage boot loader, more flexible than LILO.
    • Changes take effect immediately.
    • (hd0,1) → 2nd partition on the 1st hard disk. Refers only to the order of the disks as seen by the BIOS so order may change if BIOS boot order is changed.
    • grub-install writes to MBR/boot sector. Uses/boot/grub/device.map to map BIOS drives to Linux devices e.g. “(hd0) /dev/sda”.
    • Grub command-line expects a specific order of commands to boot kernel
      grub> root (hd0,0)
      grub> kernel /vmlinuz-2.4.18-14 ro root=/dev/hda2
      grub> initrd /initrd-2.4.18-14.img  [optional]
      grub> boot

102.3 Manage shared libraries (LCN-5 CTL-2)

  • Identify shared libraries
  • Identify the typical locations of system libraries
  • Load shared libraries
  • Terms: ldd, ldconfig, /etc/ld.so.conf, LD_LIBRARY_PATH
  • Most programs on Linux use common system libraries.
  • These can be statically linked into the program at compile-time - more disk, more memory, slower.
  • Or can be dynamically loaded at runtime (shared libraries) - shared memory, smaller disksize, faster.
  • ldd can be used to display required shared libraries for an executable
  • Dynamically linked executables are examined at runtime by the shared object dynamic linker, ld.so
  • ldconfig reloads shared library paths from /etc/ld.so.conf to update binary cache /etc/ld.so.cache
  • $LD_LIBRARY_PATH env variable can also be used

102.4 Use Debian package management (LCN-5 CTL-2)

  • Install, upgrade and uninstall Debian binary packages
  • Find packages containing specific files or libraries which may or may not be installed
  • Obtain package information like version, content, dependencies, package integrity and installation status (whether or not the package is installed)
  • Terms: /etc/apt/sources.list, dpkg, dpkg-reconfigure, apt-get, apt-cache, aptitude
  • .deb package names - pkgname_version-revision_arch.deb . version is typically major.minor.patchlevel e.g ncurses4_4.2.3-9_i386.deb
  • dpkg operates directly on .deb packages
    • uses /var/lib/dpkg/[available|status] files to store metadata
    • -i=install -r=remove –purge=purge
    • -E=do not overwrite with same version or older
    • -G=do not overwrite with older package version
    • -l=list matching installed packages -L=list files from package
    • -s=status of package -S=search for file in installed packages
  • apt-get uses package names and sources and resolves dependencies
    • -d=download only -s=simulate -y=assume yes
    • install, remove, update (sources), upgrade (all packages), dist-upgrade (to new OS version)
    • uses /etc/apt/sources.list. Lines look like
       deb http://http.us.debian.org/debian stable main contrib non-free
  • dselect is a menu-based interface to dpkg
  • alien converts other package types to .deb packages (or to rpm with -r) e.g. Slackware/generic tarball, RPM . alien -i x.rpm

102.5 Use RPM and YUM package management (LCN-5 CTL-2)

  • Install, re-install, upgrade and remove packages using RPM and YUM
  • Obtain information on RPM packages such as version, status, dependencies, integrity and signatures
  • Determine what files a package provides, as well as find which package a specific file comes from
  • Terms: rpm, rpm2cpio, /etc/yum.conf, /etc/yum.repos.d/, yum, yumdownloader

103 GNU / Unix Commands 43%

103.1 Work on the command line (LCN-6 CTL-1)

  • Use single shell commands and one line command sequences to perform basic tasks on the command line
  • Use and modify the shell environment including defining, referencing and exporting environment variables
  • Use and edit command history
  • Invoke commands inside and outside the defined path
  • Terms: ., bash, echo, env, exec, export, pwd, set, unset, man, uname, history

103.2 Process text streams using filters (LCN-6 CTL-1)

  • Send text files and output streams through text utility filters to modify the output
  • Using standard UNIX commands found in the GNU textutils package
  • Terms: cat, cut, expand, fmt, head, od, join, nl, paste, pr, sed, sort, split, tail, tr, unexpand, uniq, wc

103.3 Perform basic file management (LCN-6 CTL-4)

  • Copy, move and remove files and directories individually
  • Copy multiple files and directories recursively
  • Remove files and directories recursively
  • Use simple and advanced wildcard specifications in commands
  • Using find to locate and act on files based on type, size, or time
  • Usage of tar, cpio, and dd
  • Terms: cp, find, mkdir, mv, ls, rm, rmdir, touch, tar, cpio, dd, file, gzip, gunzip, bzip2, file globbing

103.4 Use streams, pipes and redirects (LCN-6 CTL-1)

  • Redirecting standard input, standard output and standard error
  • Pipe the output of one command to the input of another command
  • Use the output of one command as arguments to another command
  • Send output to both stdout and a file
  • Terms: tee, xargs

103.5 Create, monitor and kill processes (LCN-6 CTL-2)

  • Run jobs in the foreground and background
  • Signal a program to continue running after logout
  • Monitor active processes
  • Select and sort processes for display
  • Send signals to processes
  • Terms: &, bg, fg, jobs, kill, nohup, ps, top, free, uptime, killall

103.6 Modify process execution priorities (LCN-6 CTL-2)

  • Know the default priority of a job that is created
  • Run a program with higher or lower priority than the default
  • Change the priority of a running process
  • Terms: nice, ps, renice, top

103.7 Search text files using regular expressions (LCN-6 CTL-1)

  • Create simple regular expressions containing several notational elements
  • Use regular expression tools to perform searches through a filesystem or file content
  • The following is a partial list of the used files, terms and utilities: grep, egrep, fgrep, sed, regex(7)

103.8 Perform basic file editing operations using vi (LCN-6 CTL-5)

  • Navigate a document using vi
  • Use basic vi modes
  • Insert, edit, delete, copy and find text
  • Terms: vi, /, ?, h, j, k, l, i, o, a, c, d, p, y, dd, yy, ZZ, :w!, :q!, :e!

104 Devices, Filesystems, Filesystem Hierarchy 25%

104.1 Create partitions and filesystems (LCN-7 CTL-3)

  • Use various mkfs commands to set up partitions and create various filesystems such as: ext2, ext3, xfs, reiserfs v3, vfat
  • Terms: fdisk, mkfs, mkswap

104.2 Maintain the integrity of filesystems (LCN-7 CTL-3)

  • Verify the integrity of filesystems
  • Monitor free space and inodes
  • Repair simple filesystem problems
  • Terms: du, df, fsck, e2fsck, mke2fs, debugfs, dumpe2fs, tune2fs, xfs tools (such as xfs_metadump and xfs_info)

104.3 Control mounting and unmounting of filesystems (LCN-7 CTL-3)

  • Manually mount and unmount filesystems
  • Configure filesystem mounting on bootup
  • Configure user mountable removeable filesystems
  • Terms: /etc/fstab, /media, mount, umount

104.4 Manage disk quotas (LCN-7 CTL-4)

  • Set up a disk quota for a filesystem
  • Edit, check and generate user quota reports
  • Terms: quota, edquota, repquota, quotation

104.5 Manage file permissions and ownership (LCN-7 CTL-4)

  • Manage access permissions on regular and special files as well as directories
  • Use access modes such as suid, sgid and the sticky bit to maintain security
  • Know how to change the file creation mask
  • Use the group field to grant file access to group members
  • Terms: chmod, umask, chown, chgrp
  • Create links
  • Identify hard and/or soft links
  • Copying versus linking files
  • Use links to support system administration tasks
  • Terms: ln

104.7 Find system files and place files in the correct location (LCN-7 CTL-4)

  • Understand the correct locations of files under the FHS
  • Find files and commands on a Linux system
  • Know the location and propose of important file and directories as defined in the FHS
  • Terms: find, locate, updatedb, whereis, which, type, /etc/updatedb.conf


105 Shells, Scripting and Data Management 17%

105.1 Customize and use the shell environment (LCN-13 CTL-9)

  • Set environment variables (e.g., PATH) at login or when spawning a new shell
  • Write BASH functions for frequently used sequences of commands
  • Maintain skeleton directories for new user accounts
  • Set command search path with the proper directory
  • Terms: /etc/profile, env, export, set, unset, ~/.bash_profile, ~/.bash_login, ~/.profile, ~/.bashrc, ~/.bash_logout, function, alias, lists

105.2 Customize or write simple scripts (LCN-13 CTL-9)

  • Use standard sh syntax (loops, tests)
  • Use command substitution
  • Test return values for success or failure or other information provided by a command
  • Perform conditional mailing to the superuser
  • Correctly select the script interpreter through the shebang (#!) line
  • Manage the location, ownership, execution and suid-rights of scripts
  • Terms: for, while, test, if, read, seq

105.3 SQL data management (LCN-13 CTL-9)

  • Use of basic SQL commands
  • Perform basic data manipulation
  • Terms: insert, update, select, delete, from, where, group by, order by, join

106 User Interfaces and Desktops 8%

106.1 Install and configure X11 (LCN-14 CTL-6)

  • Verify that the video card and monitor are supported by an X server
  • Awareness of the X font server
  • Basic understanding and knowledge of the X Window configuration file
  • Terms: /etc/X11/xorg.conf, xhost, DISPLAY, xwininfo, xdpyinfo, X

106.2 Setup a display manager (LCN-14 CTL-6)

  • Turn the display manager on or off
  • Change the display manager greeting
  • Change default color depth for the display manager
  • Configure display managers for use by X-stations
  • Terms: /etc/inittab; plus xdm, kdm, and gdm configuration files

106.3 Accessibility (LCN-14 CTL-6)

  • Keyboard Accessibility Settings (AccessX)
  • Visual Settings and Themes
  • Assistive Technology (ATs)
  • Terms: Sticky/Repeat Keys, Slow/Bounce/Toggle Keys, Mouse Keys, High Contrast/Large Print Desktop Themes, Screen Reader, Braille Display, Screen Magnifier, On-Screen Keyboard, Gestures (used at login, for example gdm), Orca, GOK, emacspeak

107 Administrative Tasks 20%

  • Add, modify and remove users and groups
  • Manage user/group info in password/group databases
  • Create and manage special purpose and limited accounts
  • Terms: /etc/passwd, /etc/shadow, /etc/group, /etc/skel, chage, groupadd, groupdel, groupmod, passwd, useradd, userdel, usermod

107.2 Automate system administration tasks by scheduling jobs (LCN-15 CTL-9)

  • Manage cron and at jobs
  • Configure user access to cron and at services
  • Terms: /etc/cron.{d,daily,hourly,monthly,weekly}, /etc/at.deny, /etc/at.allow, /etc/crontab, /etc/cron.allow, /etc/cron.deny, /var/spool/cron/*, crontab, at, atq, atrm

107.3 Localization and internationalization (LCN-15 CTL-6)

  • Locale settings
  • Timezone settings
  • Terms: /etc/timezone, /etc/localtime, /usr/share/zoneinfo, environment variables (LC_*, LC_ALL, LANG, TZ), /usr/bin/locale, tzselect, tzconfig, date, iconv, UTF-8, ISO-8859, ASCII, Unicode

108 Essential System Services 17%

108.1 Maintain system time (LCN-16 CTL-7)

  • Set the system date and time
  • Set the hardware clock to the correct time in UTC
  • Configure the correct timezone
  • Basic NTP configuration
  • Knowledge of using the pool.ntp.org service
  • Terms: /usr/share/zoneinfo, /etc/timezone, /etc/localtime, /etc/ntp.conf, date, hwclock, ntpd, ntpdate, pool.ntp.org

108.2 System logging (LCN-16 CTL-7)

  • Syslog configuration files
  • syslog standard facilities, priorities and actions
  • Terms: syslog.conf, syslogd, klogd, logger

108.3 Mail Transfer Agent (MTA) basics (LCN-17 CTL-9)

  • Create e-mail aliases
  • Configure e-mail forwarding
  • Knowledge of commonly available MTA programs (postfix, sendmail, qmail, exim) (no configuration)
  • Terms: ~/.forward, sendmail emulation layer commands, newaliases, mail, mailq, postfix, sendmail, exim, qmail

108.4 Manage printers and printing (LCN-18 CTL-6)

  • Basic CUPS configuration (for local and remote printers)
  • Manage user print queues
  • Troubleshoot general printing problems
  • Add and remove jobs from configured printer queues
  • Terms: CUPS configuration files, tools and utilities; /etc/cups; lpd legacy interface (lpr, lprm, lpq)

109 Networking Fundamentals 23%

109.1 Fundamentals of internet protocols (LCN-19 CTL-8)

  • Demonstrate an understanding network masks
  • Knowledge of the differences between private and public “dotted quad” IP-Addresses
  • Setting a default route
  • Knowledge about common TCP and UDP ports (20, 21, 22, 23, 25, 53, 80, 110, 119, 139, 143, 161, 443, 465, 993, 995)
  • Knowledge about the differences and major features of UDP, TCP and ICMP
  • Knowledge of the major differences between IPv4 and IPV6
  • Knowledge of the basic features of IPv6
  • Terms: /etc/services, ftp, telnet, host, ping, dig, traceroute, tracepath

109.2 Basic network configuration (LCN-20 CTL-8)

  • Manually and automatically configure network interfaces
  • Basic TCP/IP host configuration
  • Terms: /etc/hostname, /etc/hosts, /etc/resolv.conf, /etc/nsswitch.conf, ifconfig, ifup, ifdown, route, ping

109.3 Basic network troubleshooting (LCN-21 CTL-8)

  • Manually and automatically configure network interfaces and routing tables
  • Including adding, starting, stopping, restarting, deleting or reconfiguring network interfaces
  • Change, view or configure the routing table and correct an improperly set default route manually
  • Debug problems associated with the network configuration
  • Terms: ifconfig, ifup, ifdown, route, host, hostname, dig, netstat, ping, traceroute

109.4 Configure client side DNS (LCN-20 CTL-8)

  • Demonstrate the use of DNS on the local system
  • Modify the order in which name resolution is done
  • Terms: /etc/hosts, /etc/resolv.conf, /etc/nsswitch.conf

110 Security 15%

110.1 Perform security administration tasks (LCN-22 CTL-10)

  • Audit a system to find files with the suid/sgid bit set
  • Set or change user passwords and password aging information
  • Being able to use nmap and netstat to discover open ports on a system
  • Set up limits on user logins, processes and memory usage
  • Basic sudo configuration and usage
  • Terms: find, passwd, lsof, nmap, chage, netstat, sudo, /etc/sudoers, su, usermod, ulimit

110.2 Setup host security (LCN-23 CTL-10)

  • Awareness of shadow passwords and how they work
  • Turn off network services not in use
  • Understand the role of TCP wrappers
  • Terms: /etc/nologin, /etc/passwd, /etc/shadow, /etc/xinetd.d/*, /etc/xinetd.conf, /etc/inetd.d/*, /etc/inetd.conf, /etc/inittab, /etc/init.d/*, /etc/hosts.allow, /etc/hosts.deny

110.3 Securing data with encryption (LCN-24 CTL-10)

  • Perform basic OpenSSH 2 client configuration and usage
  • Understand the role of OpenSSH 2 server host keys
  • Perform basic GnuPG configuration and usage
  • Understand SSH port tunnels (including X11 tunnels)
  • Terms: ssh, ssh-keygen, ssh-agent, ssh-add, ~/.ssh/id_rsa and id_rsa.pub, ~/.ssh/id_dsa and id_dsa.pub, /etc/ssh/ssh_host_rsa_key and ssh_host_rsa_key.pub, /etc/ssh/ssh_host_dsa_key and ssh_host_dsa_key.pub, ~/.ssh/authorized_keys, /etc/ssh_known_hosts, gpg, ~/.gnupg/*
Recent changes RSS feed Creative Commons License Donate Minima Template by Wikidesign Driven by DokuWiki