You are previewing CLI for Noobies: A Primer on the Linux Command Line.
O'Reilly logo
CLI for Noobies: A Primer on the Linux Command Line

Book Description

The Command Line Interface (CLI) is your window into the soul of Linux. At the CLI, you learn how Linux thinks and why it behaves as it does. However, the CLI has a reputation for being difficult to learn and tends to frighten the uninitiated. In CLI for Noobies, Joe Barr explains why the CLI provides the easiest, quickest way to do whatever needs to be done. This book is aimed directly at those just coming to Linux from other environments and covers topics that will make them more comfortable running Linux on their desktop. Topics include Shell commands, applications and tools, networking and security, as well as fun and games.

Table of Contents

  1. Copyright
  2. About the Author
  3. Overview
  4. Preface
    1. Why the CLI?
    2. A Noobie Error
    3. Why for Noobies?
    4. Noobies? That Sounds Like You’re Dissing Us!
    5. What We’ll Cover
    6. Styles and Conventions
    7. A Few Words of Thanks
  5. 1. In the Shell
    1. 1. What the Hell Is a Shell?
      1. Save the Clicks!
      2. Command History
      3. Command Completion
      4. The Shell Is Not Case Insensitive
    2. 2. Alias, Cat, Grep, and Pipe
      1. First, You Make a Roux
      2. The Power of Linux: Feel the Force, Luke?
      3. Alias: Who Was That Masked Command?
      4. Ask “Number, Please” and the Sly CLI Provides It
    3. 3. All About Files
      1. What Kind of File Is This?
      2. Houston, Do You cp?
      3. Stacking Commands on the CLI
      4. I Feel the Earth mv Under My Feet
      5. Let’s rm the Evidence
    4. 4. Man for Hier: The File System Hierarchy
      1. Charity Begins at /home
      2. So Forth and /etc
      3. /bin There, /sbin That
      4. Choose Your Own PATH, Grasshopper
      5. Lost and Find (and Locate)
      6. Locate a File Faster
      7. Which Program Version
    5. 5. Everything’s a File
      1. It’s Like This, C
        1. Redirecting Files
      2. What’s Next?
    6. 6. Helpful Tips and Tricks
      1. When Less Is More
      2. Who Am I, Really?
      3. Is He a Man with a .plan?
      4. Init: The Mother of All Processes
      5. What if X Crashes?
    7. 7. Permissions: Mother, May I?
      1. Reading, Writing, and Executing Files
      2. Who Has Permission? ls Knows
      3. Changing Permissions
      4. Octal Math Instead of the List
    8. 8. Directory Assistance, How May I Help You?
      1. ls: The Basics
      2. ls: Let’s Get Wide
      3. ls: Is That All There Is?
      4. R You Still with Us?
      5. Enough, Already!
    9. 9. whatis apropos?
      1. Remember apropos
    10. 10. background, foreground, suspend
      1. Here’s the background
      2. You’re suspended!
    11. 11. Watch That File
      1. Examples of Watch
    12. 12. Sudo Voodoo
      1. But Wait, I Don’t Like gedit!
      2. A Sudo Session
      3. Not root and Other Options
    13. 13. Test This Command
      1. You’ve Got Mail, or Do You?
      2. Another Test
      3. Test According to Info
    14. 14. Not Your Father’s Batch
      1. Batch Keeps at Simple
      2. Batch Starts at Now
      3. What the $@?
    15. 15. Need Redirection?
      1. Less Than: <
      2. More Than: >
      3. More More Than: >>
      4. What About STDERR?
      5. Put This in Your Pipe and Smoke It
    16. 16. Sort Like This
      1. Sorting a Small File
      2. Redirecting Sort Output
      3. Changing the Sort Key
      4. Defining a Sort Field
      5. Rumors of a Merge, and More
    17. 17. Symbolic Links
      1. Background: Real Links and inodes
      2. Creating Symbolic Links
      3. So Why Use Symbolic Links?
    18. 18. Taming a Wild Mount
      1. Mount What?
      2. Like, Who Cares About File Systems?
      3. But How Did You Know the Type and Device?
      4. Umount not Unmount
    19. 19. Sharing More with Sysctl
      1. Sysctl and Shared Memory
      2. Sysctl and Home Security
    20. 20. Pimp Your Prompt
      1. Stock Bash Prompt
      2. Customizing the Prompt
      3. Colorize Your Prompt
    21. 21. Environmental Issues
      1. Taking Charge of Our Environment!
      2. Set Down a Moment
      3. $talks
      4. Unset That Variable
    22. 22. The Lowdown on Top
      1. Top Topics
      2. From the Stupid Tricks Section
    23. 23. Who Sed That?
      1. So What Is Sed?
      2. Learning to Use Sed
    24. 24. Shutdown
      1. Using Shutdown
      2. Changing Runlevels
      3. More About Lesson Two
    25. 25. ldconfig and Friends
      1. What ldconfig Does
      2. How ldconfig Remembers
    26. 26. locate, slocate, and rlocate
      1. Finding a File
      2. Updating the Database
      3. rlocate Searches Faster
    27. 27. Information, Please
      1. Whereis That Darn Command?
      2. Whatis That Command For?
      3. How Much Disk Space Do I Have Left?
      4. I’m Running the 2.4 Kernel, What About You?
      5. What’s My IP Address?
      6. How Do I Get to the Internet from Here?
      7. At Last
    28. 28. GNU Find
      1. Follow this Path
      2. Other Searches with Find
      3. Searching for Symbolic Links
    29. 29. lsof
      1. Lsof Quickstart
      2. Lsof by Categories
      3. Compounding lsof
    30. 30. Shell Programming
      1. What Is a Shell, Again?
      2. Shell Script Arguments
      3. Permission Denied?
      4. Plenty More Where That Came From
  6. 2. Applications and Tools
    1. 31. Making and Melting tarballs
      1. Introduction to tar
      2. Decompressing tarballs
      3. Creating a tar Archive
      4. But What If You Don’t Want to Archive It All?
    2. 32. The Magic Mantra: configure, make, and make install
      1. configure
      2. make
      3. make install
    3. 33. Got Backup?
      1. Backups Are Best Done Before a Crash
      2. A Few Words from the Author of simplebackup.pl
    4. 34. Don’t Forget a Birthday
      1. Date Format for Birthday
      2. Running Birthday
    5. 35. cal and calendar
      1. cal tech
      2. calendar Daze
    6. 36. CheckInstall
      1. Removing Programs with CheckInstall
      2. Where to Find CheckInstall
      3. Using CheckInstall
    7. 37. Hack the Comment
      1. What Comment Does
      2. Let’s Hack This Comment
    8. 38. Lay Down the Law with Edict
      1. Installing Edict Is a Snap
      2. Using Edict
    9. 39. Hdparm and the Zen of Data Transfer
      1. Tweaking Your Hard Drive
      2. How Fast Is That Drive Going?
      3. hdparm Is Useful for Newer Drives as Well
    10. 40. Hex Dump Unlocks Mysteries
      1. A Hex Dump
      2. Hex Dump in Plain Language
      3. Getting to the Point in a Hex Dump
    11. 41. Ispell
      1. Putting Ispell to Work
      2. Is That All There Is to Ispell?
    12. 42. Surfing with Lynx
      1. Lynx Basics
      2. Tweaking Lynx
    13. 43. A Little Mirdir, My Dear?
      1. Mirror This
      2. Optional Behavior
      3. About Those Exceptions
    14. 44. Import, Display, Mogrify
      1. Why Bother with Import and Display?
      2. Get the Picture?
      3. More on Import
      4. What Is Mogrify?
    15. 45. Rec, Play, and Nice
      1. Recording from the Mic
      2. Play and Rec Simplify Sox
      3. Dumbing Down Sound Processing
      4. Play Nice
      5. Saved by the (Sound of the) Bell!
    16. 46. Say What, Saytime
      1. Buddy, Can You Spare Saytime?
      2. su for SuperUser Privileges
    17. 47. Antiword
      1. Building Antiword
      2. Using Antiword
    18. 48. Looking for Strings in All the Wrong Places
      1. Using Strings
      2. Finding Offsets with Strings
    19. 49. Recycle Your Shell
      1. Changing Shells the chsh Way
      2. Changing Shells Randomly with vfsh
  7. 3. Networking and Security
    1. 50. Dig ifconfig and Ping
      1. Do You Know Your IP Address?
      2. Do You Know Their IP Address?
      3. A Private LAN Where Nobody Knows Your IP Address
      4. DNS Problems
    2. 51. FTP Moves Files
      1. Old School FTP
      2. What’s This FTP Server Got?
    3. 52. The Key to GnuPG
      1. Gimme Two Keys and Hold the Mayo
      2. We Only passphrase This Way but Once
      3. Revoke This!
    4. 53. Sending and Reading Secret Mail
      1. Verify Public Keys with Fingerprints
      2. Reading Secret Mail
      3. How Good Is GnuPG?
    5. 54. Cryptographic Signatures
      1. Why Sign Your Data?
      2. Verifying a Signature
      3. I Can Sign Clearly Now
      4. Another Way to Sign Data
    6. 55. OpenSSH
      1. Knock, knock. Ssh, Are You There?
      2. Using scp for Secure Remote Copy
      3. More on Authentication
    7. 56. Passwd and Passwords
      1. What’s a Weak Password?
      2. What’s a Strong Password?
    8. 57. John the Ripper
      1. Installing John the Ripper
      2. Who Knows Your Secret Passwords? Shadow Knows
      3. Using John the Ripper
    9. 58. Route
      1. The Routing Table
      2. So What’s the Point in Learning About Route?
    10. 59. More About ifconfig
      1. Show Me Your Network Devices
      2. Changing the Status of a Network Device
    11. 60. Netcat
      1. Netcat on the LAN
      2. Scanning Ports with Netcat
    12. 61. Tcpdump
      1. Using Tcpdump
      2. The Real Magic of Tcpdump
    13. 62. The Word on Wget
      1. How About Those Options?
      2. Let’s Wget a Website
    14. 63. Rsync for Backups
      1. Before Using Rsync
      2. Source and Destination
      3. What Are the Rsync Options?
      4. Give Me My Data Back!
    15. 64. Trojanscan
      1. Don’t Use the Magic Mantra Here
      2. Testing Trojanscan
  8. 4. Fun and Games
    1. 65. Aldo Talks in Code
      1. Configuring Aldo
      2. Classic Code
      3. Aldo’s Other Modes
    2. 66. Three Clocks for the CLI
      1. There Are Only Two Kinds of Clocks
      2. Reading Binary Time Clocks
      3. An Audible Clock
      4. Hurry Up, Please, It’s Time (for an Analog Clock)
    3. 67. Have Fun with ESR
      1. It’s All About Greed
      2. Would You Like to Ski, Silly?
      3. An Empire of One’s Own
    4. 68. Let’s Play Go!
      1. The Game of Go
      2. Installing the Game
      3. Coming Clean About Configure Options
      4. Would You Like to Play Thermonuclear Go?
    5. 69. Mmmm Pizza
      1. Installation
      2. One Final Hurdle
      3. Let’s Eat
      4. What’s the Point in Ordering Over the Internet?