Book Image

Linux Command Line and Shell Scripting Bible - Third Edition

By : Richard Blum, Christine Bresnahan
Book Image

Linux Command Line and Shell Scripting Bible - Third Edition

By: Richard Blum, Christine Bresnahan

Overview of this book

The Linux command line enables you to type specific shell commands directly into the system to manipulate files and query system resources. Command line statements can be combined into short programs called shell scripts, a practice increasing in popularity due to its usefulness in automation. Linux is a robust system with tremendous potential, and Linux Command Line and Shell Scripting Bible opens the door to new possibilities. Linux Command Line and Shell Scripting Bible is your essential Linux guide. It contains new functional examples that are fully updated to align with the latest Linux features. Beginning with command line fundamentals, the book moves into shell scripting and shows you the practical application of commands in automating frequently performed functions. This book is a complete guide providing detailed instruction and expert advice working within this aspect of Linux. Whether used as a tutorial or as a quick reference, this book contains information that every Linux user should know.
Table of Contents (34 chapters)
2
Part I: The Linux Command Line
13
Part II: Shell Scripting Basics
20
Part III: Advanced Shell Scripting
28
Part IV: Creating Practical Scripts
32
End User License Agreement

Working with Data Files

When you have a large amount of data, handling the information and making it useful can be difficult. As you saw with the du command in the previous section, it's easy to get data overload when working with system commands.

The Linux system provides several command line tools to help you manage large amounts of data. This section covers the basic commands that every system administrator — as well as any everyday Linux user — should know how to use to make their lives easier.

Sorting data

The sort command is a popular function that comes in handy when working with large amounts of data. The sort command does what it says: It sorts data.

By default, the sort command sorts the data lines in a text file using standard sorting rules for the language you specify as the default for the session.

 $ cat file1
 one
 two
 three
 four
 five
 $ sort file1
 five
 four
 one
 three
 two
 $

It's pretty simple, but things aren't always as easy as they...