GNU+Linux Crash Course

NOTE: This is not anywhere near a complete tutorial, and it is not meant to stand alone, even once it’s finished. It was used as a teaching tool for an informal, in-person crash-course. It may not be helpful in its current state for anyone who is completely unfamiliar to the material. However, you may find it useful as a reference. I will eventually finish it, polish it, and make it more web-friendly.

Introduction

This is a course that will teach you the basics of the POSIX command line (by way of Debian GNU+Linux) and the basics of the GNOME 3.x desktop environment. It will also teach you what that means, and why you care.

We will be going very fast. It may be difficult for you to remember absolutely everything after the session, but it will give you a good overview, and you should feel free to ask me any questions about POSIX, GNU+Linux, Free Software, or anything else at literally any time. I’ll also provide you with a handy cheat-sheet that will remind you of all the things that we discuss in the session.

This is the first time I’ve done this in an organized fashion. If something doesn’t make sense, or we’re going too fast, shout out and let me know.

What is POSIX?

POSIX is the name of a standard regarding computer operating systems. It stands for “Portable Operating System”-IX. The operating system of your computer is the software that takes information from the fancier applications you use (like your web-browser or your word-processor) and gives it to the hardware in the right formats and at the right times. It’s basically what transforms your computer from a data storage machine or a simple calculator into a multi-function quasi-magic tool. I’ll get to the -IX suffix later. If an operating system is described as “POSIX” or a POSIX System (which is totally redundant, but more natural to me …), it means that it complies (to some extent) to the POSIX standard.

POSIX systems all superficially work the same way. They are based on the functioning of the UNIX operating system (hence the “-IX” suffix). Another way to describe POSIX systems is “Unix-like.” Because POSIX is a standard, if you know how to use one POSIX system, you will know the basics of pretty much any POSIX system. Be aware that, as in anything, the basics will only get you so far.

Popular examples of POSIX systems include GNU+Linux, Solaris, Chromium OS, and Mac OS X.

What is GNU+Linux

GNU+Linux is a (mostly) POSIX-compliant operating system. Linux was developed in 1991 by Linus Torvalds. Linux is the “kernel” of the operating system, that is, very basically, Linux tells each piece of hardware how to communicate with the other pieces of hardware. GNU is a recursive accronym standing for “GNU’s Not Unix.” It was developed by Richard Stallman and the GNU Project as a Free Software replacement for UNIX, which is a proprietary operating system. Development of GNU started in 1983. GNU is what is called the “userland” of the operating system. It contains all of the basic programs that help the user interact with the hardware.

Some people (well, actually, most people) call the entire GNU+Linux system simply “Linux.” Since Linux is only the kernel of the operating system, and would not be a complete operating system without GNU (because it would not have many ways for the human to operate it), I and many others call the system GNU+Linux. Because GNU is the portion of the operating system that the human most often interacts with, I will often refer to it simply as GNU. You may call it whatever you would like.

What is Debian?

What is GNOME?

Other Topics

This is just a cursory introduction to GNU+Linux, POSIX, Debian, and GNOME. Below are some other questions whose answers are not cruicial for your understanding how to use GNU+Linux in your daily life. However, they are terribly illustrative of the social and technical influence that GNU and Linux have on our world.

You should feel free to look up the answers to these questions or ask me about them if you are curious.

  • What other POSIX systems exist?
  • What other GNU+Linux distributions exist?
  • Where else is GNU+Linux used?
  • How is Linux made and maintained?
  • How are pieces of the GNU Project maintained?
  • Can GNU be used without Linux (and is it)?
  • Can Linux be used without GNU (and is it)?
  • What is Free Software?
  • What is the difference between Free Software and Open Source Software?
  • What is the Free Software Foundation?
  • What is LibrePlanet?
  • What is the Linux Foundation?

Navigating the Filesystem

Filesystem Basics

What’s in the filesystem?

In the filesystem, there are directories and files.

Directories are like “folders” in other operating systems. Directories are used to hold other directories and files, and are used for organization.

