Linux Command Line and Shell Scripting Bible (eBook)

eBook Download: EPUB
2020 | 4. Auflage
832 Seiten
Wiley (Verlag)
978-1-119-70093-7 (ISBN)

Lese- und Medienproben

Linux Command Line and Shell Scripting Bible -  Richard Blum,  Christine Bresnahan
Systemvoraussetzungen
33,99 inkl. MwSt
  • Download sofort lieferbar
  • Zahlungsarten anzeigen

Advance your understanding of the Linux command line with this invaluable resource 

Linux Command Line and Shell Scripting Bible, 4th Edition is the newest installment in the indispensable series known to Linux developers all over the world. Packed with concrete strategies and practical tips, the latest edition includes brand-new content covering:

  • Understanding the Shell  
  • Writing Simple Script Utilities  
  • Producing Database, Web & Email Scripts  
  • Creating Fun Little Shell Scripts 

Written by accomplished Linux professionals Christine Bresnahan and Richard Blum, Linux Command Line and Shell Scripting Bible, 4th Edition teaches readers the fundamentals and advanced topics necessary for a comprehensive understanding of shell scripting in Linux. The book is filled with real-world examples and usable scripts, helping readers navigate the challenging Linux environment with ease and convenience. 

The book is perfect for anyone who uses Linux at home or in the office and will quickly find a place on every Linux enthusiast's bookshelf.


Advance your understanding of the Linux command line with this invaluable resource Linux Command Line and Shell Scripting Bible, 4th Edition is the newest installment in the indispensable series known to Linux developers all over the world. Packed with concrete strategies and practical tips, the latest edition includes brand-new content covering: Understanding the Shell Writing Simple Script Utilities Producing Database, Web & Email Scripts Creating Fun Little Shell Scripts Written by accomplished Linux professionals Christine Bresnahan and Richard Blum, Linux Command Line and Shell Scripting Bible, 4th Edition teaches readers the fundamentals and advanced topics necessary for a comprehensive understanding of shell scripting in Linux. The book is filled with real-world examples and usable scripts, helping readers navigate the challenging Linux environment with ease and convenience. The book is perfect for anyone who uses Linux at home or in the office and will quickly find a place on every Linux enthusiast s bookshelf.

RICHARD BLUM has over three decades of experience working as a system and network administrator. He is the author of several Linux books and is an accomplished online Linux instructor. CHRISTINE BRESNAHAN is an Adjunct Professor at Ivy Tech Community College where she teaches Linux certification and Python classes. She is the author of several Linux books, including the CompTIA Linux+ Study Guide, Fourth Edition.

CHAPTER 1
Starting with Linux Shells


IN THIS CHAPTER


  • Investigating Linux
  • Understanding parts of the Linux kernel
  • Exploring the Linux desktop
  • Examining Linux distributions

Before you can dive into working with the Linux command line and shells, it's a good idea to first understand what Linux is, where it came from, and how it works. This chapter walks you through what Linux is and explains where the shell and command line fit in the overall Linux picture.

Investigating Linux


If you've never worked with Linux before, you may be confused as to why there are so many different versions of it available. We're sure that you've heard various terms such as distribution, LiveDVD, and GNU when looking at Linux packages and been confused. Wading through the world of Linux for the first time can be a tricky experience. This chapter takes some of the mystery out of the Linux system before you start working on commands and scripts.

For starters, four main parts make up a Linux system:

  • The Linux kernel
  • The GNU utilities
  • A graphical desktop environment
  • Application software

Each of these four parts has a specific job in the Linux system. Each one of the parts by itself isn't very useful. Figure 1-1 shows a basic diagram of how the parts fit together to create the overall Linux system.

FIGURE 1-1 The Linux system

This section describes these four main parts in detail and gives you an overview of how they work together to create a complete Linux system.

Looking into the Linux kernel


The core of the Linux system is the kernel. The kernel controls all the hardware and software on the computer system, allocating hardware when necessary and executing software when required.

If you've been following the Linux world at all, no doubt you've heard the name Linus Torvalds. Linus is the person responsible for creating the first Linux kernel software while he was a student at the University of Helsinki. He intended it to be a copy of the Unix system, at the time a popular operating system used at many universities.

After developing the Linux kernel, Linus released it to the Internet community and solicited suggestions for improving it. This simple process started a revolution in the world of computer operating systems. Soon Linus was receiving suggestions from students as well as professional programmers from around the world.

Allowing anyone to change programming code in the kernel would result in complete chaos. To simplify things, Linus acted as a central point for all improvement suggestions. It was ultimately Linus's decision whether or not to incorporate suggested code in the kernel. This same concept is still in place with the Linux kernel code, except that instead of just Linus controlling the kernel code, a team of developers has taken on the task.

The kernel is primarily responsible for four main functions:

  • System memory management
  • Software program management
  • Hardware management
  • Filesystem management

The following sections explore each of these functions in more detail.

System memory management

One of the primary functions of the operating system kernel is memory management. Not only does the kernel manage the physical memory available on the server, but it can also create and manage virtual memory, or memory that does not actually exist.

It does this by using space on the hard disk, called the swap space. The kernel swaps the contents of virtual memory locations back and forth from the swap space to the actual physical memory. This allows the system to think there is more memory available than what physically exists (shown in Figure 1-2).

FIGURE 1-2 The Linux system memory map

The memory locations are grouped into blocks called pages. The kernel locates each page of memory in either the physical memory or the swap space. The kernel then maintains a table of the memory pages that indicates which pages are in physical memory and which pages are swapped out to disk.

