Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Linux Shell Scripting Cookbook, Second Edition

You're reading from   Linux Shell Scripting Cookbook, Second Edition Don't neglect the shell ‚Äì this book will empower you to use simple commands to perform complex tasks. Whether you're a casual or advanced Linux user, the cookbook approach makes it all so brilliantly accessible and, above all, useful.

Arrow left icon
Product type Paperback
Published in May 2013
Publisher Packt
ISBN-13 9781782162742
Length 384 pages
Edition 2nd Edition
Tools
Arrow right icon
Toc

Table of Contents (16) Chapters Close

Linux Shell Scripting Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
1. Shell Something Out FREE CHAPTER 2. Have a Good Command 3. File In, File Out 4. Texting and Driving 5. Tangled Web? Not At All! 6. The Backup Plan 7. The Old-boy Network 8. Put on the Monitor's Cap 9. Administration Calls Index

Index

A

  • absolute paths
    • about / How it works...
  • active user hours, system
    • monitoring / Finding out active user hours on a system, Getting ready, How to do it…
  • active_users.sh script / How it works…
  • addgroup command
    • about / How it works…
  • administrative user root
    • about / Introduction
  • advanced text processing
    • awk command, used / Using awk for advanced text processing
  • alias
    • about / Visiting aliases
    • visiting / Visiting aliases, How to do it...
    • escaping / Escaping aliases
  • arbitrary sockets
    • creating / Creating arbitrary sockets, How to do it...
  • archives
    • creating, tar command used / Archiving with tar
    • creating, cpio used / Archiving with cpio, How to do it...
    • creating, zip command used / Archiving and compressing with zip
    • creating, pbzip2 command used / Faster archiving with pbzip2
  • archives, tar command used
    • files, appending to / Appending files to an archive
    • files, extracting / Extracting files and folders from an archive
    • folders, extracting / Extracting files and folders from an archive
    • concatenating / Concatenating two archives
    • files, updating with timestamp check / Updating files in an archive with a timestamp check
    • files, comparing / Comparing files in the archive and file system
    • files, deleting / Deleting files from the archive
    • tar archive, compressing / Compression with the tar archive
    • file set, excluding / Excluding a set of files from archiving
    • version control directories, excluding / Excluding version control directories
    • total bytes, printing / Printing total bytes
  • arguments
    • passing, to commands / Passing arguments to commands
  • arithmetic operations
    • about / Math with the shell
    • performing / Math with the shell, How to do it...
  • array indexes
    • listing / Listing of array indexes
  • arrays
    • about / Arrays and associative arrays
    • associative arrays / Arrays and associative arrays
  • aspell command
    • about / Spell checking and dictionary manipulation
    • working / How it works...
  • aspell list command
    • about / How it works...
  • associative arrays
    • using / Getting ready, How to do it...
    • about / There's more...
    • defining / Defining associative arrays
  • asymmetric keys / Getting ready
  • auto-login
    • SSH keys used / Password-less auto-login with SSH
  • automatic authentication
    • setting up, SSH keys used / How to do it...
  • awk command
    • used, for advanced text processing / Using awk for advanced text processing, How it works…
    • working / How it works…
    • special variables / Special variables
    • external variable. passing to / Passing an external variable to awk
    • line, reading explicitly / Reading a line explicitly using getline
    • lines, filtering / Filtering lines processed by awk with filter patterns
    • delimiter, setting for fields / Setting delimiter for fields
    • command output, reading / Reading the command output from awk
    • for loop, using / Using loop inside awk
    • string manipulation functions / String manipulation functions in awk
  • awk utility / How to do it…

B

  • back quotes / How to do it...
  • back tick / How to do it...
  • bandwidth limit
    • specifying, on cURL / Specifying a bandwidth limit on cURL
  • base64 command
    • about / How to do it...
  • Bash
    • MySQL database, reading from / Writing and reading the MySQL database from Bash, How to do it…, How it works…
    • MySQL database, writing to / Writing and reading the MySQL database from Bash, How to do it…, How it works…
  • Bash (Bourne Again Shell)
    • about / Introduction
  • bash-oauth library
    • downloading / Getting ready
  • bash prompt string
    • modifying / Modifying the Bash prompt string (username@hostname:~$)
  • bc
    • about / How to do it...
  • BEGIN block / How it works…
  • blank files
    • generating, in bulk / Generating blank files in bulk
  • boot failures, machine
    • obtaining / How to do it...
  • boot logs, machine
    • obtaining / How to do it...
  • broken links, website
    • identifying / Finding broken links in a website, How to do it..., How it works...
  • bzip2 command
    • about / Using bzip2

