Extensive, example-based Linux shell programming reference includes an English-to-shell dictionary, a tutorial and handbook, and many tables of information useful to programmers. Besides listing more than 2000 shell one- liners, it explains the principles and techniques of how to increase performance (execution speed, reliability, and efficiency), which apply to many other programming languages beyond shell. High Performance Linux Shell Programming Reference 2015 Edition Order the complete book from Booklocker.com http://www.booklocker.com/p/books/7831.html?s=pdf or from your favorite neighborhood or online bookstore. Your free excerpt appears below. Enjoy! High Performance Linux Shell Programming Reference 2015 Edition High Performance Linux Shell Programming Reference, 2015 Edition Copyright © 2015 by Edward J. Smeltz ISBN 978-1-63263-401-6 All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, recording or otherwise, without the prior written permission of the author. Printed on acid-free paper All information herein is believed to be accurate and correct, but the author and Booklocker.com, Inc assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained in this book. Manufacturers and sellers often use specific designations for their products to distinguish them in the marketplace. Where such designations appear in this book, and E. J. Smeltz was aware of a trademark claim, the designations have been printed in all caps or in initial caps. All trademarks are the property of their respective owners. Each URL cited herein was operational as of the time the passage referring to each was written. Because web sites sometimes relocate or disappear from the web, some web pages might cease to appear at the URLs indicated for them at a future point in time. A web search might reveal a new URL for the desired material if a cited URL goes away. Booklocker.com, Inc. 2015 www.BookLocker.com Watch for the upcoming novel series from E. J. Smeltz entitled Obeying God Uphill. Table of Contents Preface ........................................................................................................................................................ xiii Section 1 - Basic Information ...................................................................................................................... 1 1.01 Why Use Linux Shell Scripts? .......................................................................................................... 3 1.02 The Structure of this Book ................................................................................................................ 7 1.03 How to Create a Safe Environment for Learning Shell ................................................................... 13 1.04 How to Find Commands .................................................................................................................. 17 1.05 Conventions and Terminology ........................................................................................................ 21 1.06 Glossary of Shell Commands and Keywords of Interest ................................................................. 23 1.07 Common Linux System Status Commands & Tools ....................................................................... 41 1.08 Commands for Delayed, Periodic, or Unattended Execution .......................................................... 43 1.09 Shells ............................................................................................................................................... 45 1.10 bash Internal Shell Variables and set Options ............................................................................ 49 1.11 File Types, File Extensions, and Magic Numbers ........................................................................... 53 1.12 POSIX Character Class Definitions ................................................................................................ 59 1.13 ASCII Character Tables .................................................................................................................. 63 1.14 ANSI Escape Codes ........................................................................................................................ 71 Section 2 - Linux Shell Programming Dictionary ................................................................................... 75 2.01 Appending ....................................................................................................................................... 83 2.02 Archiving, Unarchiving ................................................................................................................... 91 2.03 Calculating General Numbers and Dates ...................................................................................... 101 2.04 Calculating Geometric Quantities ................................................................................................. 121 2.05 Calculating Maximums, Minimums, Means, Medians, Modes, and Totals .................................. 129 2.06 Comparing Files, Running Checksums ......................................................................................... 137 2.07 Compressing, Uncompressing ....................................................................................................... 141 2.08 Converting Data from One Type to Another ................................................................................. 157 2.09 Converting Numbers from One Base to Another .......................................................................... 167 2.10 Copying and Duplicating Characters, Words, Fields, and Lines .................................................. 171 2.11 Copying and Moving Files on a Single Host or Between Multiple Hosts .................................... 177 2.12 Counting, Indexing, Numbering, Serializing ................................................................................ 203 2.13 Deleting Characters, Words, Fields, and Lines ............................................................................. 213 2.14 Encoding, Decoding ...................................................................................................................... 233 2.15 Finding Files, Executing Commands on Found Files ................................................................... 237 2.16 Formatting Data, Reformatting Data ............................................................................................. 261 2.17 Generating Numbers and Strings, Random and Non-random ....................................................... 281 2.18 Graphing, Plotting Data ................................................................................................................. 297 2.19 Inserting, Including ........................................................................................................................ 309 2.20 Joining Lines Horizontally, Pasting Files Side by Side ................................................................ 321 2.21 Joining Lines Vertically, Concatenating Files and Streams .......................................................... 325 2.22 Listing, Extracting, Displaying ...................................................................................................... 329 2.23 Looping and Converting Between Pipelines and Variables .......................................................... 347 2.24 Prefixing, Prepending .................................................................................................................... 373 2.25 Scheduling and Timing Job Execution .......................................................................................... 381 2.26 Separating Lines Horizontally ....................................................................................................... 387 xi E. J. Smeltz 2.27 Separating, Splitting Lines Vertically ............................................................................................ 391 2.28 Shifting, Rearranging Items Horizontally Within a Line ............................................................... 395 2.29 Shuffling, Randomizing Line Order .............................................................................................. 399 2.30 Sorting Line Order ......................................................................................................................... 403 2.31 Sorting, Separating Items to Different Destinations ...................................................................... 409 2.32 Substituting, Translating, Replacing One Item with Another ........................................................ 415 2.33 Testing, Conditionals, Exit Values, Pipelines as Conditionals ...................................................... 423 Section 3 - One-Liners that Show or Control the State of the Computer ............................................ 457 3.01 CPU, Memory, Drivers, Kernel, Time, Locale, and General Hardware ........................................ 459 3.02 Data Storage, File Systems, Individual Files ................................................................................. 475 3.03 Network.......................................................................................................................................... 495 3.04 Peripherals.....................................................................................................................................
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages48 Page
-
File Size-