Files are chunks of information. This is where your data is stored, like pictures, text documents, spread sheets, and others. There are many different types of files, but the most important distinction from the perspective of a command line user is the distinction between text files and binary files.

A text file is a file that is stored in ASCII or Unicode characters. This means that you can take the file and display it on your screen, and it’ll show up as something that is probably human-readable. Examples of text files are .txt (text), .html (web), and .csv (spreadsheet).

A binary file is a file that is probably not human readable. The data are stored in this file in a specific way so that an application can read it more easily than it might read a text file. Unfortunately, you can’t display binary files on your screen in a way that renders them human-readable. Examples include .doc (Microsoft Word Document), .odt (Open Document Text File), .mp4 (audio), and .jpg (image).

How are places in the filesystem described?

A file or directory’s location is written in what is called it’s “path.” Paths (well … absolute paths. We’ll get to other types of paths later) all start with a slash, and then list all of the directories that contain the item of interest in order, and then the item’s name.

For example, if there is a file called “foo” in the “Documents” directory, and the “Documents” directory is in “swhallee”‘s directory in the “home” directory, the path for foo would look like this:

/home/swhallee/Documents/foo

The Filesystem Hierarchy

The filesystem is a hierarchy. That is to say, directories are arranged in a tree (an upside-down tree, with the root at the top), with some directories being “higher” than others. All directories and files have a path that originates at the root. The following is information about the most important directories in the filesystem. This information is taken directly from the man page of hier. You’ll know what that means later.

I’ve emphasized those entries that are most important. Feel free to skim the rest.

A typical Linux system has, among others, the following directories:

/

This is the root directory. This is where the whole tree
starts.

/bin

This directory contains executable programs which are needed in
single user mode and to bring the system up or repair it.

/boot

Contains static files for the boot loader. This directory only
holds the files which are needed during the boot process. The
map installer and configuration files should go to /sbin and
/etc.

/dev

Special or device files, which refer to physical devices. See
mknod(1).

/etc

Contains configuration files which are local to the machine.
Some larger software packages, like X11, can have their own sub‐
directories below /etc. Site-wide configuration files may be
placed here or in /usr/etc. Nevertheless, programs should
always look for these files in /etc and you may have links for
these files to /usr/etc.

/home

On machines with home directories for users, these are usually
beneath this directory, directly or not. The structure of this
directory depends on local administration decisions.

/lib

This directory should hold those shared libraries that are nec‐
essary to boot the system and to run the commands in the root
file system.

/media

This directory contains mount points for removable media such as
CD and DVD disks or USB sticks.

/mnt

This directory is a mount point for a temporarily mounted file
system. In some distributions, /mnt contains subdirectories
intended to be used as mount points for several temporary file
systems.

/opt

This directory should contain add-on packages that contain
static files.

/root

This directory is usually the home directory for the root user
(optional).

/sbin

Like /bin, this directory holds commands needed to boot the sys‐
tem, but which are usually not executed by normal users.

/tmp

This directory contains temporary files which may be deleted
with no notice, such as by a regular job or at system boot up.

/usr

This directory is usually mounted from a separate partition. It
should hold only sharable, read-only data, so that it can be
mounted by various machines running Linux.

/usr/bin

This is the primary directory for executable programs. Most
programs executed by normal users which are not needed for boot‐
ing or for repairing the system and which are not installed
locally should be placed in this directory.

/var

This directory contains files which may change in size, such as
spool and log files.

Commands for Navigation

pwd
This stands for ”

ls

cd

Manipulating Files

Creating and Deleting

touch

file

rm

Getting Files

wget

tar

Writing, Reading, and More

nano, vi

cat

less, more

mv

cp

diff

Finding Things

Files and Text

find

locate

grep

Programs

man

apropos

Process Management

Finding Processes

ps ax

| (the pipe)

top

Stopping Processes

kill

killall

Using More Sophisticated Programs

Getting Software

apt-cache

apt-get

sudo

Using Software

fortune, cowsay

Useful Examples of the Pipe

markdown

> and >>

python, octave

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s