C

  • --convert-links option / Copying a complete website (mirroring)
  • cat command
    • about / Concatenating with cat
    • general syntax / How to do it...
    • data, concatenating with / How to do it...
    • working / How it works…
    • extra blank lines, removing / Getting rid of extra blank lines
    • tabs, displaying as ^I / Displaying tabs as ^I
    • line numbers / Line numbers
  • CD-ROM tray / Playing with the CD-ROM tray
  • cd command
    • about / Spawning a separate process with subshell
  • cdrecord command
    • used, for burning ISO / Burning an ISO from the command line
  • chage command
    • about / How it works…
  • chain / How it works...
  • changes, website
    • tracking / Tracking changes to a website, How to do it..., How it works...
  • character classes, tr command
    • alnum / Character classes
    • alpha / Character classes
    • cntrl / Character classes
    • digit / Character classes
    • graph / Character classes
    • lower / Character classes
    • print / Character classes
    • punct / Character classes
    • space / Character classes
    • upper / Character classes
    • xdigit / Character classes
  • characters, files
    • counting, wc command used / How to do it...
  • chattr command
    • used, for making file immutable / Getting ready
  • checksums
    • about / Checksum and verification, There's more...
    • calculating / Checksum and verification
    • computing / Checksum and verification
    • for directories / Checksum for directories
  • checksum verification
    • about / How it works...
  • chmod command
    • about / How to do it...
    • using, for setting file permissions / How to do it...
  • chsh command
    • about / How it works…
  • colored output
    • printing / Printing a colored output
  • command-line navigation
    • pushd and popd command used / Fast command-line navigation using pushd and popd, How to do it...
  • command-line options, comm command
    • about / How it works...
  • command execution time
    • calculating, time command used / Calculating the execution time for a command, How to do it...
    • real time / How it works...
    • user time / How it works...
    • sys time / How it works...
  • command line
    • Gmail e-mails, accessing from / Accessing Gmail e-mails from the command line
  • command outputs
    • monitoring, watch command used / Monitoring command outputs with watch
  • commands
    • running / Running a command until it succeeds
    • faster approach / A faster approach
    • delay, adding / Adding a delay
    • executing rapidly / Making commands quicker by running parallel processes, How it works...
    • executing on remote host, with SSH / Running commands on a remote host with SSH, How to do it...
    • running, at system boot / Running commands at system start up/boot
  • Comma Separated Values (CSV) / Writing and reading the MySQL database from Bash
  • comma separated values (CSV)
    • about / Field separators and iterators
  • comm command
    • about / Getting ready, How to do it...
  • comparisons
    • about / Comparisons and tests
    • mathematical comparisons, performing / How to do it...
    • string comparisons, performing / How to do it...
  • compression command
    • about / How it works...
  • Content-length parameter / Printing response headers excluding the data
  • convert command
    • about / Getting ready
  • Coordinated Universal Time (UTC) / How it works...
  • cpio command
    • about / Archiving with cpio
    • used, for archiving / Archiving with cpio, How to do it...
    • working / How it works...
  • CPU
    • about / Listing the top 10 CPU consuming processes in an hour
  • CPU usage
    • monitoring, ps command used / Getting ready, How to do it..., How it works...
  • cron
    • scheduling with / Scheduling with cron, Getting ready, How it works...
  • cron scheduling utility
    • about / Getting ready
  • crontab command
    • about / Getting ready
    • environment variables, specifying / Specifying environment variables
    • specific commands, running at system boot / Running commands at system start up/boot
  • cron table / Scheduling with cron
    • viewing / Viewing the cron table
    • removing / Removing the cron table
  • crypt command
    • about / How to do it...
  • cryptographic tools
    • crypt command / How to do it...
    • gpg / How to do it...
    • base64 / How to do it...
    • SHA-1 / How to do it...
    • md5sum / How to do it...
    • shadow-like salted hash / How to do it...
  • csplit
    • about / Specifying a filename prefix for the split files
  • cURL
    • about / A primer on cURL
    • features / A primer on cURL
    • tasks / How to do it…
    • working / How it works...
    • downloads, resuming / Continuing and resuming downloads
    • referer string, setting / Setting the referer string with cURL
    • cookies, storing / Cookies with cURL
    • user agent string, setting / Setting a user agent string with cURL
    • bandwidth limit, specifying / Specifying a bandwidth limit on cURL
    • maximum download size, specifying / Specifying the maximum download size
    • authentication / Authenticating with cURL
    • response headers, printing / Printing response headers excluding the data
  • curl command
    • about / How to do it…
  • custom echo script
    • writing / Passing formatted arguments to a command by reading stdin
  • custom file descriptors
    • about / Custom file descriptors
  • cut command
    • used, for cutting file column-wise / How to do it...
    • range of characters, specifying as fields / Specifying the range of characters or bytes as fields

D

  • data
    • concatenating, with cat command / Concatenating with cat
    • parsing, from website / Parsing data from a website
    • compressing, gzip used / Compressing data with gzip, How to do it...
    • backing up, rsync command used / Backup snapshots with rsync, How to do it...
  • date format / How it works...
  • dates and time delays
    • working with / Getting and setting dates and delays, How to do it..., How it works...
  • dd command
    • about / How to do it...
  • decompression command
    • about / How it works...
  • define utility
    • creating, Web backend used / Creating a "define" utility by using the Web backend, Getting ready, How to do it...
    • code / How to do it...
    • working / How it works...
  • delays
    • executing, in script / Producing delays in a script
  • delgroup command
    • about / How it works…
  • deluser command
    • about / How it works…
  • df command
    • used, for calculating disk usage / Getting ready
    • about / Getting ready
  • dictionary file
    • using / Spell checking and dictionary manipulation
  • diff command
    • used, for generating difference files / How to do it...
  • difference file
    • about / Finding the difference between files, patching
    • generating, diff command used / How to do it...
    • generating, against directories / Generating difference against directories
  • difference operation, text files
    • about / Getting ready
  • directories
    • listing, dir command used / Getting ready, How it works...
  • directory access
    • monitoring, inotifywait command used / How to do it...
  • directory tree, files
    • printing / Printing the directory tree, How to do it...
    • HTML output / HTML output for tree
  • disk activity
    • monitoring, iotop command used / Monitoring disk activity, How to do it...
  • disk images
    • creating, fsarchiver used / Creating entire disk images using fsarchiver, How it works...
  • disks
    • checking for errors, fsck used / Getting ready, How to do it..., How it works...
  • disk space
    • about / Monitoring disk usage
  • disk usage
    • monitoring / Monitoring disk usage, There's more...
    • displaying in units, with du command / Displaying disk usage in KB, MB, or Blocks
  • disk usage statistics, remote machine
    • monitoring / Remote disk usage health monitor, How to do it…, How it works…
  • DNS servers
    • about / Name server and DNS (Domain Name Service)
    • DNS lookup utilities / DNS lookup
  • domain names
    • about / Name server and DNS (Domain Name Service)
  • du command
    • about / Getting ready
    • used, for calculating disk usage / Getting ready
  • du command, functionalities
    • disk usage, displaying in units / Displaying disk usage in KB, MB, or Blocks
    • total disk size, displaying / Displaying the grand total sum of disk usage
    • files, printing in specified units / Printing files in specified units
    • files, excluding from disk usage calculation / Excluding files from the disk usage calculation
    • largest size files, searching from directory / Finding the 10 largest size files from a given directory
    • disk free information, providing / Disk free information
  • duplicate files
    • about / Finding and deleting duplicate files
    • searching / Finding and deleting duplicate files, How it works...
    • deleting / Getting ready, How it works...

