Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
150 Cards in this Set
- Front
- Back
Two major Linux package management tools exist
|
RPM and Debian packages. (Several less-common
package management systems also exist.) |
|
libraries (def)
|
software components that can be used by many different
programs. Libraries help reduce the disk space and memory requirements of complex programs, but they also require some attention; if that attention isn’t given to them, they can cause problems by their absence or because of incompatibilities between their and their dependent software’s versions. |
|
Packages (def)
|
collections of files that are installed on the computer. Packages are usually distributed as single files similar to tarballs or zip
|
|
installed file db (def)
|
Package systems maintain a DB of installed files. The DB includes info about every file installed via the package system
|
|
Binary package creation
|
Both the RPM and Debian package systems provide tools to help create binary packages (those that are installed directly) from source code. This feature is particularly helpful if you’re running Linux on a peculiar CPU; you can download source code and create a binary package even if the developers didn’t provide explicit support for your CPU. Creating a binary package from source has advantages over compiling software from source in more conventional ways, because you can then use the package management system to track dependencies, attend to individual files, and so on.
|
|
convention for naming RPM packages
packagename-a.b.c-x.arch.rpm |
packagename - name of package
x - build number(release number) - minor changes a.b.c - version number - assigned by author arch - architecture - code for package architecture |
|
packagename arch codes
packagename-a.b.c-x.arch.rpm |
packagename-a.b.c-x.arch.rpm
arch is code for the package’s architecture i386 for 80386 onward i586/i686 for Pentiums or above ppc for PowerPC CPU x86_64 for x86-64 platforms |
|
Yum (abbr and def)
|
Yum
Yellow Dog Updater Modified RPM meta-packagers |
|
rpm Command Set
|
main RPM utility program is known as rpm. Use this program to install or upgrade a package at the shell prompt
rpm [operation][options] [package-files|package-names] |
|
rpm operation
-i -U -F or --freshen |
-i
installs a packages; system must not contain packge of the same name -U install a new package or upgrades an existing one -F or --freshen upgrades a package only if an earlier version already exists |
|
rpm operation
-q -V or --verify -e |
-q
Quarries a package - finds if a package is installed, what file it contains -V or --verify Verifies a package - checks that its files are present -e Uninstalls a packages |
|
rpm operations
-b --rebuild --rebuilddb |
-b
builds a binary package given a src code and config files --rebuild builds a binary package given a RPM source --rebuilddb rebuilds the RPM DB to fix errors |
|
rpm options
--root dir --force |
--root dir
used with any operation modifies the linux system having a root folder located at dir --force used with operation -i. -U, -F forces installation of a package even when it means overwriting existing files or packages |
|
rpm options
-h or --hash -v |
-h or --hash
used with operation -i. -U, -F Displays a series of hash marks # to indicate progress -v used with operation -i. -U, -F used with -h option to produce a uniform number of # for each page |
|
rpm options
--nodeps --test -p package-file |
--nodeps
used with operation -i. -U, -F, -e Specifies that no dependency checks are performed --test used with operation -i. -U, -F Checks for dependencies, conflicts and other problems without actually installing the package -p package-file used with operation -q queries the uninstalled RPM package file |
|
rpm options
--prefix path -a or --all -f file or --file file |
--prefix path
used with operation -i, -U, -F Sets the installation dir to path -a or --all used with operation -q, -V Queries or verifies all packages -f file or --file file used with operation -q, -V Queries or verifies the package that owns the file |
|
rpm options
-i -R or --requires -l or --list |
-i
used with operation -q displays package info -R or --requires used with operation -q displays the packages and files on which this one depends -l or --list used with operation -q Displays the files contained in the package |
|
Verify that the package is installed with what cmd
|
rpm -qi samba-server
|
|
RPM files are actually modified _____ archives
|
RPM files are actually modified cpio archives.
Converting RPM files into cpio files and retrieve individual files is easy use the rpm2cpio program rpm2cpio samba-server-3.0.25b-4.5mdv2008.0.src.rpm➦ > samba-server-3.0.25b-4.5mdv2008.0.cpio |
|
Cmd sequence for
1)convertin RPM package to cpio file 2)extracting data from the cpio file |
$ rpm2cpio samba-server-3.0.25b-4.5mdv2008.0.src.rpm samba-server-3.0.25b-4.5mdv2008.0.cpio
$ cpio -i --make-directories < samba-server-3.0.25b-4.5mdv2008.0.cpio or pipe them $ rpm2cpio samba-server-3.0.25b-4.5mdv2008.0.src.rpm | cpio -i --make-directories |
|
Using Yum
|
one of several meta-packagers - it enables you to easily install a package and all its dependencies using a single cmd line
yu, [options] [cmd] [package...] |
|
Common yum cmd
install update |
install - install 1 or more packages by package name
update - updates the specified package to the latest available version (if no packages are specified, yum updates every installed package) |
|
Common yum cmd
check-update upgrade remove/erase |
check-update - checks to see whether updates are available
upgrade - works like update with the --obsoletes flag set remove/erase - deletes a packages from the system; similar to rpm -e, but yum also removes depended-on packages |
|
Common yum cmd
list provides/whatprovides search |
list - displays info about the package
provides/whatprovides - displays information about packages that provide a specified program or feature (like yum provides samba) search - searches package names, summaries, packagers and descriptions for a specified keyword |
|
Common yum cmd
info clean shell |
info - displays info about a package
clean - cleans up the Yum cache directory shell - enters the yum shell mode, in which you can enter multiple yum cmd one after another |
|
Common yum cmd
resolvedep localinstall localupdate deplist |
resolvedep - displays packages matching the specified dependency
localinstall - install the specified local RPM files, using your yum repositories to resolve dependencies localupdate - updates the system using the specified local RPM files, using your yum repositories to resolve dependencies deplist - display dependencies of the specified package |
|
yumdownloader
|
If you don’t want to install the package, but merely want to obtain it, you can use yumdownloader
|
|
yumex and kyum
|
If you prefer to use GUI tools rather than command-line tools, you should be aware that
GUI front-ends to yum exist. Examples include yumex and kyum. You can use the text-mode yum to install these front-ends, as in yum install kyum. |
|
the main RPM config file location
|
/usr/lib/rpm/rpmrc
this file sets a variety of options files should not be edited |
|
/etc/rpmrc
~/.rpmrc |
/etc/rpmrc
changes here affect RPM configuration on a global scope ~/.rpmrc change here are on per user bases Main reason to create such a file is to implement architecture optimization - for instance, to optimize your code for your CPU model by passing approprieate compiler options when you build a soucre RPM into a binary RPM |
|
RPM flas
optflags: athlon -02 -g -march=i686 |
the main reason to create /etc/rpcrc (global) or ~/.rpmrc (per user) is to implement architecture optimizations by passing apropriate compile options when you build a source RPM into binary ROM
optflags: athlon -02 -g -march=i686 tells RPM to pass the options to the compiler whenever building for the athlon platform |
|
Most default rpmrc files include a series of buildarchtranslate line that cause rpmbuild to use one set of optimization for a whole family of CPU (use with addition to optflags:). How the look
|
For x86 systems
buildarchtranslate: athlon: i386 buildarchtranslate: i686: i386 buildarchtranslate: i586: i386 buildarchtranslate: i486: i386 buildarchtranslate: i386: i386 These lines tell RPM to translate the athlon, i686, i586, i486, and i386 CPU codes to use the i386 optimizations. This effectively defeats the purpose of any CPU-specific optimizations you create on the optflags line for your architecture, but it guarantees that the RPMs you build will be maximally portable. |
|
cmd to return the CPU type
|
uname -p
|
|
Yum is configured via what file
|
/etc/yum.conf
addition config files are in /etc/yum.repos.d/directory |
|
debian packages (notes)
|
Debian packages are incompatible with RPM packages, but the basic principles of operation are the same across both package types.
You used the dpkg command to install a Debian package dpkg [options][action] [package-files|package-name] |
|
dpkg actions - dpkg [options][action] [package-files|package-name]
-i or --install --configure -r or --remove |
-i or --install - Installs a package
--configure - Reconfigures an installed package: runs the post-installation script to set site-specific options -r or --remove Reconfigures an installed package: runs the post-installation script to set site-specific options |
|
dpkg actions - dpkg [options][action] [package-files|package-name]
-P or --purge -p or --print-avail -I or -- info |
-P or --purge - removes a package, including config files
-p or --print-avail - displays information about an installed package -I or -- info - display information about an uninstalled package file |
|
dpkg actions - dpkg [options][action] [package-files|package-name]
-l pattern or --list pattern -L or --listfiles -S pattern or --search pattern -C or --audit |
-l pattern or --list pattern - Lists all installed packages whose names match pattern
-L or --listfiles - Lists the installed files associated with a package -S pattern or --search pattern - Locates the package(s) that own the file(s) specified by pattern -C or --audit - Searches for partially installed packages and suggests what to do with them |
|
dpkg actions - dpkg [options][action] [package-files|package-name]
--root=dir -B or --auto-deconfigure --force-things --ignore-depends=package |
--root=dir - with all - modifies the linux system using a root directory located at dir
-B or --auto-deconfigure - used with -r - disables packages that rely on one that is being removbed --force-things - used with assorted - forces specific actions to be taken --ignore-depends=package - used with -r, -i - ignores dependency information for the specified package |
|
dpkg actions - dpkg [options][action] [package-files|package-name]
--no-act --recursive -G -E or --skip-same-version |
--no-act - used with -r, -i - Checks for dependencies, conflicts, and other problems without actually installing or removing the package
--recursive - used with -i - Installs all packages that match the package name wildcard in the specified directory and all subdirectories -G - used with -i - Doesn’t install the package if a newer version of the same package is already installed. -E or --skip-same-version - used with -i - Doesn’t install the package if the same version of the package is already installed. |
|
RPM flas
optflags: athlon -02 -g -march=i686 |
the main reason to create /etc/rpcrc (global) or ~/.rpmrc (per user) is to implement architecture optimizations by passing apropriate compile options when you build a source RPM into binary ROM
optflags: athlon -02 -g -march=i686 tells RPM to pass the options to the compiler whenever building for the athlon platform |
|
Most default rpmrc files include a series of buildarchtranslate line that cause rpmbuild to use one set of optimization for a whole family of CPU (use with addition to optflags:). How the look
|
For x86 systems
buildarchtranslate: athlon: i386 buildarchtranslate: i686: i386 buildarchtranslate: i586: i386 buildarchtranslate: i486: i386 buildarchtranslate: i386: i386 These lines tell RPM to translate the athlon, i686, i586, i486, and i386 CPU codes to use the i386 optimizations. This effectively defeats the purpose of any CPU-specific optimizations you create on the optflags line for your architecture, but it guarantees that the RPMs you build will be maximally portable. |
|
cmd to return the CPU type
|
uname -p
|
|
Yum is configured via what file
|
/etc/yum.conf
addition config files are in /etc/yum.repos.d/directory |
|
debian packages (notes)
|
Debian packages are incompatible with RPM packages, but the basic principles of operation are the same across both package types.
You used the dpkg command to install a Debian package dpkg [options][action] [package-files|package-name] |
|
dpkg actions - dpkg [options][action] [package-files|package-name]
-i or --install --configure -r or --remove |
-i or --install - Installs a package
--configure - Reconfigures an installed package: runs the post-installation script to set site-specific options -r or --remove Reconfigures an installed package: runs the post-installation script to set site-specific options |
|
dpkg actions - dpkg [options][action] [package-files|package-name]
-P or --purge -p or --print-avail -I or -- info |
-P or --purge - removes a package, including config files
-p or --print-avail - displays information about an installed package -I or -- info - display information about an uninstalled package file |
|
dpkg actions - dpkg [options][action] [package-files|package-name]
-l pattern or --list pattern -L or --listfiles -S pattern or --search pattern -C or --audit |
-l pattern or --list pattern - Lists all installed packages whose names match pattern
-L or --listfiles - Lists the installed files associated with a package -S pattern or --search pattern - Locates the package(s) that own the file(s) specified by pattern -C or --audit - Searches for partially installed packages and suggests what to do with them |
|
dpkg actions - dpkg [options][action] [package-files|package-name]
--root=dir -B or --auto-deconfigure --force-things --ignore-depends=package |
--root=dir - with all - modifies the linux system using a root directory located at dir
-B or --auto-deconfigure - used with -r - disables packages that rely on one that is being removbed --force-things - used with assorted - forces specific actions to be taken --ignore-depends=package - used with -r, -i - ignores dependency information for the specified package |
|
dpkg actions - dpkg [options][action] [package-files|package-name]
--no-act --recursive -G -E or --skip-same-version |
--no-act - used with -r, -i - Checks for dependencies, conflicts, and other problems without actually installing or removing the package
--recursive - used with -i - Installs all packages that match the package name wildcard in the specified directory and all subdirectories -G - used with -i - Doesn’t install the package if a newer version of the same package is already installed. -E or --skip-same-version - used with -i - Doesn’t install the package if the same version of the package is already installed. |
|
Debian higher-level utilities to handle package installation and removal
|
apt-get
dselect |
|
using apt-cache
|
intended to provide information about the package cache (Debian package DB)
|
|
package cache
|
in Debian distros the package DB is know as the package cache
|
|
cmd in apt-cache to display package information
package statistics |
package information - apt-cache showpkg <pkgname>
package statistics - apt-cache stats how many packages have been installed, dependencies that are recorded |
|
cmd in apt-cache to display unmet dependencies
dependies locate all packages |
unmet dependencies - apt-cache unmet
info about unmet dependencies display dependencies - apt-cache depends <pkgname> returns info about all dependencies for the specified package locate all packages - apt-cache pkgnames <str> returns only packages that start with the specified string |
|
apt-get (def + syntax)
|
apt-get is Debian's equivalent to Yum
its a meta packaging tool that enables to perform upgrades apt-get [options][command] [package-names] # apt-get update # apt-get dist-upgrade |
|
Debian-based system include a file that specifies location from which important packages can be obtained
|
/etc/apt/sources.list
|
|
apt-get cmd
update upgrade dselect-upgrade |
update - gets info about packages available from the installation sources
upgrade - upgrades all installed packages to the newest version available dselect-upgrade - performs any changes in package status left undone after running dselect |
|
apt-get cmd
dist-upgrade install remove source |
dist-upgrade - Similar to upgrade, but performs “smart” conflict resolution to avoid upgrading a package if doing so would break a dependency
install - install a package by package name remove - removes a specified package by package name source - Retrieves the newest available source package file by package filename using information about available packages and installation archives listed in /etc/apt/sources.list. |
|
apt-get cmd
check clean autoclean |
check - checks the package DB for consistency and broken package installation
clean - clears out info about retrieved files from the Debian package DB autoclean - like clean but removes info only about packages that can no longer be downloaded |
|
apt-get options
-d -f -m |
-d or --download-only
used wit upgrade, dselect-upgrade, install, source Desc: Downloads package files but doesn’t install them. -m, --ignore-missing, or --fix-missing used wit upgrade, dselect-upgrade, install, source Desc: Ignores all package files that can't be retrieved -f or --fix-broken used with install, remove Attempts to fix a system on which dependencies are unsatisfied |
|
apt-get options
-q -s -y |
-q or --quiet
used with All Omits some progress indicator information. -qq produces still less info -s, --simulate, --just-print, --dry-run, --recon, or --no-act used with All Performs a simulation of the action without actually modifying, installing, or removing files. -y, --yes, or --assume-yes used with All Produces a “yes” response to any yes/no prompt in installation scripts. |
|
apt-get options
-b --no-upgrade |
-b
used with source Compiles a source package after retrieving it. --no-upgrade used with install Causes apt-get to not upgrade a package if an older version is already installed. |
|
dselect program def
|
a high level package browser
|
|
path to the APT archives
|
/etc/apt/source.list
|
|
aptitude. program def
|
text-based Debian package manager
aptitude cmd install - aptitude install zsh remove - aptitude remove zsh full-upgrade safe-upgrade serach - aptitude search samba help - aptitude help |
|
Synaptic
|
tool that’s similar to dselect and aptitude in some ways is Synaptic, but Synaptic
is a fully GUI X-based program and as such is easier to use |
|
Reconfiguring Packages
|
Debian packages offer more options during set up than RPM.
If you want to alter a package after it has been installed run dpkg-reconfigure <package> this will re-run the installation scripts included in the package |
|
Debian pckg vs RPM pgck
|
Debian:
src pckg arent a single file must transport at least 2 file (tarball and patch) support just one patch file RPM: may contain multiple patch files |
|
What files are included in a Debian package file?
|
1)original source tarball
2)patch file used to modify the source code (including a file that control building a Debian package) 3).dsc file - containing a digital "signature" to help verify authenticity |
|
main config file for dkpg is ....
|
/etc/dpkg/dpkg.cfg or ~/dpkg.cfg
|
|
main config file for APT
|
/etc/apt/sources.list
also /ect/apt/apt.conf - Controls the APT dselect options |
|
ISC
BIND |
ICS-internet software consortium
BIND-berkley Internet NAme Domain |
|
alien program
|
comes with Debian and a few other
can install by using apt-get install alien main functionality is to convert between packages requires both package management software installed |
|
alien opt
--de-deb --to-rpm --to-slp --to-tgz |
--to-deb - converts Debian,
--to-rpm - converts RPM, --to-slp - converts Stampede, --to-tgz - converts tarball format |
|
Debian package to RPM
|
# alien --to-rpm someprogram-1.2.3-4_i386.deb
|
|
Debian-based system and want to install a tarball but keep a record of the files it contains in your Debian package database
|
# alien --install binary-tarball.tar.gz
|
|
Qt (expl)
|
all KDE programs rely on Qt, a widget set that provides assorted GUI tools. If Qt isn’t installed, you won’t be able to install any KDE packages using RPMs or Debian packages.
|
|
In rpm how to tell the program to ignore failed dependencies by
using |
rpm -i apackage.rpm --nodeps
|
|
In rpm how to tell the program to force installation over some other errors, such as conflicts with existing packages
|
rpm -i apackage.rpm --force
|
|
dpkg how to ignore dependencies
dpkg how to force any conflict problems |
--ignore-depends=package
--force-depends --force-conflicts |
|
RPM-based system, the command to rebuild a package is
|
# rpmbuild --rebuild packagename-version.src.rpm
do this you must have the source RPM for the package |
|
libc (desc)
|
libc is one of the most important libraries is the C library
|
|
widget sets (desc)
|
libraries are often called widget sets because they provide the on-screen widgets used by programs—buttons, scroll bars, menu bars, and so on.
|
|
glibc (desc)
|
glibc is version of the C library
|
|
n Linux, shared libraries usually have an extension of
|
.so or .so.version extension, where version is a version number. (.so stands for shared object.)
|
|
Linux static libraries (used by linkers for inclusion in programs when dynamic libraries aren’t to be used) have an extension
|
.a filename extensions
|
|
Static libraries are sometimes used by developers ...
|
Static libraries are sometimes used by developers who create programs using particularly odd, outdated, or otherwise exotic libraries. This enables them to distribute their binary packages without requiring users to obtain and install their oddball libraries.
|
|
to set a library path (global)
|
set the library path is to edit the /etc/ld.so.conf
file consists of a series of lines, each of which lists one directory in which shared library files may be found Ubuntu 8.04’s ld.so.conf begins with this line: include /etc/ld.so.conf.d/*.conf |
|
LD_LIBRARY_PATH environment variable
|
This environment variable specifies additional directories the system is to search for libraries.
Mainly use when you want to change the path not permanently/globally $ export LD_LIBRARY_PATH=/usr/local/testlib:/opt/newlib line adds two directories, /usr/local/testlib and /opt/newlib, to the search path. |
|
$ gimp
gimp: error while loading shared libraries: libXinerama.so.1: cannot open shared object file: No such file or directory What this message indicate? |
message indicates that the system couldn’t find the libXinerama.so.1 library file. The usual cause of such problems is that the library isn’t installed
|
|
creating a symbolic link will correct the problem
|
ln -s biglib.so.5.2 biglib.so.5
You must type this command as root in the directory in hich the library resides. You must then run ldconfig |
|
ldd program
|
displays a program’s shared library dependencies—that is, the shared libraries
that a program uses. |
|
ldconfig program
|
# ldconfig
updates caches and links used by the system for locating libraries—that is, it reads /etc/ld.so.conf and implements any changes in that file or in the directories to which it refers |
|
cmd to check which libraries the program file uses
|
$ ldd /bin/ls
librt.so.1 => /lib/librt.so.1 (0x0000002a9566c000) libncurses.so.5 => /lib/libncurses.so.5 (0x0000002a95784000) If the library name doesn’t contain a complete path, ldd attempts to find the true library and displays the complete path following the => symbol, as in /lib/librt.so.1 or /lib/libncurses.so.5. |
|
ldd cmd option -v
|
ldd -v
displays a long list of version information following the main entry. |
|
# ldconfig -v
# ldconfig -N # ldconfig -n # ldconfig -p |
# ldconfig -v - verbouse display - causes the program to summarize the directories and files it’s registering as it goes about its business
# ldconfig -N - dont rebuild cache - auses ldconfig to not perform its primary duty of updating the library cache # ldconfig -n - process only specified dir - causes ldconfig to update the links contained in the directories specified on the command line # ldconfig -p - display current info - causes ldconfig to display the current cache—all the library directories and the libraries they contain. |
|
# ldconfig -X
# ldconfig -f # ldconfig -C # ldconfig -r |
# ldconfig -X - dont update links - -X option is the opposite of -N; it causes ldconfig to update the
cache but not manage links # ldconfig -f - use a new config file - change the configuration file from /etc/ld.so.conf by using the -f conffile option, where conffile is the file you want to use # ldconfig -C - use a new cache file - change the cache file that ldconfig creates by passing the -C cachefile option, where cachefile is the file you want to use # ldconfig -r - use a new root - -r dir option tells ldconfig to treat dir as if it were the root (/) directory. This option is helpful when you’re recovering a badly corrupted system or installing a new OS |
|
uname command
|
display information about the kernel
|
|
# uname -n
# uname -s # uname -v |
# uname -n or --nodename
displays the system's node name (netwokr host name) # uname -s or --kernel-na display the kernel name, which is usually Linux # uname -v or --kernel-version this holds the kernel build date and time, not an actual version number |
|
# uname -r
# uname -m # uname -p |
# uname -r or --kernel-release
actual kernel version number can be found # uname -m or --machine returns information about your machine. This is likely to be a CPU code, such as i686 or x86_64. # uname -p or --processor return information about your CPU, such as the manufacturer, model, and clock speed; in practice, it returns unknown on many systems. |
|
# uname -i
# uname -o # uname -a |
# uname -i or --hardware-platform
Hardware platform information, but this often returns unknown # uname -o or --operating-system returns the OS name—normally GNU/Linux for a Linux system # uname -a or --all returns all available information. |
|
ps cmd
|
program displays processes’ status
ps [options] ps supports three different types of options Unix98 options - These single-character options may be grouped together and are preceded by a single dash (-). BSD options - These single-character options may be grouped together and must not be preceded by a dash. GNU long options - These multi-character options are never grouped together. They’re preceded by two dashes (--). |
|
PS_PERSONALITY environment
|
you can change some of ps default behaviors by setting the PS_PERSONALITY environment variable to posix, old, linux, bsd, sun, digital, or various others
|
|
ps --help
ps -A ps -e px x |
-help option presents a summary of some of the more common ps options
-A / -e / x By default, ps displays only processes that were run from its own terminal -A and -e options cause it to display all the processes on the system x displays all processes owned by the user who gives the cmd |
|
ps -u <user>
ps U <user> ps --User <user> |
<user> variable may be a username or a user ID
display processes owned by a given user with the -u user, U user, and --User user options |
|
ps -f
ps -l ps j ps l ps u |
The -f, -l, j, l, u, and v options all expand the information
provided in the ps output. |
|
ps -H
ps -f ps --forest ps -w or w |
The -H, -f, and --forest options group processes and use indentation to show the hierarchy of relationships between processes. These options are useful if you’re trying to trace the parentage of a process.
-w and w ps u tell ps not to do this, which can be useful if you direct the output to a file, as in ps w > ps.txt. |
|
ps -u rodsmith --forest (example)
|
$ ps -u rodsmith --forest
PID TTY TIME CMD 2451 pts/3 00:00:00 bash 2551 pts/3 00:00:00 ps 2496 ? 00:00:00 kvt 2498 pts/1 00:00:00 bash 2505 pts/1 00:00:00 \_ nedit 2506 ? 00:00:00 \_ csh 2544 ? 00:00:00 \_ xeyes 19221 ? 00:00:01 dfm |
|
ps u U rodsmith (example)
|
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
rodsmith 19221 0.0 1.5 4484 1984 ? S May07 0:01 dfm rodsmith 2451 0.0 0.8 1856 1048 pts/3 S 16:13 0:00 -bash rodsmith 2496 0.2 3.2 6232 4124 ? S 16:17 0:00 /opt/kd rodsmith 2498 0.0 0.8 1860 1044 pts/1 S 16:17 0:00 bash rodsmith 2505 0.1 2.6 4784 3332 pts/1 S 16:17 0:00 nedit rodsmith 2506 0.0 0.7 2124 1012 ? S 16:17 0:00 /bin/cs rodsmith 2544 0.0 1.0 2576 1360 ? S 16:17 0:00 xeyes rodsmith 2556 0.0 0.7 2588 916 pts/3 R 16:18 0:00 ps u U |
|
abriviations in ps screens
PID PPID TTY |
PID - process ID
PPID - parent process ID TTY - teletype code that identify the terminal. Not all processes have TTY - X programs and daemons dont |
|
abriviations in ps screens
CPU time CPU priority NI |
CPU time
TIME and %CPU headings are two measures of CPU time used. The first indicates the total amount of CPU time consumed, and the second represents the percentage of CPU time the process is using when ps executes CPU priority it’s possible to give different processes different priorities for CPU time NI lists these priority codes. The default value is 0. Positive values represent reduced priority, whereas negative values represent increased priority |
|
abriviations in ps screens
RSS %MEM SHARE |
RRS - resident set size
memory used by the program and its data %MEM the percentage of memory the program is using SHARE memory that's shared with other processes such as library |
|
It’s often necessary to find specific processes. You might want to find the PID associated with a particular command in order to kill it, for instance. This information can be gleaned by piping the ps output through grep, as in
|
ps ax | grep bash to find all the instances of bash.
|
|
top cmd
what are kpm and gnome-system-monitor? |
top: A Dynamic ps Variant
GUI variants of top |
|
top options
-d -p -n -b |
-d delay
specifies the delay between updates -p pid to monitor specific process, can specify up to for PID -n iter top displays certain number of updates (iterations) and stops -b batch mode, top doesn't use the normal screen-update cmds |
|
top when running cmds
h and ? k q |
h and ?
help info k kill a process, top will ask for PID q quits top |
|
top when running cmds
r s P M |
r
changes priority with this cmd, asks for PID number s displays update rate P sort by CPU usages M sort by memory usage |
|
load average
|
One of the pieces of information provided by top is the load average, which is a measure of the demand for CPU time by applications.
A system on which no programs are demanding CPU time has a load average of 0. A system with one program running CPU-intensive tasks has a load average of 1. Higher load averages reflect programs competing for available CPU time. |
|
uptime command
|
displays the load average along with information on how long the computer has been running
|
|
jobs command
|
displays minimal information about the processes associated with the current session.
second use of job is to determine if all apps are closed prior to us logging out |
|
If a program is running but you decide you want to use that terminal for something else, pressing ____ normally pauses the program and gives you control of the terminal.
|
Ctrl+Z
running a text editor in a textmode login, and you want to check a filename so you can mention it in the file you’re editing. You press Ctrl+Z and type ls to get the file listing. To get back to the text editor, you then type fg, which restores the text editor to the foreground of your terminal, if you have suspended more than 1 process use fg 2 |
|
fg cmd
bg cmd |
restores a job to the foreground
bg restores a job to running status, but in the background |
|
run a program in the background (third way)
|
you can append an ampersand (&) to the command when launching the program.
rather than edit a file with the NEdit GUI editor by typing nedit myfile.txt, you can type nedit myfile.txt & |
|
nice cmd
|
nice [argument] [command [command-arguments]]
You can assign a priority to nice in any of three ways: 1)by specifying the priority preceded by a dash 2)by specifying the priority after a -n parameter 3)by specifying the priority after an --adjustment= parameter In all cases there parameters are followed by the name of the program $ nice -12 number-crunch data.txt $ nice -n 12 number-crunch data.txt $ nice --adjustment=12 number-crunch data.txt |
|
renice cmd
|
If you’ve found that a running process is consuming too much CPU time or is being swamped by other programs and so should be given more CPU time, you can use the renice program to alter its priority without disrupting the program’s operation
renice priority [[-p] pids] [[-g] pgrps] [[-u] users] |
|
kill command
|
to terminate a process that should not be running use
kill kill -s signal pid |
|
kill -s signal parameter
|
You can specify the signal using either a number (such as 9) or a name (such as SIGKILL).
Signals you’re most likely to use 1 or SIGHUP - terminates interactive prog. and causes many daemons to reread their config 9 or SIGKILL - causes the process to exit without performing routine shutdown tasks 15 or SIGTERM (default) - causes process to exit but allows it ot close open files |
|
nohup cmd
|
If you want to run a program that will continue running even when you log out, you can launch it with the nohup program:
$ nohup program options This command causes the program to ignore the SIGHUP signal |
|
Which of the following is not an advantage of a source package over a binary package?
A. A single source package can be used on multiple CPU architectures. B. By recompiling a source package, you can sometimes work around library incompatibilities. C. You can modify the code in a source package, altering the behavior of a program. D. Source packages can be installed more quickly than binary packages can. |
D. Because they must be compiled prior to installation, source packages require more time to install than binary packages do, contrary to option D’s assertion.
The other options all describe advantages of source packages over binary packages. |
|
Which is true of using both RPM and Debian package management systems on one computer?
A. It’s generally inadvisable because the two systems don’t share installed-file database information. B. It’s impossible because their installed-file databases conflict with one another. C. It causes no problems if you install important libraries once in each format. D. It’s a common practice on Red Hat and Debian systems. |
A. Package management systems don’t share information, but neither do their databases actively conflict. Installing the same libraries using both systems would almost guarantee that the files served by both systems would conflict with one another. Actively using both RPM and Debian packages isn’t common on any distribution, although it’s possible with all of them
|
|
Which of the following statements is true about binary RPM packages that are built for a particular distribution?
A. They can often be used on another RPM-based distribution for the same CPU architecture, but this isn’t guaranteed. B. They may be used in another RPM-based distribution only when you set the --convert-distrib parameter to rpm. C. They may be used in another RPM-based distribution only after you convert the package with alien. D. They can be recompiled for an RPM-based distribution running on another type of CPU. |
A. RPMs are usually portable across distributions, but occasionally they contain incompatibilities.
There is no --convert-distrib parameter to rpm, nor is alien used to convert from RPM format to RPM format. Binary packages can’t be rebuilt for another CPU architecture, but source packages may be rebuilt for any supported architecture provided the source code doesn’t rely on any CPU-specific features. |
|
An administrator types the following command on an RPM-based Linux distribution:
# rpm -ivh megaprog.rpm What is the effect of this command? A. The megaprog package, if it’s installed, is uninstalled from the computer. B. The megaprog.rpm package, if it exists, is valid, and isn’t already installed, is installed on the system. C. The megaprog.rpm source RPM package is compiled into a binary RPM for the computer. D. Nothing; megaprog.rpm isn’t a valid RPM filename, so rpm will refuse to operate on this file. |
B. The -i operation installs software, so option B is correct. (The -v and -h options cause
a status display of the progress of the operation, which wasn’t mentioned in the option.) Uninstallation is performed by the -e operation, and rebuilding source RPMs is done by the --rebuild operation (to either rpm or rpmbuild, depending on the RPM version). Although the filename megaprog.rpm is missing several conventional RPM filename components, the rpm utility doesn’t use the filename as a package validity check, so option D is incorrect. |
|
Which of the following commands will extract the contents of the myfonts.rpm file into the current directory?
A. rpm2cpio myfonts.rpm | cpio -i --make-directories B. rpm2cpio myfonts.rpm > make-directories C. rpm -e myfonts.rpm D. alien --to-extract myfonts.rpm |
A. The rpm2cpio program extracts data from an RPM file and converts it into a cpio archive that’s sent to standard output. Piping the results through cpio and using the -i and --make-directories options, as in option A, will extract those files to the current directory.
Option B creates a cpio file called make-directories that contains the files from the RPM package. Option C will uninstall the package called myfonts.rpm (but not the myfonts package). The alien utility has no --to-extract target, so option D is invalid. |
|
To use dpkg to remove a package called theprogram, including its configuration files, which of the following commands would you issue?
A. dpkg -P theprogram B. dpkg -p theprogram C. dpkg -r theprogram D. dpkg -r theprogram-1.2.3-4.deb |
A. An uppercase -P invokes the purge operation, which completely removes a package and its configuration files. The lowercase -p causes dpkg to print information about the package’s contents. The -r parameter removes a package but leaves configuration files behind.
The final variant (option D) also specifies a complete filename, which isn’t used for removing a package—you should specify only the shorter package name |
|
Which of the following describes a difference between apt-get and dpkg?
A. apt-get provides a GUI interface to Debian package management; dpkg doesn’t. B. apt-get can install tarballs in addition to Debian packages; dpkg can’t. C. apt-get can automatically retrieve and update programs from Internet sites; dpkg can’t. D. apt-get is provided only with the original Debian distribution, but dpkg comes with Debian and its derivatives. |
C. You can specify Debian package archive sites in /etc/apt/sources.list, and then you can type apt-get update and apt-get upgrade to quickly update a Debian system to the latest packages. GUI package management tools for Debian and related distributions exist, but they aren’t apt-get. The alien program can convert an RPM file and install the converted package on a Debian system; dpkg and apt-get both come with all Debian-based distributions.
|
|
What command would you type to obtain a list of all installed packages on a Debian system?
A. apt-cache pkgnames B. apt-cache showpkg C. dpkg -r allpkgs D. dpkg -i |
A. The apt-cache subcommand pkgnames displays the names of all installed packages
or, if a further string is used, of all installed packages whose names begin with that string, making option A correct. The showpkg subcommand to apt-cache displays information about a named package; when used without a package name, as in option B, it displays no data. The dpkg -r action removes a package, so option C would remove the package called allpkgs if it were installed. The dpkg -i action installs a package, so option D is incorrect—and that option doesn’t list a package name, which the -i action requires |
|
As root, you type apt-get update on a Debian system. What should be the effect of this command?
A. None; update is an invalid option to apt-get. B. The APT utilities deliver information about the latest updates you’ve made to the APT Internet repositories, enabling you to share your changes with others. C. The APT utilities download all available upgrades for your installed programs and install them on your system. D. The APT utilities retrieve information about the latest packages available so that you may install them with subsequent apt-get commands. |
D. The update option to apt-get causes retrieval of new information, as described in
option D. This option is perfectly valid, contrary to option A’s assertion. The apt-get program doesn’t permit you to upload information to the Internet repositories, so option B is incorrect. Option C describes the effect of the upgrade or dist-upgrade options, not the update option. |
|
Which of the following commands would you type to update the unzip program on a Fedora system to the latest version? (Select all that apply.)
A. yum update unzip B. yum upgrade unzip C. yum -u unzip D. yum -U unzip |
A, B. The yum utility’s update and upgrade options are nearly identical in effect, and either
can be used to upgrade an individual package, such as unzip. The primary command options to yum don’t use dashes, so -u and -U are both incorrect. |
|
How should you configure a system that uses Yum to access an additional Yum software repository?
A. Edit the /etc/apt/sources.list file to include the repository site’s URL, as detailed on the repository’s Web site. B. Download a package from the repository site and install it with RPM, or place a configuration file from the repository site in the /etc/yum.repos.d directory. C. Use the add-repository subcommand to yum or the Add Repository option in the File menu in yumex, passing it the URL of the repository. D. Edit the /etc/yum.conf file, locate the [repos] section, and add the URL to the repository after the existing repository URLs. |
B. Yum uses files in the /etc/yum.repos.d directory to locate its repositories, so you can add to the repository list by adding files to this subdirectory, as option B specifies, typically either by installing an RPM or by adding a file manually.
Option A describes a method of adding a repository to a computer that uses APT, not Yum. Option C’s add-repository subcommand is fictitious. Although the /etc/yum.conf file described in option D is real, it doesn’t store repository data. |
|
What is the preferred method of adding a directory to the library path for all users?
A. Modify the LD_LIBRARY_PATH environment variable in a global shell script. B. Add the directory to the /etc/ld.so.conf file, and then type ldconfig. C. Type ldconfig /new/dir, where /new/dir is the directory you want to add. D. Create a symbolic link from that directory to one that’s already on the library path. |
B. The /etc/ld.so.conf file holds the global library path, so editing it is the preferred approach. You must then type ldconfig to have the system update its library path cache.
Option A - Although you can add a directory to the library path by altering the LD_LIBRARY_PATH environment variable globally, this approach isn’t the preferred one. Option C simply won’t work. Option D also won’t work, although linking individual library files would work. This method isn’t the preferred one for adding a whole directory, though. |
|
You prefer the look of GTK+ widgets to Qt widgets, so you want to substitute the GTK+ libraries for the Qt libraries on your system. How would you do this?
A. You must type ldconfig --makesubs=qt,gtk. This command substitutes the GTK+ libraries for the Qt libraries at load time. B. You must uninstall the Qt library packages and re-install the GTK+ packages with the --substitute=qt option to rpm or the --replace=qt option to dpkg. C. You must note the filenames of the Qt libraries, uninstall the packages, and create symbolic links from the Qt libraries to the GTK+ libraries. D. You can’t easily do this; libraries can’t be arbitrarily exchanged for one another. You would need to rewrite all the Qt-using programs to use GTK+. |
D. Libraries are selected by programmers, not by users or system administrators. If you don’t like the widgets provided by one library, you have few options. (Many widget sets do provide a great deal of configurability, though, so you may be able to work around the problem in other ways.)
Options A and B describe fictitious options to ldconfig, rpm, and dpkg. Option C wouldn’t work; Qt-using programs would crash when they found GTK+ libraries in place of the Qt libraries they were expecting. |
|
A user types kill -9 11287 at a bash prompt. What is the probable intent, assuming the user typed the correct command?
A. To cut off a network connection using TCP port 11287 B. To display the number of processes that have been killed with signal 11287 in the last nine days C. To cause a server with process ID 11287 to reload its configuration file D. To terminate a misbehaving or hung program with process ID 11287 |
D. The kill program accepts various signals in numeric or named form (9 in this example) along with a process ID number (11287 in this example). Signal 9 corresponds to SIGKILL, which is an extreme way to kill processes that have run out of control. Although you might use kill to kill network processes, you can’t pass kill a TCP port number and expect it to work. The program also won’t display information about the number of processes that have
been killed. To do as option C suggests, you’d need to tell kill to pass SIGHUP (signal 1), so the command would be kill -1 11287. |
|
What programs might you use to learn what your system’s load average is? (Select all that apply.)
A. ld B. load C. top D. uptime |
C, D. The top utility displays a dynamic list of processes ordered according to their CPU use along with additional system information, including load averages. If you want only the load average at a specific moment, uptime may be better because it presents less extraneous information—it shows the current time, the time since the system was booted, the number of active users, and the load averages. The ld command has nothing to do with displaying load averages (it’s a programming tool that links together program modules into an executable program). There is no standard Linux program called load.
|
|
Which of the following commands creates a display of processes, showing the parent/child relationships through links between their names?
A. ps --forest B. ps aux C. ps -e D. All of the above |
A. The --forest option to ps shows parent/child relationships by creating visual links between process names in the ps output. (Listing 2.4 shows this effect.)
Options B and C are both valid ps commands, but neither creates the specified effect. |
|
You use top to examine the CPU time being consumed by various processes on your system. You discover that one process, dfcomp, is consuming more than 90 percent of your system’s CPU time. What can you conclude?
A. Very little; dfcomp could be legitimately consuming that much CPU time or it could be an unauthorized or malfunctioning program. B. No program should consume 90 percent of available CPU time; dfcomp is clearly malfunctioning and should be terminated. C. This is normal; dfcomp is the kernel’s main scheduling process, and it consumes any unused CPU time. D. This behavior is normal if your CPU is less powerful than a 2.5GHz EM64T Pentium; but on newer systems, no program should consume 90 percent of CPU time. |
A. CPU-intensive programs routinely consume 90 percent or more of available CPU time, but not all systems run such programs. Furthermore, some types of program bugs can create such CPU loads. Thus, you must investigate the matter more. What is dfcomp? Is it designed as a CPU-intensive program? Is it consuming this much CPU time consistently, or was this a brief burst of activity?
|
|
You type jobs at a bash command prompt and receive a new command prompt with no intervening output. What can you conclude?
A. The total CPU time used by your processes is negligible (below 0.1). B. No processes are running under your username except the shell you’re using. C. The jobs shell is installed and working correctly on the system. D. No background processes are running that were launched from the shell you’re using. |
D. The jobs command summarizes processes that were launched from your current shell. When no such processes are running, jobs returns nothing, so option D is correct.
The jobs command doesn’t check or summarize CPU load, so option A is incorrect. The jobs command also doesn’t check for processes run from shells other than the current one, so option B is incorrect (processes running under your username could have been launchedfrom another shell or from a GUI environment). There is no standard jobs shell in Linux, so option C is incorrect. |
|
Which two of the following commands are equivalent to one another? (Select two.)
A. nice --value 10 crunch B. nice -n -10 crunch C. nice -10 crunch D. nice crunch |
C, D. The nice command launches a program (crunch in this example) with increased or decreased priority. The default priority when none is specified is 10, and the nice -10 crunch command also sets the priority to 10, so options C and D are equivalent.
Option A isn’t a valid nice command because nice has no --value option. Option B is a valid nice command, but it sets the priority to –10 rather than 10. |
|
Which of the following are restrictions on ordinary users’ abilities to run renice? (Select all that apply.)
A. Users may not modify the priorities of processes that are already running. B. Users may not modify the priorities of other users’ processes. C. Users may not decrease the priority (that is, increase the priority value) of their own processes. D. Users may not increase the priority (that is, decrease the priority value) of their own processes. |
B, D. Linux insulates users’ actions from one another, and this rule applies to renice; only root may modify the priority of other users’ processes. Similarly, only root may increase the priority of a process, in order to prevent users from setting their processes to maximum priority, thus stealing CPU time from others.
Option A correctly describes nice, but not renice; the whole point of renice is to be able to change the priorities of existing processes. Option C also describes an action that renice permits. |
|
Cmd to display shared libraries required by each of the programs listed on the command line.
The result indicate the name of the library and where the library is expected to be in the filesystem |
ldd <program name>
bash shell requires three shared libraries #ldd /bin/bash /bin/bash: libtermcap.so.2 => /lib/libtermcap.so.2 libc.so.6 => /lib/libc.so.6 /lib/ld-linux.so.2 => /lib/ld-linux.so.2 |