REVIEW - Efficient Linux at the Command Line - Boost Your Command-Line Skills


Title:

Efficient Linux at the Command Line

Boost Your Command-Line Skills

Author:

Daniel J. Barrett

Publisher:

O'Reilly (2022)

Pages:

241

Reviewer:

Ian Bruntlett

Reviewed:

March 2023

Rating:

★★★★★


Verdict: Highly Recommended

This is not an introduction to Linux – it is for people who want to improve their skills using bash. Part 1 (of 3) takes the ideas covered in Appendix A (‘Linux Refresher’), which details the concepts necessary for using Linux at the Command Line and builds on them, covering concepts and techniques that should be immediately useful. It strives to be Linux Distribution agnostic. Chapter 1 dives into combining commands using pipes, limiting itself to six commands: wc, head, cut, grep, sort and, uniq for simplicity’s sake. The following chapter, ‘Introducing the Shell’, covers the basics of working at the command line, wildcard expansion (globbing), filename pattern matching, and is a good read. The ‘Rerunning Commands’ chapter illustrates command line editing and recall using different methods – from the cursor keys through to command history expansion. The fourth chapter, ‘Cruising the Filesystem’, is less about the conventional structures of different Linux distributions and more about how to manoeuvre around your particular filesystem effortlessly – from the most arcane of commands through to the ones you probably know.

As the preface states, this is not your first book on bash and Linux – it is your second. It assumes at least a basic understanding of bash and Linux - Appendix A will help the reader if this is not the case. Whilst it is a bash book, Appendix B, ‘If You Use a Different Shell’, provides a table that lists bash features that are supported by other shells (dash, fish, ksh, tcsh, and zsh). A web site, https://efficientlinux.com/examples is provided to support this book and the publisher’s website, provides errata.

Part 2, ‘Next Level Skills’, starts off with ‘Expanding Your Toolbox’, introducing date, seq, find, yes, tail, awk, df, tac, paste, diff, tr, rev,and sed commands and goes deeper into the use of the grep command. These commands were all selected for their relevance to the use of pipelines and more complex commands – producing text, isolating text, combining text, and transforming text. It notes that grep is short for ‘get regular expression and print’. I always thought the ‘g’ was for ‘global’. It introduces the use of awk at the command line. However, once you have built up an awk command, I believe it is best placed in a script file (either a bash or awk script file). Something like this…

  #!/usr/bin/awk -f
  # awk script to print the last
  field of every line of input
  { print ($NF) }

The next chapter, ‘Parents, Children, and Environments’, is more of a fundamental chapter. It explains how bash is just another ordinary executable file, the relationships between Parent and Child processes, how the environment is configured by standard files, and the role of environment variables.

The next chapter, ‘11 More Ways to Run a Command’ elaborates on how bash evaluates and runs commands. From the very basic through to the more obscure. I was particularly impressed by the fourth technique, ‘Process substitution’.

The ‘Building a Brash One-Liner’ chapter explains how to build the long, complex, powerful command lines that shell programming is infamous for. I am puzzled that the author was determined to work on complex commands based at the command line – personally I would have put such commands in a script file for future reference.

The ‘Leveraging Text Files’ chapter is different to previous chapters which catered for data formats that are already predefined. This chapter takes a business problem first and discusses how to format data to work well with built-in Linux commands as well as those written by the user – with examples of growing complexity.

The final part, ‘Extra Goodies’, is a collection of odds and ends. Its first chapter, ‘Efficiency at the Keyboard’, encourages the user to use hotkeys for greater efficiency – in this case the author is preaching to the choir. I was particularly interested in the author’s use of the command line to control the GUI. He does overlook the xdg-open command. The final chapter, ‘Final Time-Savers’, ably rounds off this book.

During the review of this book, I noticed a couple of omissions:

  • Appendix A, ‘Viewing Documentation’, cites the man command for documentation about many standard commands. This is useful. However, the reader should be aware that the type command displays information about what kind of a command a command is and that the help command is needed for information on shell built-in commands.
  • The shellcheck command is a useful tool to analyse a shell script.

To conclude, this excellent book can turn you into a Power User, if you apply yourself to the task.

Note: These key webpages will be of use, one day…

https://www.gnu.org/software/

https://www.gnu.org/software/bash/manual/

https://www.gnu.org/software/sed/

https://www.gnu.org/software/gawk/

Website: https://www.oreilly.com/library/view/efficient-linux-at/9781098113391/






Your Privacy

By clicking "Accept Non-Essential Cookies" you agree ACCU can store non-essential cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

Current Setting: Non-Essential Cookies REJECTED


By clicking "Include Third Party Content" you agree ACCU can forward your IP address to third-party sites (such as YouTube) to enhance the information presented on this site, and that third-party sites may store cookies on your device.

Current Setting: Third Party Content EXCLUDED



Settings can be changed at any time from the Cookie Policy page.