E

  • #expect parameter
    • about / Automating with expect
  • </entry> element / How it works...
  • e-mail addresses
    • parsing, from text / Parsing e-mail addresses and URLs from text, How it works...
  • echo command
    • about / How to do it...
    • newline, escaping / Escaping newline in echo
  • egrep regex pattern / How to do it...
  • encryption techniques
    • about / Cryptographic tools and hashes
  • END block / How it works…
  • environment variables
    • about / Playing with variables and environment variables
    • displaying, for processes / Showing environment variables for a process
    • specifying / Specifying environment variables
  • epoch / Getting ready
  • ESSID
    • about / Connecting to a wireless network
  • Ethernet connection
    • about / Connecting to a wireless network
  • event loop
    • about / Capturing and responding to signals
  • exit status / Reading the return value (status) of a command
  • expect command
    • automating / Automating with expect
  • expect command
    • interactive input, automating / Automating with expect
  • export command
    • about / How to do it...
  • expr
    • about / How to do it...
  • ext4 filesystem
    • creating / How to do it...
    / Creating entire disk images using fsarchiver
  • extfs (extended FS)
    • file permissions / Working with file permissions, ownership, and the sticky bit

F

  • file access
    • monitoring, inotifywait command used / Getting ready
  • file command
    • about / Getting ready, About which, whereis, file, whatis, and load average
    • using / Getting ready
  • file descriptors
    • about / Playing with file descriptors and redirection
    • working with / How to do it...
  • filenames
    • slicing, based on extension / Slicing filenames based on extension, How it works…
  • file permissions
    • about / Working with file permissions, ownership, and the sticky bit
    • ownership / Working with file permissions, ownership, and the sticky bit
    • user / Working with file permissions, ownership, and the sticky bit
    • group / Working with file permissions, ownership, and the sticky bit
    • others / Working with file permissions, ownership, and the sticky bit
    • listing, ls -l command used / Working with file permissions, ownership, and the sticky bit
    • setting, chmod command used / How to do it...
    • removing / How to do it...
    • ownership, changing / Changing ownership
    • sticky bit, setting / Setting sticky bit
    • applying recursively / Applying permissions recursively to files
    • ownership, applying recursively / Applying ownership recursively
    • executable, running as setuid / Running an executable as a different user (setuid)
  • files
    • locating, with find command / Getting ready, How to do it...
    • renaming, rename command used / Renaming and moving files in bulk
    • generating / Generating files of any size, How to do it...
    • intersection operation / Getting ready
    • difference operation / Getting ready
    • set difference operation / Getting ready
    • duplicate files, finding / Finding and deleting duplicate files
    • duplicate files, deleting / Finding and deleting duplicate files
    • file permissions, working with / Working with file permissions, ownership, and the sticky bit
    • making immutable / Making files immutable
    • blank files, generating in bulk / Generating blank files in bulk, How to do it...
    • symbolic links, searching / Finding symbolic links and their targets
    • file type statistics, enumerating / Enumerating file type statistics
    • loopback files, using / Using loopback files
    • ISO files, creating / Creating ISO files and hybrid ISO
    • hybrid ISO, creating / Creating ISO files and hybrid ISO
    • difference file, searching / Finding the difference between files, patching
    • difference file, patching / Finding the difference between files, patching
    • last or first 10 lines, printing / Using head and tail for printing the last or first 10 lines, How to do it...
    • directories, listing / Listing only directories – alternative methods
    • counting / Counting the number of lines, words, and characters in a file
    • directory tree, printing / Printing the directory tree
    • text, searching with grep command / Searching and mining a text inside a file with grep
    • column-wise cutting, with cut command / Cutting a file column-wise with cut, How to do it..., There's more
    • transfering, through network / Transferring files through the network, How to do it...
    • copying, over network / Quickly copying files over the network
  • files and data
    • spiltting, spilt command used / Splitting files and data
  • filesystem backup solution / Creating entire disk images using fsarchiver
  • filesystems
    • checking for errors, fsck used / Getting ready, How to do it..., How it works...
  • file type statistics
    • enumerating / Enumerating file type statistics, How to do it..., How it works...
  • filters / Getting ready
  • find command
    • about / Finding files and file listing
    • used, for searching files / Getting ready, How to do it...
    • used, for listing files / Getting ready, How to do it...
    • searching, based on filename / Search based on filename or regular expression match
    • searching, based on regular expression match / Search based on filename or regular expression match
    • arguments, negating / Negating arguments
    • searching, based on directory depth / Search based on the directory depth
    • searching, based on file type / Search based on file type
    • searching, based on file times / Search on file times
    • searching, based on file size / Search based on file size
    • deleting, based on file matches / Deleting based on the file matches
    • match, based on file permissions and ownership / Match based on the file permissions and ownership
    • executing / Executing commands or actions with find
    • specified directories, skipping / Skipping specified directories when using the find command
  • finger USER command
    • about / How it works…
  • firewall
    • about / Basic firewall using iptables
  • formatted arguments
    • passing to xargs command / Passing formatted arguments to a command by reading stdin
  • fping command
    • used, for listing live machines on network / Getting ready, Using fping
  • frequency of words
    • finding, in file / Finding the frequency of words used in a given file, How to do it...
  • Frequency parameter / How it works...
  • fsarchiver
    • about / Creating entire disk images using fsarchiver
    • used, for creating disk images / Creating entire disk images using fsarchiver, How it works...
    • URL / Getting ready
    • working / How it works...
  • fsck command
    • used, for checking disks and filesystem / Getting ready, How to do it..., How it works...
  • FTP
    • about / How to do it...
    • using / How to do it...
    • connecting to / How to do it...
    • automated FTP transfer / Automated FTP transfer
    • SFTP / SFTP (Secure FTP)
    • rsync command / The rsync command
    • SCP / SCP (secure copy program)
    • recursive copying, with SCP / Recursive copying with SCP
  • FTP authentication, cURL
    • about / Authenticating with cURL
  • functions
    • defining / Functions and arguments, How to do it...
    • exporting / Exporting functions

