Title graphic

Why bother?

Why do you need to learn the command line anyway? Well, let me tell you a story. Not long ago we had a problem where I used to work. There was a shared drive on one of our file servers that kept getting full. I won't mention that this legacy operating system did not support user quotas; that's another story. But the server kept getting full and stopping people from working. One of the software engineers in our company spent the better part of a day writing a C++ program that would look through the directories of all the users and add up the space they were using and make a listing of the results. Since I was forced to use the legacy OS while I was on the job, I installed a version of the bash shell that works on it. When I heard about the problem, I realized I could do all the work this engineer had done with this single line:

du -s * | sort -nr > $HOME/space_report.txt

Graphical user interfaces (GUIs) are helpful for many tasks, but they are not good for all tasks. I have long felt that most computers today do not use electricity. They instead seem to be powered by the "pumping" motion of the mouse! Computers were supposed to free us from manual labor, but how many times have you performed some task you felt sure the computer should be able to do? You ended up doing the work by tediously working the mouse. Pointing and clicking, pointing and clicking.

I once heard an author remark that when you are a child you use a computer by looking at the pictures. When you grow up, you learn to read and write. Welcome to Computer Literacy 101. Now let's get to work.

Contents

  1. What is "the shell"?
    1. What's an xterm, gnome-terminal, konsole, etc.?
    2. Starting a Terminal
    3. Testing the Keyboard
    4. Using the Mouse
  2. Navigation
    1. File System Organization
    2. pwd
    3. cd
  3. Looking Around
    1. ls
    2. less
    3. file
  4. A Guided Tour
    1. /
    2. /boot
    3. /etc
    4. /bin, /usr/bin
    5. /sbin, /usr/sbin
    6. /usr
    7. /usr/local
    8. /var
    9. /lib
    10. /home
    11. /root
    12. /tmp
    13. /dev
    14. /proc
    15. /mnt
  5. Manipulating Files
    1. Wildcards
    2. cp
    3. mv
    4. rm
    5. mkdir
  6. I/O Redirection
    1. Standard Output
    2. Standard Input
    3. Pipes
    4. Filters
  7. Permissions
    1. File permissions
    2. chmod
    3. Directory permissions
    4. Becoming the superuser for a short while
    5. Changing file ownership
    6. Changing group ownership
  8. Job Control
    1. A practical example
    2. Putting a program in the background
    3. Listing your processes
    4. Killing a process
    5. A little more about kill

© 2000-2014, William E. Shotts, Jr. Verbatim copying and distribution of this entire article is permitted in any medium, provided this copyright notice is preserved.

Linux® is a registered trademark of Linus Torvalds.