The kernel keeps track of which memory pages are in use and automatically copies memory pages that have not been accessed for a period of time to the swap space area (called swapping out), even if other memory is available. When a program wants to access a memory page that has been swapped out, the kernel must make room for it in physical memory by swapping out a different memory page, and swap in the required page from the swap space. Obviously, this process takes time and can slow down a running process. The process of swapping out memory pages for running applications continues for as long as the Linux system is running.

Software program management

The Linux operating system calls a running program a process. A process can run in the foreground, displaying output on a display, or it can run in the background, behind the scenes. The kernel controls how the Linux system manages all the processes running on the system.

The kernel creates the first process, called the init process, to start all other processes on the system. When the kernel starts, it loads the init process into virtual memory. As the kernel starts each additional process, it gives the process a unique area in virtual memory to store the data and code that the process uses.

A few different types of init process implementations are available in Linux, but these days the two most popular are:

  • SysVinit: The SysVinit (SysV) initialization method, the original method used by Linux, was based on the Unix System V initialization method. Though it is not used by many Linux distributions these days, you still may find it around in older Linux distributions.
  • Systemd: The systemd initialization method, created in 2010, has become the most popular initialization and process management system used by Linux distributions.

The SysVinit initialization method used a concept called runlevels to determine what processes to start. The runlevel defines the state of the running Linux system and what processes should run in each state. Table 1-1 shows the different runlevels associated with the SysVinit initialization method.

TABLE 1-1 The SysVinit Runlevels

Runlevel Description
0 Shut down the system
1 Single-user mode used for system maintenance
2 Multi-user mode without networking services enabled
3 Multi-user mode with networking services enabled
4 Custom
5 Multi-user mode with GUI available
6 Reboot the system

The /etc/inittab file defines the default runlevel for a system. The processes that start for specific runlevels are defined in subdirectories of the /etc/rc.d directory. You can view the current runlevel at any time using the runlevel command:

$ runlevel N 5 $

The systemd initialization method became popular because it has the ability to start processes based on different events:

  • When the system boots
  • When a particular hardware device is connected
  • When a service is started
  • When a network connection is established
  • When a timer has expired

The systemd method determines what processes to run by linking events to unit files. Each unit file defines the programs to start when the specified event occurs. The systemctl program allows you to start, stop, and list the unit files currently running on the system.

The systemd method groups unit files together into targets. A target defines a specific running state of the Linux system, similar to the SysVinit runlevel concept. At system startup, the default.target unit defines all the unit files to start. You can view the current default target using the systemctl command:

$ systemctl get-default graphical.target $

The graphical.target unit file defines the processes to start when a multi-user graphical environment is running, similar to the old SysVinit runlevel 5.

NOTE


In Chapter 4, “More Bash Shell Commands,” you'll see how to use the ps command to view the processes currently running on the Linux system.

Hardware management

Still another responsibility for the kernel is hardware management. Any device that the Linux system must communicate with needs driver code inserted inside the kernel code. The driver code allows the kernel to pass data back and forth to the device, acting as an intermediary between applications and the hardware. Two methods are used for inserting device driver code in the Linux kernel:

  • Drivers compiled in the kernel
  • Driver modules added to the kernel

Previously, the only way to insert device driver code was to recompile the kernel. Each time you added a new device to the system, you had to recompile the...

Erscheint lt. Verlag 8.12.2020
Reihe/Serie Bible
Sprache englisch
Themenwelt Informatik Betriebssysteme / Server Unix / Linux
Mathematik / Informatik Informatik Netzwerke
Informatik Weitere Themen Hardware
Schlagworte Betriebssysteme / Linux, UNIX • Computer-Ratgeber • Computer Science • End-User Computing • Informatik • Linux • Operating Systems / Linux & UNIX • Programmierung u. Software-Entwicklung • Programming & Software Development
ISBN-10 1-119-70093-0 / 1119700930
ISBN-13 978-1-119-70093-7 / 9781119700937
Haben Sie eine Frage zum Produkt?
Wie bewerten Sie den Artikel?
Bitte geben Sie Ihre Bewertung ein:
Bitte geben Sie Daten ein:
EPUBEPUB (Adobe DRM)
Größe: 12,8 MB

Kopierschutz: Adobe-DRM
Adobe-DRM ist ein Kopierschutz, der das eBook vor Mißbrauch schützen soll. Dabei wird das eBook bereits beim Download auf Ihre persönliche Adobe-ID autorisiert. Lesen können Sie das eBook dann nur auf den Geräten, welche ebenfalls auf Ihre Adobe-ID registriert sind.
Details zum Adobe-DRM

Dateiformat: EPUB (Electronic Publication)
EPUB ist ein offener Standard für eBooks und eignet sich besonders zur Darstellung von Belle­tristik und Sach­büchern. Der Fließ­text wird dynamisch an die Display- und Schrift­größe ange­passt. Auch für mobile Lese­geräte ist EPUB daher gut geeignet.

Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen eine Adobe-ID und die Software Adobe Digital Editions (kostenlos). Von der Benutzung der OverDrive Media Console raten wir Ihnen ab. Erfahrungsgemäß treten hier gehäuft Probleme mit dem Adobe DRM auf.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen eine Adobe-ID sowie eine kostenlose App.
Geräteliste und zusätzliche Hinweise

Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.

Mehr entdecken
aus dem Bereich
Das umfassende Handbuch

von Dirk Deimeke; Daniel van Soest; Stefan Kania; Peer Heinlein …

eBook Download (2023)
Rheinwerk Computing (Verlag)
69,90
das umfassende Handbuch

von Michael Kofler

eBook Download (2023)
Rheinwerk Computing (Verlag)
49,90
Penetration Testing und Ethical Hacking mit Linux

von Jürgen Ebner

eBook Download (2021)
MITP Verlags GmbH & Co. KG
32,99