G

  • gateway / Showing routing table information
  • gedit / Getting ready
  • GET request / Posting to a web page and reading the response
  • Git
    • about / Version control-based backup with Git
    • used, for version control based backup / Version control-based backup with Git, How to do it...
  • Gmail
    • about / Accessing Gmail e-mails from the command line
  • Gmail e-mails
    • accessing, from command line / Accessing Gmail e-mails from the command line, How it works...
  • GNU/Linux ecosystem
    • about / Introduction
  • GNU screen / Getting ready
  • gpg command / How to do it...
  • grep command
    • about / How to do it...
    • using / How to do it...
    • files, searching recursively / Recursively search many files
    • multiple patterns, matching / grep by matching multiple patterns
    • files, including in search / Including and excluding files in a grep search
    • files, excluding in search / Including and excluding files in a grep search
    • using with xargs with zero-byte suffix / Using grep with xargs with zero-byte suffix
    • silent output / Silent output for grep
    • lines, printing / Printing lines before and after text matches
  • group, file permissions
    • about / Working with file permissions, ownership, and the sticky bit
  • gzip command
    • about / Compressing data with gzip
    • used, for compressing data / Compressing data with gzip, How to do it...
  • gzip command, features
    • gzipped tarball, creating / Gzip with tarball
    • compression ratio, specifying / Compression ratio
    • bzip2, using / Using bzip2
    • lzma using / Using lzma
  • gzipped tarball
    • creating / Gzip with tarball

H

  • hardware address
    • spoofing / Spoofing the hardware address (MAC address)
  • head and tail commands
    • used, for printing last or first 10 lines / Using head and tail for printing the last or first 10 lines, How to do it...
  • head command
    • about / How to do it...
  • HTML output, directory tree
    • about / HTML output for tree
  • HTTP authentication, cURL
    • about / Authenticating with cURL
  • HTTP or FTP authentication
    • used, for accessing web pages / Accessing pages with HTTP or FTP authentication
  • HTTP protocol / Introduction
  • HTTP_PROXY
    • about / How to do it...
  • hybrid ISO
    • creating / Creating ISO files and hybrid ISO, Hybrid ISO that boots off a flash drive or hard disk

I

  • <img> tags
    • about / Web photo album generator
  • ifconfig command
    • about / Getting ready
    • used, for displaying network interfaces / Getting ready
  • IFS
    • about / Field separators and iterators
    • using / How to do it...
    • example / How to do it...
  • image
    • format, converting / Bulk image resizing and format conversion, How to do it.., How it works…
    • resizing / Bulk image resizing and format conversion, How to do it.., How it works…
  • image crawlers
    • about / Image crawler and downloader
    • working / How it works...
  • Image crawlers
    • working / How it works...
  • image downloader
    • about / How it works...
  • Imagemagick
    • about / Getting ready
    • URL / Getting ready
  • import command / How to do it...
  • information, about processes
    • gathering, ps command used / How to do it...
  • inotifywait command
    • used, for monitoring file and directory access / Getting ready
    • working / How it works...
  • interactive input
    • automating / Automating interactive input, How to do it...
  • internal field separator / How it works…
  • Internal Field Separator (IFS) / How it works…
  • Internet connection
    • sharing / Sharing an Internet connection, How to do it...
  • Internet Control Message Protocol (ICMP) echo packets / How to do it...
  • Internet Explorer (IE) / Setting a user agent string with cURL
  • intersection operation, text files
    • about / Getting ready
    • performing / How to do it...
  • intruder_detect.sh script
    • writing / Getting ready, How it works…
  • iotop command
    • used, for monitoring disk activity / Monitoring disk activity, How to do it...
  • IP addresses
    • displaying / Displaying IP addresses
  • iptables
    • using / Basic firewall using iptables, How to do it...
    • working / How it works...
  • ISO files
    • about / Creating ISO files and hybrid ISO
    • creating / Creating ISO files and hybrid ISO
    • burning, from command line / Burning an ISO from the command line
  • isohybrid command
    • used, for converting ISO files to hybrid ISOs / Hybrid ISO that boots off a flash drive or hard disk
  • ISO image
    • creating / Creating ISO files and hybrid ISO
  • iwconfig command / How it works...
    • using / Getting ready, How to do it...

J

  • JavaScript
    • compressing / Compressing or decompressing JavaScript, How to do it...
    • decompressing / Getting ready, How to do it...

K

  • killall command
    • about / The kill family of commands
  • kill command
    • about / Getting ready, The kill family of commands
  • Konsole / Managing multiple terminals from one
  • kpartx
    • about / Quicker way to mount loopback disk images with partitions

