Chapter 3. Using Unix

Table of Contents

3.. KISS: Keep It Simple, Stupid
3.. What is Unix?
Aw, man... I Have to Learn Another System?
Operating System or Religion?
The Unix Standard API
Shake Out the Bugs
The Unix Standard UI
Fast, Stable and Secure
Sharing Resources
3.. Unix User Interfaces
Graphical User Interfaces (GUIs)
X11 on macOS
Command Line Interfaces (CLIs): Unix Shells
Basic Shell Use
3.. Still Need Windows? Don't Panic!
Cygwin: Try This First
Windows Subsystem for Linux: Another Compatibility Layer
3.. Logging In Remotely
Unix to Unix
Windows to Unix
Terminal Types
3.. Unix Command Basics
3.. Basic Shell Tools
Common Unix Shells
Command History
Command-line Editing
Globbing (File Specifications)
3.. Processes
3.. The Unix File System
Unix Files
File system Organization
Ownership and Permissions
3.. Unix Commands and the Shell
Internal Commands
External Commands
Getting Help
Some Useful Unix Commands
3.. POSIX and Extensions
3.. Subshells
3.. Redirection and Pipes
Device Independence
Special Files in /dev
Misusing Pipes
3.. Power Tools for Data Processing
Gzip, bzip2, xz
Zip, unzip
GNU Parallel
3.. File Transfer
Downloading Files with Curl, Fetch, and Wget
Pushing and Pulling Files with SFTP and Rsync
3.. Environment Variables
3.. Shell Variables
3.. Process Control
External Commands
Special Key Combinations
Shell Features for Job Control
3.. Remote Graphics
Configuration Steps Common to all Operating Systems
Graphical Programs on Windows with Cygwin
Remote 3D Graphics

Before You Begin

If you think the word "Unix" refers to Sumerian servants specially "trained" to guard a harem, you've come to the right place. This chapter is designed as a tutorial for users with little or no Unix experience.

If you are following this guide as part of an ungraded workshop, please feel free to work together on the exercises in this text. It would be very helpful if experienced users could assist less experienced users during the "practice breaks" in order to keep the class moving forward and avoid leaving anyone behind.

KISS: Keep It Simple, Stupid

Most people make most things far more complicated than they need to be. Engineers and scientists, especially so.


To the engineer, all matter in the universe can be placed into one of two categories:

  1. Things that need to be fixed

  2. Things that will need to be fixed after I've had a few minutes to play with them

Engineers like to solve problems. If there are no problems available, they will create their own problems. Normal people don't understand this concept; they believe that if it ain't broke, don't fix it. Engineers believe that if it ain't broke, it doesn't have enough features yet.

No engineer can look at a television remote control without wondering what it would take to turn it into a stun gun. No engineer can take a shower without wondering whether some sort of Teflon coating would make showering unnecessary. To the engineer, the world is a toy box full of sub-optimized and feature-poor toys.

-- The Engineer Identification Test (Anonymous)

Avoid people who tend to look for the most "sophisticated" solution to a problem. Those who look for the simplest solution are more productive, more rational, and more fun to have a beer with. For more amusement on the subject, look up the story of the king's toaster.

Simplicity is the ultimate sophistication. We achieve more when we make things simple for ourselves. We achieve less when we make things complicated. Most people choose the latter. Complexity is the product of carelessness or ego. Simplicity is the product of a wisdom and clarity of thought.

The original Unix designers were an example of wisdom and clarity. Unix is designed to be as simple and elegant as possible. Some things may not seem intuitive at first, but this is probably because the first idea you came up with is not as elegant as the Unix way. The Unix developers had the wisdom to constantly look for simpler ways to implement solutions instead going with what seemed intuitive at first glance. Learning the Unix way will therefore make you a wiser and happier computer user. I speak from experience.

Unix is not hard to learn. You may have gotten the impression that it's a complicated system meant for geniuses while listening to geniuses talk about it. Don't let them fool you, though. The genius ego compels every genius to make things sound really hard, so you'll think they're smarter than you.

Another challenge with learning anything these days is filtering out the noise on the Internet. Most tutorials on any given subject are incomplete and contain misinformation or bad advice. As a result, new users are often led in the wrong direction and hit a dead end before long. One of the goals of this guide is to show a simple, sustainable, portable, and expandable approach to using Unix systems. This will reduce your learning curve by an order of magnitude.

Most researchers don't know enough about Unix. As a result, their productivity suffers dramatically. Unix has grown immensely since it was created, but the reality is, you don't need to know a lot in order to use Unix effectively. You can become more sophisticated over time if you want, but most Unix users don't really need to. It may be better to stick to the KISS principal (Keep It Simple, Stupid) and focus on learning to use the basic tools well rather than learning a huge collection of tools and using them poorly. It's quality vs quantity. Knowledge is not wisdom. Wisdom is knowing how to apply it effectively.


Einstein was once asked how many feet are in a mile. His reply: "I don't know. Why should I fill my brain with facts I can find in two minutes in any standard reference book?"

Many martial arts students like to collect "forms" (choreographed sequences of moves), for the sake of bragging rights. Knowing more forms does not improve one's Kung Fu, however. The term Kung Fu essentially means "skill". A master is someone who can demonstrate mastery of a few forms, not knowledge of many. This depth of understanding does far more for both self-defense capability and personal development than a shallow knowledge of many forms. Develop your Unix Kung Fu in the same way. Aim to become a master rather than an encyclopedia.

Unix is designed to be as simple as possible and to allow you to work as fast as possible, by staying out of your way. Many other systems will slow you down by requiring you to use cumbersome user interfaces or spend time learning new proprietary methods. As you become a master of Unix, your productivity will be limited only by the speed of the hardware and programs you run.

If something is proving difficult to do under Unix, you're probably going about it the wrong way. There is almost always an easier way, and if there isn't, then you probably shouldn't be trying to do what you're trying to do. If it were a wise thing to do, some Unix developer would have invented an elegant solution by now. Adapt to the wisdom of those who traveled this road before you, and life will become simpler.



Be sure to thoroughly review the instructions in Section 2, “Practice Problem Instructions” before doing the practice problems below.
  1. What's the engineer's motto regarding things that ain't broke?

  2. Why do many people believe that Unix is hard to learn?

  3. Is it better to accumulate vast amounts of knowledge or to become highly skilled using the fundamentals? Why?

  4. What is the core principle of Unix design? Explain.