These are notes I made while I was studying. The Linux community is so friendly and shares so much, so I am uploading my work to give back to the community. You won't find answers to test questions here, but you will find some solid notes around each of the exam points.
this is a power point presentation on the topic INFORMATION TECHNOLOGY . In this presentation there are basics of IT , INFORMATION AND PROCESSING TOOLS , DEFINITION OF IT , IT APPLICATION , SOCIETAL IMPACTS OF IT. By this presentation you will know that what actually is IT.
this is a power point presentation on the topic INFORMATION TECHNOLOGY . In this presentation there are basics of IT , INFORMATION AND PROCESSING TOOLS , DEFINITION OF IT , IT APPLICATION , SOCIETAL IMPACTS OF IT. By this presentation you will know that what actually is IT.
Writing Character driver (loadable module) in linuxRajKumar Rampelli
It covers the step by step approach on how to write a simple loadable character device driver in linux. What are Device files in linux detail. How user application interact with character driver using a device file.
I/O System and Case Study of Operating System its easy way to find how the I/O's are connected with the Operating System and And the mechanism of the Operating System
The conversion of the ARM Linux kernel over to the Device Tree as the mechanism to describe the hardware has been a significant change for ARM kernel developers. Nowadays, all developers porting the Linux kernel on new ARM platforms, either new SOCs or new boards, have to work with the Device Tree. Based on practical examples, this talk intends to provide a ""getting started guide"" for newcomers in the Device Tree world: what is the Device Tree? How is it written and compiled? How do the bootloader and kernel interact? How are Device Tree bindings written and documented? What are the best practices for writing Device Trees and their bindings?
Video available at https://www.youtube.com/watch?v=m_NyYEBxfn8.
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdfTechSoup
In this webinar you will learn how your organization can access TechSoup's wide variety of product discount and donation programs. From hardware to software, we'll give you a tour of the tools available to help your nonprofit with productivity, collaboration, financial management, donor tracking, security, and more.
Macroeconomics- Movie Location
This will be used as part of your Personal Professional Portfolio once graded.
Objective:
Prepare a presentation or a paper using research, basic comparative analysis, data organization and application of economic information. You will make an informed assessment of an economic climate outside of the United States to accomplish an entertainment industry objective.
Francesca Gottschalk - How can education support child empowerment.pptxEduSkills OECD
Francesca Gottschalk from the OECD’s Centre for Educational Research and Innovation presents at the Ask an Expert Webinar: How can education support child empowerment?
The French Revolution, which began in 1789, was a period of radical social and political upheaval in France. It marked the decline of absolute monarchies, the rise of secular and democratic republics, and the eventual rise of Napoleon Bonaparte. This revolutionary period is crucial in understanding the transition from feudalism to modernity in Europe.
For more information, visit-www.vavaclasses.com
Normal Labour/ Stages of Labour/ Mechanism of LabourWasim Ak
Normal labor is also termed spontaneous labor, defined as the natural physiological process through which the fetus, placenta, and membranes are expelled from the uterus through the birth canal at term (37 to 42 weeks
A Strategic Approach: GenAI in EducationPeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
Biological screening of herbal drugs: Introduction and Need for
Phyto-Pharmacological Screening, New Strategies for evaluating
Natural Products, In vitro evaluation techniques for Antioxidants, Antimicrobial and Anticancer drugs. In vivo evaluation techniques
for Anti-inflammatory, Antiulcer, Anticancer, Wound healing, Antidiabetic, Hepatoprotective, Cardio protective, Diuretics and
Antifertility, Toxicity studies as per OECD guidelines
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
Unit 8 - Information and Communication Technology (Paper I).pdf
Notes for LX0-101 Linux
1. 101 System Architecture
101.1 Determine and Configure Hardware Settings
* Enable and Disable integrated Peripherals
It is under the BIOS configuration console that you can:
enable or disable devices, allocate resources such as IRQ and IO addresses, select boot order.
Most BIOS consoles allow one to disable integrated peripherals such as COM ports, video or network cards
* Configure systems with or without external peripherals such as keyboards
under the BIOS disable system checks for peripherals such as a keyboard or a mouse which, although necessary for the
proper operation of desktop machines, are often not present for servers. Machines without keyboards, mouse or monitors are
referred to as “headless” systems. Some BIOSes will refuse to boot if these devices are not present unless these system checks
are disabled
* Differentiate between the various types of mass storage devices
http://en.wikibooks.org/wiki/Ict-innovation/LPI/101.1#Mass_Storage_Devices
PATA – Parallel Advanced Technology Attachment – also known as IDE
PATA ( 16 bit MLM, RLL and ISE ) disk drives are names with /dev/hd[a-z] names.
PATA - The last letter determines master /slave & number determines partition
SATA and SCSI disk devices are named with /dev/sd* names
SATA – Serial Advanced Technology Attachment
SATA – only one disk per cable; are hotswappable; use AHCI
SATA – Linux treats SATA as if SCSI
SCSI – Small Computer system interface
SCSI – Supports 8 or 16 devices per bus, one is the SCSI host adaptor
SCSI – x86 BIOS wont detect SCSI, if SCSI adaptor has its own Bios that support booting then ok
SCSI disk devices are named with /dev/sd* (where * is a letter) names
SCSI tape drivers are named with /dev/st* (where * is a number) and /de/nst*
SCSI DVD ROMS are /dev/scd* or /dev/sr*
SCSI devices are identified using a set of three numbers called SCSI ID
1, the SCSI channel – each adaptor supports on data channel, starting number 0
2 the Device ID number – unique number that can be used by setting jumpers on a disk
3 Logical Unit Number – differentiate between devices with in a SCSI target number
SCSI All detected devices are in the /proc/scsi/scsi file
All documented in usr/src/linux/Documentation/Devices.txt
2. * Set the Correct Hardware ID for different devices, especially boot device
http://www.dedoimedo.com/computers/grub.html#mozTocId616834
http://www.ibm.com/developerworks/linux/library/l-boot-rootfs/index.html
http://www.tuxradar.com/content/how-fix-linux-boot-problems
Boot Sector is always at track 0, cylinder 0, head 0 of the boot device, This sector contains LILO or GRUB. Next stage reads the Grub
configuration file (usually /boot/grub/menu.lst or /boot/grub/grub.conf), an entry looks like this:
title openSUSE 10.2
root (hd0,0)
kernel /boot/vmlinuz-2.6.18.2-34-default root=/dev/hda1 vga=0x317 showopts
initrd /boot/initrd-2.6.18.2-34-default
In Grub-speak, hd0 refers to the first drive - on a typical PC with IDE drives this corresponds to the Linux device name /dev/hda, or, in
some of the more recent distros, /dev/sda. In Grub-speak, (hd0,0) refers to the first partition on that drive. Linux would call this
/dev/hda1 or /dev/sda1
The kernel line specifies the file that Grub will load as the Linux kernel; at the end of this line you may see some additional boot parameters
that are passed to the kernel.
The initrd line specifies the file that contains the 'initial RAM Disk' - a file system image that will be used by the kernel as it boots. Grub is also
responsible for loading this file into memory. If Grub fails to find the kernel or the ramdisk images it will report Error 15: File not found, and halt
* Know differences between hotplug and coldplug devices
Typical hot plug devices are USB data sticks, mice or keyboards and some SATA drives, while cold plug devices include video
cards, network cards and CPUs, although in high end server machines even these components can be hot pluggable
When a hotplug device is inserted or removed the kernel updates the sys virtual filesystem and udev receives an event
notification. Udev will create the device node under /dev and fire notifications to HAL which in turn will notify D-Bus of the
changes.
Several utilities help in managing hot plug devices:
sysfs virtual file system, mounted at /sys, exports info about devices so that user space utilites can access.
udev a virtual files system, mounted at /dev, creates dynamic device files as drivers are loaded and unloaded, you can
configure udev through files /etc/udev
hald – user space programs that runs at all times that provides other user space programs with info about avail
hardware
D-bus – enables processes to communicate with each other as wellas ti be notified over events, both by processes and
hardware, such as new USB device avail
3. * Determine Hardware resources for Devices
The /proc file system is a virtual or pseudo file system – the kernel sets up the /proc file system to export information about the
running kernel, user process and hardware devices that have been configured.
When the CPU and Peripheral devices need to communicate; they do so via i/o addresses by reading and writing data to the i/o
address of the device. IO addresses are regions of memory mapped to devices where the CPU can write information of the
devices attention and read from the devices as well.
The allocation of io ports can be viewed in the /proc/ioports file
DMA devices can write directly to memory, by passing CPU
Can be viewed /proc/dma
When an event occurs on a device, such as a mouse movement or data arriving from a USB connected drive, the device signals
to the CPU that it has data which it needs to handle by generating an interrupt on the bus. “plug and play” technology was
introduced which allows devices to share interrupt lines. (APIC) architecture there are now usually 24 interrupt lines available
that can accommodate up to 255 devices. IRQs are the mechanism by which peripherals tell the CPU to suspend its current
activity and to handle its event such as a key press or a disk read.
In order to see allocation of IRQs on Linux, see /proc/interrupts file
IRQ
No.
Hardware
Assignment
IRQ
No.
Hardware
Assignment
IRQ
No.
Hardware
Assignment
IRQ
No.
Hardware
Assignment
0 System timer 4 COM1 8 Real Time Clock 12 PS2 Mouse
1 Keyboard 5 LPT2 / Sound Card 9 Available 13 Floating Point Proc
2 Handles IRQ 8 - 15 6 Floppy Controller 10 Available 14 Primary IDE
3 COM2 7 Parallel Port 11 Available 15 Secondary IDE
* Tools and utilites to list various hardware information (lsusb, lspci and others)
Once a USB device is plugged into a PC we list devices with lsusb
In particular, USB device information is accessible from /proc/bus/usb.
Two commands used to query PCI devices are the lspci and setpci commands. The lspci utility can provide verbose
information on devices using the PCI bus, depending on which parameters you use. “lspci -vv” provides detailed output
on PCI devices
All PCI devices are identified by a unique ID. This ID is made up of a unique vendor ID, device ID with potentially a sub-
system vendor ID and sub-system device ID. When “lspci” is run the PCI ID is looked up in the systems ID database and
translated into a human readable format, showing the vendor name and device. The PIC ID database is found at
/usr/share/misc/pci.ids on Ubuntu and on RedHat
Linux loads the modules it needs when it boots, but you may need to load additional
4. modules yourself. You can learn about the modules that are currently loaded on your system by using
lsmod
Linux enables you to load kernel modules with two programs: insmod and modprobe. The insmod program inserts a
single module into the kerne l The modprobe program,by contrast, automatically loads any depended-on modules and
so is generally the preferred way to do the job.
* Conceptual understanding of sysfs, udev, hald, and dbus
Sysfs –All Bus’s and hardware info in the kernel become objects when the PC boots, these objects, hardware
information is exported to a virtual file system, sysfs which is mounted at the sys directory. sysfs virtual file system,
mounted at /sys, exports info about devices so that user space utilities can access.
Objects -> folders
Attributes- > Names
Attirbute values -> File contents
udev
One of these user space applications is the kernel device manager, udev, which creates a device node under the /dev
directory to allow user space application access to the device. The name of the device node or file is determined by
the device drivers naming convention or by user defined rules in /etc/udev/rules.d/. It is through the entries under
/dev that user space application can interact with the device driver. The udev daemon is also responsible for
informing other user land applications of changes
HAL & DBUS
The applications that are most important here are the HAL (hardware abstraction layer) daemon, and D-Bus (desktop
bus). These applications are mainly used by desktop environment to carry out tasks when an event occurs such as
open the file browser when a USB drive is inserted or image application when a camera is inserted.
HAL
While udev creates the relevant entries under the /dev file system, if anything useful needs to happen when the event
occurs, HAL and D-Bus are needed. (Note: HAL is now deprecated as it is being merged into udev). HAL is a single
daemon responsible for discovering, enumerating and mediating access to most of the hardware on the host
computer for desktop applications to which it provides a hardware abstraction layer.
DBuS
Applications register with the D-Bus daemon to receive notifications of events and also post event notifications that
other applications may be interested in. D-Bus is used for example to launch media players when a audio CD is inserted
and to notify other applications of the currently playing song for example.
101.2 Boot the system
5. Provide common commands to the Bootloader and options to the kernel at
Boot time
master boot record (MBR) contains the MBR partition table and a boot loader (also sometimes called a boot manager).
Both GRUB and LILO are broken into two stages; first stage is small code on the MBR – it’s one job is to locate the 2nd
stage bootloader. . the 2nd
stage bootloader then locates and loads the linux kernel; passing in any parameters which it
has been provided. Common parameters are:
Init – overrides the process that is run by the kernel after it has finished loading “init=/bin/bash” is used to bypass the
login promprt in cases where the root password is forgotten.
Root – informs the kernel which device to use as the root filesystem. Often used when t-shooting an incorrect
bootloader. Example: root= /dev/hda1 tells the kernel to use /dev/hda1/ as the root device filesystem.
Noapic/nolapic – tells the kernel not to use the advanced programmable interupt controller or local advanced
programmable interupt controller for assigning IRQ and resources – this turns off plug and play
Demonstrate knowledge of the boot sequence from BIOS to boot completion
1. Power on - CPU loads BIOS
2. BIOS locates BOOT device
3. BIOS loads MBR of boot device [ MBR is 1st
sector, 512 bytes and contains 1st
stage boot loader with partition table ]
4. 1st
Stage bootloader locates 2nd
stage bootloader, [ due to the limited size of the MBR [512 bytes ], the partition
table only carries the names of the primary partition, which requires the 2nd
stage bootloader to be on a primary
partition. The 1st stage boot loader locates the partition of the 2nd stage boot loader by looking at the boot sectors of
the partition marked as active/bootable.
5. 2ND
Stage loader { LILO, GRUB ] presents user with a menu {options to select a kernel}, then loads the kernel and
passes control over to it.
6. Kernel starts and configures the CPU type, IRQ handling,, mem mgmt, drivers, etc.
7. Kernel loads an initial RAM disk image and mounts it as a temp file sysytem in RAM. The initial RAM DISK
(initrd) contains an image sys config files and modules the kernel will need to access hardware.
8. Temp root files system is later swapped for real root file system once kernel has access to it.
9. Once Kernel is fully operational, it starts a program /sbin/init.
10. init sets up user space and starts login shells and GUI login .
Check boot events in the log file
6. During boot – boot messages are logged to a circular[ ring ] buffer . Most Linux write ring buffer entires to
/var/log/dmesg,
/var/log/messages
/var/log/syslog
Log buffer can be read with dmesg
101. 3 Change runlevels and shutdown or reboot the system
Linux has 7 run levels, numbered 0-6
0. HALT the system
1. Single user mode
2. Multi-user, no network
3. Multi-user text mode, network & server
4. Multi user, gui mode, no server
5. Multi user, gui, mode, server
6. Reboot the system
What services and hardware is configured for the different runlevels is determined by a set of scripts configured for
each level. Runlevel specific scripts are stored under /etc/rc.d/rc?.d, /etc/init.d/rc?.d or /etc/rc?.d or similar location
where the ? Is the number of the runlevel
Set the default Run Level
During the boot process for Fedora and RH systems; init opens the /etc/inittab to decide what runlevel the system
should be booted to.
The relavent section of a sample /etc/inittab file is as follows:
# Default runlevel. The runlevels used by RHS are:
# 0 - halt (Do NOT set initdefault to this)
# 1 - Single user mode
# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)
# 3 - Full multiuser mode
# 4 - unused
# 5 - X11
# 6 - reboot (Do NOT set initdefault to this)
#
id:3:initdefault:
The key line in the example above is:
id:3:initdefault:
If your system does not have inittab, create one and add only the above line.
Change between runlevels including single user mode
7. # runlevel < - will show your current runlevel
N 2
The first character is the previous run level, when ‘ N’ – this means the sytem has not switched run levels since
booting. The second charater is your current run level.
ntsysv < - RedHAt distro’s can change run levels ex.. ntsysv –level 1
Runlevels are be change be invoking the the init number. Init / Telinit are used to chage the state of the computer without
rebooting it.
Example, init 6 will reboot the machine.
Telinit 1 < - changes computer to single user mode. Telinit is special because it can also take a ‘q’ option and have the tool
reread etc/inittab and implement any changes it find there
Shutdown and reboot from the command line
Shutdown –h now – halt the system immediately.
Shutdown –r now – reboot the system immediately.
Shutdown –h +10 shutdown in ten minutes
Shutdown –c cancels the current shutdown
reboot
Halt
Poweroff
Alert users before switching runlevels or other major system events
Wall<file> <- this command send a messages to all users
Shutdown –h +10 “System is going to go down”
Properly terminate processes
Envoke start-up script directly
Ubuntu:
# /etc/init.d/apache2 stop
# /etc/init.d/apache2 start
RedHat:
# service httpd start
# service httpd stop
Kill - < -list signals
Kill –s <SIGNAL PID>
1- SIGHUP < - terminates interactive programs, causes many daemons to reload configuration file
9 - SIGKILL < - Sent to a process to terminate it immediately, without preforming routine shutdown tasks
15 – SIGTERM (default) allows process to perform nice termination, releasing resources
102 Linux installation and Package Management
102.1 Design hard disk layout
8. Allocate file systems and swap spaces to separate partitions or disks
In Linux Primary partitions are assigned 1-4, the EXTENDED partition, of which there can be only one is assigned the
number 4, with logical paritions being assigned numbers greater than 4
Linux kernel needs a special partition for swap space [swap] for virtual mem management
Extra partitions are needed for preventing log files and temp files from consuming too much space
Splitting reads and writes across partitions
Planning for disk expansions
Tailor the design to the intended use of the system
Smaller systems Partition plan:
/boot partition < - 50 -100 MB, usually the 1st
partition
/swap < - 1 gig is recommended
/root
Larger systems
/boot partition
/swap
/home < - eaiser back up; and protects kernel is space fills up
/usr < - on ly applications
/var < - var directory contains log files, separate partition protects system
/tmp < - over time this can fill up
/ < - remainder of file system
Swap space:
Swap space does not contrain a file system, but is access in raw mode my linux kernel; after creating partition for swap,
you can activate by:
#swapon [ device ] (example #swapon /dev/sda2)
#swapon –s <-display swap space
Ensure the /boot partition conforms to the hardware architecture requirements for booting
9. /boot should always be on a regular partition. Not on LV. Boot Sector is always at track 0, cylinder 0, head 0 of the boot device
Common practice when using LV is to make a small EXT2 partition for boot. On old systems due to bios contraints, /boot
must be within the first 1024 sectors of the drive.
102.2 Install a Boot Manager
Providing alternative boot locations and backup boot options
Both LILO and GRUB can be installed to a floppy disk as well as to a hard disk
Install and configure a boot loader such as GRUB
Grub can be installed, either by editing the grub configuration file located at:
/boot/grub/grub.conf or
/boot/grub/menu.lst and
main sections of the grub.conf/menu.lst file are:
default - > image that will boot by default (the first entry is 0)
timeout -> prompt timeout in seconds
title ->name of the image
root ->where the 2nd
stage bootloader and kernel are e.g (hd0,0) is /dev/hda1
kernel -> path for the kernel starting from the previous root e.g /vmlinuz
ro -> read-only
root >-the filesystem root
initrd -> path to the initial root disk
Running # grub-install or by invoking the grub shell
To install the first stage MBR loader on /dev/hda with grub-install you would run the command grub-install
(hd0).Alternatively grub can be installed through the grub shell but still requires the grub.conf/menu.lst file. The grub
shell can be entered by typing grub. To install the boot loader you need to run the following commands in the shell:
root (hd0,0)
setup (hd0)
Interact with the Bootloader
10. configure LILO using the /etc/lilo.conf file.
grub configuration file located at:
/boot/grub/grub.conf or
/boot/grub/menu.lst and
Superblock
superblock describes basic filesystem features, such as the filesystem’s size and status The debugfs
and dumpe2fs commands provide some basic superblock information
102.3 Manage Shared Libraries
Identify shared libraries
A library is a set of functions that programs can use to implement their functionalities. When building (linking) a program,
those libraries can be statically or dynamically linked to an executable. Static link means that the final program will contain the
library function within its file. (lib.a) Dynamic link means that the needed libraries are loaded into RAM when the program
executes (lib.so).
Identify the typical locations of system libraries
By default Linux looks in the following trusted locations for library files
/lib < - used mainly by /bin programs
/user/lib < - used mainly by user/bin programs
/etc/ld.so < - other programs
/etc/ld.so.conf
Load shared libraries
In order to optimise library location and loading, the directories in the ld.so.conf file and the trusted directories are
parsed by the ldconfig command to create a fast caches at /etc/ld.so.cache.
ldconfig creates, updates and removes the necesscary links and cache to the most recent shared libraries on the
command line /etc/ld.so.conf and in trusted directories /user/lib and /lib. Ldconfig checks the header and files names
of the libraries it encounters when determining which versions should have their links removed.
When an application is launched the dynamic loader uses the cached information from ld.so.cache to locate files. Any
changes to the ld.so.conf files requires the ldconfig command to be run to update the /etc/ld.so.cache file
ldd command- print shared libraries If you wish to know whether an application is statically linked, or what the
dependencies for a dynamically linked application are you can use the ldd command. For example ldd
/usr/sbin/apache
LD_LIBRARY_PATH- Sometime you may need to override the default search path for dynamic libraries. This can be
for applications you have installed from source, for testing out latest version of a library or if the application relies on
an older version of a library that you already have installed on your machine.
11. To add libraries to the search path you will need to define and export the LD_LIBRARY_PATH variable as follows:
# export LD_LIBRARY_PATH=/usr/lib/:/opt/someapp/lib;
LD_LIBRARY_PATH is a colon-separated list of directories that is searched before the system ones specified in
ld.so.cache. This allows for the temporary overriding of libraries defined in the ld.so.cache and in the trusted
directories.
102.4 Use Debian package management
distributions derived from Redhat use the rpm package manager, while those that are derived from Debian use the dpkg
manager
Install, upgrade and uninstall Debian binary packages
To install a package from a .deb file, you could use dpkg as follows:
dpkg [options][action] [package-files|package-name]
-i or --install Installs a package
--configure Reconfigures an installed package: runs the postinstallation
script to set site-specific options
-r or --remove Removes a package, but leaves configuration files intact
-P or --purge Removes a package, including configuration files
-p or --print-avail Displays information about an installed package
-I or --info Displays information about an uninstalled package file (CAP I )
-l pattern or --list pattern Lists all installed packages whose names match pattern ( lowercase el )
dpkg Examples
# dpkg –i hello_2.1.1-4_i386.deb OR
# dpkg --unpack hello_2.1.1-4_i386.deb
# dpkg --configure hello
To reconfigure a package which has already been configured, try the dpkg-reconfigure, this will avoid having
to re-install
Find packages containing specific files or libraries which may or may not be installed
12. APT is one of the strengths of dpkg, and provides an easy way of installing and updating a system, It is controlled by two files
/etc/apt/apt.conf < - Contains general configuration options for APT, such as which release of Debian to install, whether/which proxy settings to use, etc
/etc/apt/sources <- Lists sources of Debian files, which may be on CDs, or on the network OR
/etc/apt/source.list < - file. This defines the repositories apt should use for installing new software or for updating existing applications
apt-get Commands
Command Description
update - Obtains updated information about packages available from the installation sources listed in /etc/apt/sources.list
upgrade - Upgrades all installed packages to the newest versions available,based on locally stored information about available
packages
dselect-upgrade - Performs any changes in package status (installation, removal, and so on) left undone after running dselect
dist-upgrade - Similar to upgrade, but performs “smart” conflict resolution to avoid upgrading a package if doing so would break
a dependency
install - Installs a package by package name (not by package filename), obtaining the package from the source that contains
the most up-todate version
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-cache Commands
Display package information Using the showpkg subcommand, as in apt-cache showpkg <pkg>, displays information about
the package.
Display package statistics You can learn how many packages you’ve installed, how many dependencies are recorded, ,
bypassing the stats subcommand, as in apt-cache stats.
Find unmet dependencies If a program is reporting missing libraries or fi les, typing aptcache unmet
Locate all packages The pkgnames subcommand displays the names of all the packages installed on the system. If you
include a second parameter, as in apt-cache pkgnames sa, the program returns only those packages that begin with the
specified string.
Obtain Package information like version, content, dependencies, package integrity and
installation status ( whether or not package is installed)
# dpkg –s hello <- -s Shows the status and information about particular installed package(s)
Display dependencies Using the depends subcommand, as in apt-cache depends <pkg>, shows all of the specified
package’s dependencies
text-based Debian package manager is aptitude.
pass various commands to aptitude on the command line, as in aptitude search samba
aptitude update - update package lists from the APT repositories
For instance, typing
aptitude install zsh installs the zsh package,
but typing aptitude install zsh- and aptitude remove zsh both uninstall zsh.
102.4 Use RPM and YUM package management
Install, re-install, upgrade and remove packages using YUM and RPM
13. RPM - “Red Hat Package Manager
rpm [operation][options] [package-files|package-names]
These are the major mode options for rpm.
Short Long Description
-i –install Installs the package
-U –update Updates or installs a package
-F --freshen Updates only installed package
-V --verify file size, MD5, permissions, type ...
-q --query Queries installed/uninstalled packages, and files
-e --erase Uninstall package
These are the minor mode options for rpm.
Short Description
a applies to all installed packages
c together with q lists configuration files
d together with q lists documentation files
f together with q queries which package installed a given file
h adds hashes while processing
i together with q lists information about a package
l together with q lists all files and directories in a package
p together with q specifies that the query is performed on the package file
v verbose
# rpm -Uvh samba-server-3.0.25b-4.5mdv2008.0.x86_64.rpm
You can also use rpm -ivh in place of rpm -Uvh if you don’t already have a sambaserver
package installed.
# rpm -ivh samba-server-3.0.25b-4.5mdv2008.0.x86_64.rpm
RPM Special Options
--nodepsInstall a package regardless of dependencies
--force force an upgrade
--testdoesn’t actually install or upgrade, just prints to stdout
--requires PACKAGEtogether with q lists capabilities required by a package
--whatrequires CAPABILITYtogether with q lists packages which require the capability
YUM Package Manager -“YellowDog Update Manager”
Yum is the default package manager for many rpm based distributions that allows for the installing, updating and removing of
rpm packages without having to worry about resolving dependencies yourself. Yum uses external repositories to provide the
meta-data, in the form of index files, about what packages are available and their dependencies as well as to store the rpm
packages that will be automatically downloaded to fulfil an installation request
14. The configuration file for yum and related utilities is located at /etc/yum.conf. This file contains one mandatory [main] section,
which allows you to set Yum options that have global effect, and can also contain one or more [repository] sections, which
allow you to set repository-specific options. However, it is recommended to define individual repositories in new or existing .repo
files in the /etc/yum.repos.d/directory. The values you define in the [main] section of the /etc/yum.conf file can override values
set in individual [repository] sections.
https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/sec-
Configuring_Yum_and_Yum_Repositories.html
install – install a package, automatically resolving and installing dependencies. The command below would install the tsclient
package with its dependencies.
# yum install tsclient
This comand will install all software packages in the “mysql database group”, which will include the mysql server as well as
admin and management tools
# yum groupinstall “mysql database”
update – update the list of available packages and will update all installed packages on your system to the latest available
versions.
# yum update
search – search the list of available rpm packages. The command below will search for a package by name.
# yum list tsclient
If you do not know the name of the package, which is often the case, you can search for a package by keyword. The search
command can also accepts wildcards in its search criteria.
# yum search PalmPilot
erase/remove – delete a package from your system. Erase is a safer option to use as remove may delete dependencies that
are needed by other packages. Below we remove he tsclient package
# yum remove tsclient
We can also remove all packages in a group.
# yum groupremove “mysql database”
yumdownloader is a program for downloading RPMs from Yum repositories.
Download the kernel RPM to /var/tmp:
yumdownloader --destdir /var/tmp kernel
List the URL for the kernel and kernel-smp RPMs:
yumdownloader --urls kernel kernel-smp
Extracting Data from RPMs
15. RPM files are actually modifi ed cpio archives. Thus, converting the fi les into cpio fi lesis relatively straightforward, whereupon
you can use cpio to retrieve the individual files. To do this job, you need to use the rpm2cpio program,
$ rpm2cpio samba-server-3.0.25b-4.5mdv2008.0.src.rpm > samba-server-3.0.25b-4.5mdv2008.0.cpio
You can then extract the data using cpio, which takes the -i option to extract an
archive and --make-directories to create directories:
$ cpio -i --make-directories < samba-server-3.0.25b-4.5mdv2008.0.cpio
Alternatively, you can use a pipe to link these two commands together without creating
an intermediary file:
$ rpm2cpio samba-server-3.0.25b-4.5mdv2008.0.src.rpm | cpio -i --make-directories
Obtain information on RPM packages such as version, status, dependencies, integrity and
signatures
RPM query types:
Three query types: uninstalled packages, installed packages and files
Query Type Option
Package file -qp
Installed package -q
File -qf
Package SignaturesYou can check the signature of each package that is distributed as part of a project. For example to load
the keys of all the developers involved with the Fedora project do the following (just once):
# rpm –-import /usr/share/rhn/RPM-GPG-KEY-fedora
You can now download any package from an FTP site which mirrors the project's RPMs. For example we downloaded zlib-1.2.1.1-2.1.i386.rpm from
ftp.mirror.ac.uk in the Fedora subdirectory. We next check the authenticity of the file:
# rpm --checksig /home/adrian/zlib-1.2.1.1-2.1.i386.rpm
# /home/adrian/zlib-1.2.1.1-2.1.i386.rpm: (sha1) dsa sha1 md5 gpg OK
Package Integrity
The next command checks the integrity of the package bash:
# rpm –V bash
This returns nothing. We next do the following as user root:
# chown bin /bin/bash
# chmod 775 /bin/bash
If we check the integrity of bash again this time we get:
# rpm –V bash
.M...U.. /bin/bash
The package manager has compared the current status of all files which are part of the bash package with the known original
state of these files stored in a database. The changes made to /bin/bash have been identified.
It is possible to verify the integrity of all packages installed on the system by adding the 'a' (--all) option after 'V' (--verify)
The –verify option performs a number of tests on each file; when a test is positive a number of characters (listed below) are used
to identify the errors:
16. Returned character Error description
. the test was successful
? the test couldn't be performed
S file size has changed
M permission mode or file type has changed
5 the file's MD5 sum has changed
D device major/minor number miss-match
L broken symbolic link
U the user owner of the file has changed
G the group owner of the file has changed
T the mtime (modified time) has changed
Determine what files a package provides, as well as find which package a specific file
comes from
find which package a specific file comes from
You can search for a filename from installed packages using dpkg -S command. For example, find out package name for /bin/ls,
enter:
$ dpkg -S /bin/ls or dpkg -S /path/to/file
coreutils: /bin/ls < ‘coreutils’ is package>
apt-file is a command line tool for searching packages in Debian/Ubuntu repositories.
Unlike apt-cache search, apt-file can find files in uninstalled or can list the content of uninstalled packages
apt-file search FindKDE4Internal.cmake
kdelibs5-dev: /usr/share/kde4/apps/cmake/modules/FindKDE4Internal.cmakeIn other words, the file I
needed was in the package “kdelibs5-dev”, which I installed from the command line:
sudo apt-get install kdelibs5-dev
rpm -qf /bin/ls <- For RPM
Determine what files a package provides
$ dpkg –L <pkg>
$ rpm –ql <pkg>
For YUM - There is a package called yum-utils that builds on YUM and contains a tool called repoquery
repoquery -lq <pkg>
103 GNU and Unix Commands
103.1 Work on the Command Line
Use single shell commands and one line command sequences to perform basic tasks on the
command line
The fi le /bin/sh is a symbolic link to the system’s default shell—normally /bin/bash for Linux.
17. ~/.bashrc and ~/.profile files are the main user configuration files for bash, and /etc/bash.bashrc and /etc/profile are the main global
configuration files.
pwd
ls -ld or ls -l -d or ls -d -l
rm -r /tmp/toto
cat ../readme helpme > save
more /etc/passwd /etc/hosts /etc/group
find . -name *.[ch] -print
date "+day is %a"
Invoke an editor You can launch a full-fledged editor to edit a command by pressing Ctrl+X followed by Ctrl+E.
Use and modify the shell environment including defining, referencing and exporting environment
variables
Export, Set and Env
Shell variables
All local variables to the bash session can be viewed with set.
To declare a local variable, do:
VARNAME=foo
To unset a variable, do:
unset VARNAME
All the environment variables can be viewed with env. To declare a variable that will be seen by other shells use
export.
export VARNAME=foo
or
VARNAME=foo
export VARNAME
List of common predefined variables
PREDEFINED
VARIABLES
MEANING
DISPLAY Used by X to identify where to run a client application
HISTFILE Path to the user's .bash_history file
HOME The path to the user's home
18. LOGNAME The name used by the user to log in
PATH
List of directories searched by the shell for programs to be executed when a command is
entered without a path.
PWD The current working directory
SHELL The shell used (bash in most Linux distributions)
TERM The current terminal emulation
Use and edit command history
To view the list of previously typed commands you can use the bash built-in command history
Emacs Key Bindings for Editing the Command History
Ctrl+P Previous line (same as Up-arrow)
Ctrl+n Next line (same as Down-arrow)
Ctrl+b Go back one character on the line (same as Left-Arrow)
Ctrl+f Go forward one character on the line (Same as Right-Arrow)
Ctrl+a Go to the beginning of the line (Same as <Home>)
Ctrl+e Go to the end of the line (Same as <End>)
Ctrl + D deletes text
The history of commands typed from the bash shell are stored in ~/.bash_history
Invoke commands inside and outside the defined path
Even when external commands are installed, the internal command takes precedence unless you provide
the complete path to the external command on the command line, as in typing /bin/pwd rather than pwd.
You can run programs that aren’t on the path by providing a complete path on the command line. For instance, typing ./myprog
runs the myprog program in the current directory, and /home/arthur/thisprog runs the thisprog program in the /home/arthur
directory.
Bash, echo env exec export pwd set unset man uname history
103.2 Process text streams using filters
Send text files and output streams through text utility filters to modify the output using standard
UNIX commands found in the GNU textutils package;
cat cut expand fmt head od join nl paste pr sed sort split tail tr unexapnd uniq wc
103.3 Perform basic File Management
Copy and remove files and directories individually
19. Copy multiple files and directories recursively
Use simple and advanced wildcard specs in commands
Use find to locate and act on files based on type, size or time
Usage or tar, cpio and dd
Cp, find, mkdir, mv, ls, rm