L

  • --limit-rate argument / Restricting the download speed
  • --limit-rate option / Specifying a bandwidth limit on cURL
  • Last-Modified parameter / Printing response headers excluding the data
  • last command
    • obtaining / How to do it...
  • last in first out (LIFO)
    • about / Getting ready
  • last or first 10 lines
    • about / Getting ready
    • working / How it works...
  • let command
    • about / How to do it...
  • lines, files
    • counting, wc command used / How to do it...
    • printing, in reverse order / Printing lines in the reverse order, How it works...
  • Lines of Code (LOC) / Counting the number of lines of C code in a source code directory
  • Linux
    • disk usage, calculating with df and du / Getting ready
  • live machines
    • listing, on network / Listing all the machines alive on a network, Getting ready, How it works...
    • listing, on network with ping command / How to do it...
    • listing, on network with fping command / How to do it...
  • load average command
    • about / About which, whereis, file, whatis, and load average
  • LOC (Lines of Code)
    • about / Counting the number of lines, words, and characters in a file
  • local mount point
    • remote drive, mounting / Mounting a remote drive at a local mount point
  • log events
    • access / How it works...
    • modify / How it works...
    • attrib / How it works...
    • move / How it works...
    • create / How it works...
    • open / How it works...
    • close / How it works...
    • delete / How it works...
  • logfile management
    • performing, logrotate command used / Logfile management with logrotate, Getting ready, How it works...
  • logfiles
    • writing into / Getting ready
  • logged in users information
    • obtaining / How to do it...
  • logrotate command
    • used, for logfile management / Logfile management with logrotate, Getting ready, How it works...
    • missingok parameter / How it works...
    • notifempty parameter / How it works...
    • size 30k parameter / How it works...
    • compress parameter / How it works...
    • weekly parameter / How it works...
    • rotate 5 parameter / How it works...
    • create 0600 root root parameter / How it works...
  • look command
    • about / How it works...
  • loopback disk images
    • mounting, with partitions / Quicker way to mount loopback disk images with partitions
  • loopback files
    • about / Generating files of any size
    • using / Using loopback files, How to do it...
    • partitions, creating inside images / Creating partitions inside loopback images
    • ISO files, mounting / Mounting ISO files as loopback
    • changes, flushing with sync command / Flush changing immediately with sync
  • losetup command / How it works...
  • ls -lS command
    • about / How it works...
  • Lynx
    • about / Downloading a web page as plain text
    • working / How it works...
  • lynx command / How to do it...
  • lzma command
    • about / Using lzma

M

  • --max-depth parameter / Excluding files from the disk usage calculation
  • --mirror option / Copying a complete website (mirroring)
  • -max-filesize option / Specifying the maximum download size
  • man-in-the-middle attack / How to do it...
  • mathematical comparisons
    • performing / How to do it...
  • maximum download size, for cURL
    • specifying / Specifying the maximum download size
  • md5sum
    • about / How to do it...
  • md5sum checksum
    • about / Getting ready, How it works...
    • computing / How to do it...
    • syntax / How it works...
  • md5sum command
    • about / How to do it...
  • messages
    • sending, to user terminals / Sending messages to user terminals, How it works...
  • minified JS / Compressing or decompressing JavaScript
  • mkdir command / How it works...
  • mkfs command / How to do it...
  • mkfts.ext4 command / How it works...
  • mkisofs command
    • about / How to do it...
  • mktemp command
    • about / Temporary file naming and random numbers
    • temporary file, creating / How to do it...
    • working / How it works…
  • mount command
    • about / Generating files of any size, How it works...
  • mountpoint
    • about / Using loopback files, How it works...
  • multiple commands
    • combining / Reading the output of a sequence of commands in a variable
  • multiple files
    • merging, as columns / Merging multiple files as columns
  • multiple tar files
    • concatenating / Concatenating two archives
  • multiple terminals
    • manging, from one / Managing multiple terminals from one, How to do it...
  • MySQL database
    • about / Writing and reading the MySQL database from Bash
    • reading, from Bash / Writing and reading the MySQL database from Bash, How to do it…, How it works…
    • writing, to Bash / Writing and reading the MySQL database from Bash, How to do it…, How it works…

N

  • -nolist option / How it works...
  • n characters
    • reading, without return key / Reading n characters without pressing the return key
  • netcat command
    • used, for creating arbitrary sockets / Creating arbitrary sockets, How to do it...
  • netstat command
    • about / Opened port and services using netstat
  • network
    • setting up / Setting up the network
  • Network Address Translation (NAT)
    • setting up / Getting ready
  • networking
    • about / Introduction
  • networking parameters
    • subnet mask / Introduction
    • route / Introduction
    • ports / Introduction
    • host names / Introduction
  • network interface
    • about / Getting ready
  • network ports
    • about / Network traffic and port analysis, How to do it...
  • network setup
    • performing / Setting up the network, How to do it...
    • network interfaces list, printing / Printing the list of network interfaces
    • IP addresses, displaying with ifconfig command / Displaying IP addresses
    • hardware address, spoofing / Spoofing the hardware address (MAC address)
    • domain names / Name server and DNS (Domain Name Service)
    • DNS / Name server and DNS (Domain Name Service)
    • routing table information, displaying / Showing routing table information
    • ping command / Let us ping!
    • live machines, listing on network / Listing all the machines alive on a network
    • commands, running on remote host with SSH / Running commands on a remote host with SSH
    • files, transfering through network / Transferring files through the network
    • wireless network, connecting to / Connecting to a wireless network
    • password-less auto-login, with SSH / Password-less auto-login with SSH
    • port forwarding, with SSH / Port forwarding using SSH
    • remote drive, mounting at local mount point / Mounting a remote drive at a local mount point
    • network traffic / Network traffic and port analysis
    • port analysis / Network traffic and port analysis
    • arbitrary sockets, creating / Creating arbitrary sockets
    • Internet connection, sharing / Sharing an Internet connection
    • firewall, iptables used / Basic firewall using iptables
  • non-interactive port forward
    • about / Non-interactive port forward
  • nth word or column, in file
    • printing / Printing the nth word or column in a file or line

O

  • %% operator
    • about / How it works…
  • % operator / How it works…
  • (( )) operator
    • about / How to do it...
  • OAuth
    • about / Getting ready
  • opened port
    • listing / Opened port and services using netstat
  • others, file permissions
    • about / Working with file permissions, ownership, and the sticky bit
  • output, multiple commands
    • reading / Reading the output of a sequence of commands in a variable, Getting ready

P

  • --password argument / Accessing pages with HTTP or FTP authentication
  • /proc
    • used, for obtaining information / Using /proc for gathering information
  • parameter operations
    • about / Text slicing and parameter operations, How to do it...
  • partimage
    • about / Creating entire disk images using fsarchiver
  • passwd command
    • about / How it works…
  • paste command
    • about / How to do it...
  • patch command
    • used, for patching difference file / Finding the difference between files, patching
  • patch file
    • about / Finding the difference between files, patching
    • generating / How to do it...
    • changes, reverting / How to do it...
  • PATH environment variable
    • about / How to do it...
  • pattern
    • replacing, with text in all files in directory / Replacing a pattern with text in all the files in a directory, How to do it...
  • pbzip2 command
    • used, for archiving / Faster archiving with pbzip2, How to do it...
    • working / How it works...
  • pbzip2 command, features
    • number of CPUs, specifying / Manually specifying the number of CPUs
    • compression ratio, specifying / Specifying the compression ratio
  • pcpu command
    • about / How to do it...
  • pgrep command / Getting ready, Finding the process ID when given command names
  • PHP / Introduction
  • PID
    • about / Gathering information about processes
  • ping command
    • about / Let us ping!
    • using / How to do it...
    • used, for checking the connectivity of hosts / How to do it...
    • used, for listing live machines on network / How to do it..., Parallel pings
  • ping command, functionalities
    • Round Trip Time (RTT), finding / Round trip time
    • echo packets, limiting / Limiting the number of packets to be sent
    • return status / Return status of the ping command
  • pkill command
    • about / The kill family of commands
  • popd command
    • about / Getting ready
    • using / How to do it...
    • used, for directory switching / Most frequently used directory switching
  • port analysis
    • about / Network traffic and port analysis, How to do it...
  • port forwarding
    • about / Port forwarding using SSH
    • SSH, used / Port forwarding using SSH, How to do it...
  • POST request
    • about / Posting to a web page and reading the response
  • power consumption
    • measuring, powertop command used / Measuring and optimizing power usage
    • optimizing, powertop command used / How to do it...
  • powertop command
    • used, for measuring power consumption / Measuring and optimizing power usage, How to do it...
  • prepend() function
    • defining / Function to prepend to environment variables
    • working / How it works...
  • printf() function / Special variables
  • printf command
    • about / How to do it...
  • processes
    • about / Gathering information about processes
    • environment variables, displaying for / Showing environment variables for a process
    • killing / Getting ready, How to do it...
  • process ID
    • finding / Finding the process ID when given command names
  • process manipulation commands
    • top / top
    • ps / Sorting the ps output with respect to a parameter
    • pgrep / Finding the process ID when given command names
  • process threads
    • information / Information about process threads
  • ps command
    • used, for monitoring CPU usage / Listing the top 10 CPU consuming processes in an hour, How to do it...
    • used, for gathering information about processes / How to do it...
    • about / Sorting the ps output with respect to a parameter
    • TTY filters / TTY filter for ps
  • ps output
    • filtering / Filters with ps for real user or ID, effective user or ID
  • pushd command
    • about / Getting ready
    • using / How to do it...
    • used, for directory switching / Most frequently used directory switching
  • pwd command
    • about / Spawning a separate process with subshell

R

  • read command
    • about / Reading n characters without pressing the return key
  • readlink command
    • about / How to do it...
  • recursive function / The recursive function
  • redirection
    • working with / How to do it..., How it works...
    • from file to command / Redirection from a file to a command
    • from text block / Redirecting from a text block enclosed within a script
  • referer string
    • about / Setting the referer string with cURL
    • setting, with cURL / Setting the referer string with cURL
  • regex
    • about / How to do it...
  • regular expressions
    • about / Using regular expressions
    • using / Using regular expressions
    • text matching / How to do it...
    • components / How it works...
    • special characters / Treatment of special characters
    • visualizing / Visualizing regular expressions
  • remote disk usage health monitor
    • about / Remote disk usage health monitor
    • working / How it works…
  • remote drive
    • mounting, at local mount point / Mounting a remote drive at a local mount point
  • remote host
    • commands, executing with SSH / Running commands on a remote host with SSH, How to do it...
  • remote machine
    • graphical commands, executing / Running graphical commands on a remote machine
  • rename command
    • about / Renaming and moving files in bulk, Getting ready
    • image files, renaming / How to do it...
    • working / How it works…
  • return value, of command
    • reading / Reading the return value (status) of a command
  • reverse port forwarding
    • about / Reverse port forwarding
  • root command
    • about / Filters with ps for real user or ID, effective user or ID
  • ROT13 / How it works…
  • rotation / Logfile management with logrotate
  • Round Trip Time (RTT)
    • about / Round trip time
  • routing table
    • information, displaying / Showing routing table information
    • about / Showing routing table information
  • RSS feeds
    • parsing / How to do it...
  • rsync command
    • used, for backing up snapshots / Backup snapshots with rsync, How to do it...
    • working / How it works...
    • functionalities / There's more...
    • files, excluding while archiving / Excluding files while archiving with rsync
    • non-existent files, deleting / Deleting non-existent files while updating rsync backup
    • backups, scheduling at intervals / Scheduling backups at intervals

S

  • #spawn parameter
    • about / Automating with expect
  • SCP
    • about / SCP (secure copy program)
    • used, for recursive copying / Recursive copying with SCP
  • screenshots
    • taking, from terminal / Taking screenshots from the terminal
  • script
    • debugging / Debugging the script, How to do it..., How it works...
  • script command
    • about / Getting ready
    • used, for recording terminal sessions / How to do it...
    • working / How it works...
  • scripting
    • about / Introduction
  • scriptreplay command
    • about / Getting ready
    • used, for recording terminal sessions / How to do it...
    • working / How it works...
  • sed command
    • about / How it works..., Using sed to perform text replacement
    • used, for performing text replacement / Using sed to perform text replacement, How to do it…, There's more...
    • blank lines, removing / Removing blank lines
    • text replacement, performing in file / Performing replacement directly in the file
    • matched string notation (&) / Matched string notation (
    • substring match notation (\1) / Substring match notation (\1)
    • multiple expressions combination / Combination of multiple expressions
    • quoting / Quoting
    • used, for replacing matched sentence / Getting ready
  • sentence, containing word
    • removing / Removing a sentence in a file containing a word, How to do it...
  • services
    • listing / Opened port and services using netstat
  • set difference operation, text files
    • about / Getting ready, How it works...
    • performing / How to do it...
  • setgid permission / Working with file permissions, ownership, and the sticky bit
  • setuid permission / Working with file permissions, ownership, and the sticky bit
  • SFTP
    • about / SFTP (Secure FTP)
  • SHA-1
    • about / Getting ready, How it works..., How to do it...
  • shadow-like salted hash
    • about / How to do it...
  • shebang
    • about / Introduction
  • shell
    • terminal, printing / Printing in the terminal, How to do it...
    • variables / Playing with variables and environment variables
    • prepend() fucntion, defining / Function to prepend to environment variables, How it works...
    • arithmetic operations / Math with the shell
    • file descriptors / Playing with file descriptors and redirection
    • arrays / Arrays and associative arrays
    • alias / Visiting aliases
    • terminal settings, collecting / Grabbing information about the terminal
    • terminal settings, manipulating / Grabbing information about the terminal
    • dates and time delays, working with / Getting and setting dates and delays
    • script, debugging / Debugging the script
    • functions, defining / Functions and arguments
    • internal field separator (IFS) / Field separators and iterators
  • shell scripts
    • about / Introduction
  • SHELL variable
    • identifying / Identifying the current shell
  • signals
    • about / Killing processes and send or respond to signals
    • responding to / Capturing and responding to signals
    • capturing / Capturing and responding to signals
  • sort command
    • about / Sorting unique and duplicates
    • working / How it works…
    • sorting, keys or columns used / Sorting according to the keys or columns
  • sort utility / How to do it…
  • special variables, awk command
    • NR / Special variables
    • NF / Special variables
    • $0 / Special variables
    • $1 / Special variables
    • $2 / Special variables
  • spell checker
    • using / Spell checking and dictionary manipulation
  • split command
    • about / Splitting files and data
    • files and data, spiltting / Splitting files and data, How to do it...
    • filename prefix, specifying for spilt files / Specifying a filename prefix for the split files
  • squashfs-tools
    • installing / Getting ready
  • squashfs files
    • creating / How to do it...
    • mounting / How to do it...
  • squashfs filesystem
    • about / Creating filesystems with compression
    • creating, with compression / Creating filesystems with compression
    • customizing / There's more...
    • files, exclusing / Excluding files while creating a squashfs file
  • SSH
    • about / Running commands on a remote host with SSH
    • used, for executing commands on remote host / Running commands on a remote host with SSH, How to do it..., There's more...
    • with compression / SSH with compression
    • data, redirecting into stdin of remote shell commands / Redirecting data into stdin of remote host shell commands
    • used, for port forwarding / Port forwarding using SSH, How to do it...
    • non-interactive port forward / Non-interactive port forward
    • reverse port forwarding / Reverse port forwarding
  • ssh-keygen command / Getting ready
  • SSH keys
    • creating, for auto-login / Password-less auto-login with SSH
  • sticky bit permission
    • about / Working with file permissions, ownership, and the sticky bit
  • string comparisons
    • performing / How to do it...
  • string manipulation functions, awk
    • length(string) / String manipulation functions in awk
    • index() / String manipulation functions in awk
    • split() / String manipulation functions in awk
    • substr() / String manipulation functions in awk
    • sub() / String manipulation functions in awk
    • gsub() / String manipulation functions in awk
    • match() / String manipulation functions in awk
  • subshell
    • about / Spawning a separate process with subshell
    • quoting, for preserving spacing and newline character / Subshell quoting to preserve spacing and the newline character
  • subshell method / How to do it...
  • symbolic links
    • about / Finding symbolic links and their targets
    • handling / How to do it...
    • target path, reading / How to do it...
    • working / How it works...
  • syslinux package
    • downloading / Hybrid ISO that boots off a flash drive or hard disk
  • syslog
    • about / Logging with syslog
  • syslogd
    • used, for logging info from shell script / Logging with syslog, Getting ready, How to do it...
    • about / Logging with syslog
  • system information
    • obtaining / Gathering system information, How to do it...

T

  • --totals option / Printing total bytes
  • tac command / Getting ready
  • tail command
    • about / Using head and tail for printing the last or first 10 lines
  • Tape ARchives / Archiving with tar
  • tar command
    • about / Archiving with tar
    • used, for creating archives / Archiving with tar
    • working / How it works...
    • features / There's more...
    • stdin / stdin and stdout with tar
    • stdout / stdin and stdout with tar
  • tar command, features
    • files, appending to archives / Appending files to an archive
    • files and folders, extracting from archives / Extracting files and folders from an archive
    • multiple tar files, concatenating / Concatenating two archives
    • iles, updating with timestamp check / Updating files in an archive with a timestamp check
    • files, comparing in archive and file system / Comparing files in the archive and file system
    • files, deleting from archive / Deleting files from the archive
    • tar archive, compressing / Compression with the tar archive
    • file set, excluding from archiving / Excluding a set of files from archiving
    • version control directories, excluding / Excluding version control directories
    • total bytes, printing / Printing total bytes
  • TCP/IP / Introduction
  • temporary file
    • creating, mktemp command used / How to do it...
  • terminal
    • about / Printing in the terminal
    • printing / How to do it...
    • working / How it works...
    • screenshots, taking from / Taking screenshots from the terminal
  • terminal session
    • recording, with script and scriptreplay / How to do it...
  • terminal settings
    • collecting / Grabbing information about the terminal, Getting ready
    • manipulating / Getting ready
  • tests
    • performing / Comparisons and tests, How to do it...
  • text
    • searching, in file with grep command / Searching and mining a text inside a file with grep, How to do it...
    • slicing / Text slicing and parameter operations, How to do it...
  • text, between line numbers or patterns
    • printing / Printing text between line numbers or patterns
  • time command
    • used, for calculating command execution time / Calculating the execution time for a command, How to do it...
    • working / How it works...
    • parameters / How it works...
  • top command
    • about / top
  • touch command
    • used, for generating blank files in bulk / Generating blank files in bulk
    • about / Getting ready
  • TO_init function / How it works...
  • traceroute command / Traceroute
  • translate / Translating with tr
  • trap command
    • about / Capturing and responding to signals
  • tr command
    • about / Translating with tr
    • translation, performing / How to do it...
    • working / How it works…
    • characters, deleting / Deleting characters using tr
    • character set, complementing / Complementing character set
    • characters, squeezing / Squeezing characters with tr
    • character classes / Character classes
  • tree command
    • about / Getting ready, How to do it...
  • TTY(Tele TYpewriter)
    • about / How to do it...
  • TTY filter, for ps command / TTY filter for ps
  • Twitter
    • about / Twitter command-line client
    • used, for reading tweets on timeline / Twitter command-line client, Getting ready, How to do it..., How it works...
  • TwitterOAuth.sh library / How it works...

U

  • --user argument / Accessing pages with HTTP or FTP authentication
  • UID value / Checking for super user
  • uniq command
    • about / Sorting unique and duplicates, uniq
    • working / How it works…
  • Unix time / Getting ready
  • until loop / How to do it...
  • URLs
    • parsing, from text / Parsing e-mail addresses and URLs from text, How it works...
  • usage() function
    • about / How it works…
  • user, file permissions
    • about / Working with file permissions, ownership, and the sticky bit
  • useradd command
    • about / How it works…
  • user administration script
    • about / How to do it…, How it works…
  • user agent string
    • setting, with cURL / Setting a user agent string with cURL
  • user logins
    • monitoring, for intruder detection / Monitoring user logins to find intruders, How to do it…, How it works…
  • usermod command
    • about / How it works…
  • user terminals
    • messages, sending to / Sending messages to user terminals, How it works...

V

  • var
    • about / How to do it...
  • variables
    • about / Playing with variables and environment variables
    • working with / Playing with variables and environment variables, Getting ready, How to do it...
    • environment variables / Playing with variables and environment variables
    • length, finding / Finding the length of a string
    • shell variable, identifying / Identifying the current shell
    • super user, checking / Checking for super user
    • bash prompt string, modifying / Modifying the Bash prompt string (username@hostname:~$)
  • version control based backup
    • Git used / Version control-based backup with Git, How to do it...

W

  • wall command
    • about / Getting ready
  • watch command
    • used, for monitoring command output / Monitoring command outputs with watch
    • differences, highlighting / Highlighting the differences in the watch output
  • wc command
    • used, for coutning lines / How to do it...
    • used, for coutning words / How to do it...
    • used, for coutning characters / How to do it...
  • Web
    • about / Introduction
  • Web backend
    • used, for creating define utility / Creating a "define" utility by using the Web backend, Getting ready, How to do it..., How it works...
  • web page
    • downloading, wget command used / Downloading from a web page, How it works...
    • accessing, with HTTP or FTP authentication / Accessing pages with HTTP or FTP authentication
    • downloading, as plain text / Downloading a web page as plain text
    • response, reading / Posting to a web page and reading the response, Getting ready, How it works...
    • posting to / Posting to a web page and reading the response, How it works...
  • Web photo album generator
    • about / Web photo album generator, Getting ready
    • working / How it works...
  • website
    • data, parsing from / Parsing data from a website
    • broken links, identifying / Finding broken links in a website, How to do it..., How it works...
    • changes, tracking / Tracking changes to a website, How to do it..., How it works...
  • WEP (Wired Equivalent Privacy) / How to do it...
  • wget command
    • about / Getting ready
    • used, for downloading web page / How to do it...
    • download speed, restricting / Restricting the download speed
    • download, resuming / Resume downloading and continue
    • website, copying / Copying a complete website (mirroring)
  • whatis command
    • about / About which, whereis, file, whatis, and load average
  • whereis command
    • about / About which, whereis, file, whatis, and load average
  • which command
    • about / About which, whereis, file, whatis, and load average
  • while loop / How to do it...
    • about / How it works...
  • Wi-Fi Protected Access2 (WPA2) / How it works...
  • wireless network connection
    • performing / Connecting to a wireless network, How it works...
  • word count
    • about / Counting the number of lines, words, and characters in a file
  • words
    • about / Getting ready
  • words, files
    • counting, wc command used / How to do it...

X

  • xargs command
    • about / Playing with xargs
    • using / Getting ready
    • multiple-line input, converting to single-line output / How to do it...
    • single-line intput, converting to multiple-line output / How to do it...
    • working / How it works…
    • formatted arguments, passing / Passing formatted arguments to a command by reading stdin
    • using, with find command / Using xargs with find
    • C program files, counting / Counting the number of lines of C code in a source code directory
    • subshell, using with while loop / While and subshell trick with stdin

Z

  • zcat command
    • about / zcat - reading gzipped files without extracting
  • zip command
    • about / Archiving and compressing with zip
    • used, for archiving / Archiving and compressing with zip
    • used, for compressing / Archiving and compressing with zip
    • working / How it works...
lock icon The rest of the chapter is locked
arrow left Previous Section
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime