What is Linux?
Linux is a widely-used command-line operating system.
A command-line operating system doesn't provide
the fancy graphical interface we're used to (menus, buttons, etc.).
Instead, the user has to type in text commands to tell the computer what
to do. The commands tend to be short, to save typing, so they
tend to seem cryptic to new users. Linux remains popular because some
users find it faster and simpler to communicate by means of text than
by mouse clicks. It also gives more advanced users the capability to
create scripts combining sequences of commands.
Many Linux systems provide a graphical interface to access some of the
capabilities of the system, and can run graphical programs such as
web browsers. There still remains a command-line system at the heart.
If you want to try a Linux machine at Queen's, go the the
CASLab web site and
choose "How To...", then "Use Linux".
Linux vs. DOS: If you've used DOS before, you may see some similarities
between DOS and Linux. Linux is based on the Unix operating system, which
is much older than DOS (or Microsoft itself, for that matter). I'll let
you speculate on who might have copied from whom!
Using Linux: I will describe the basics of the Linux command-line
system. On some systems, there's a graphical interface. You may be able
to find menu entries for some or all of the things you want to do. To get
to the command-line, look for a menu entry labelled "terminal" or "console".
Once you're looking at the command line, you should see a "command prompt". The command prompt
is usually a single character such as "%" or "$". Sometimes the command prompt
will include the name of your current folder. The command prompt means that Linux is waiting for you
to type a command. When you type a command, Linux will prompt out the result of
the command, then type another command prompt. It's very
simple. The only hard thing is remembering the commands to type!
Notes About File Names in Linux:
- When you're working in Linux, you are always "connected" to a particular
folder, called your current folder. If you refer to a file without any
folder name preceeding it, Linux will look in your current folder.
- DOS uses the forward slash character ("/") to separate folder and file names.
For example, if you refer to one/two/myfile.java, DOS will look in
your current folder for a sub-folder called one, then look in that
sub-folder for a folder called two, then look in that sub-sub-folder
for a file called myfile.java
- The special file name ".." refers to the parent of the
current folder.
- To give an absolute file name, not starting at your current folder,
start your file name with a slash. For example, the file name
/myfolder/myfile.java refers to a file in the top-level folder
myfolder, regardless of your current folder.
- The "*" character is a wildcard. For example, *.java
matches any file name that ends with the characters .java, and
CISC*Assn1.txt matches any file name that begins with CISC
and ends with Assn1.txt. This is useful for specifying multiple
files with similar names. It also saves you from having to type long
file names in full.
Basic Linux Commands:
- cd: Change to a different folder. (Stands for "change directory".) For example,
cd mydir moves you into a directory called mydir.
- pwd: Prints the name of your current folder. (Stands for
"print working directory".) This is useful when you've been changing folders
a lot and you forget where you are.
- ls: Displays the contents of a folder. (Stands for "list".)
If you type ls followed by
the name of a folder, you'll get a list of all the files in that
folder. If you leave out the folder name, you'll get a list of all the files
in your current folder.
- cat: Types the contents of a file. (Stands for "catalog".)
If you type cat Assn1.java,
Linux will display the contents of Assn1.java.
- less: This is like the cat command, but geared toward
long files that won't fit on the screen all at once. It pauses after every screenful
and waits for you to type a space character before it continues.
- rm: Deletes a file. (Stands for "remove".) For example, rm myfile.java will
delete myfile.java from your current folder. Be careful with this; Linux
has no Recycle Bin!
Warning: Unlike Windows and DOS, Linux is case-sensitive. The commands above must be typed
in lower-case. File names may not be recognised if you get the capitalization wrong.
This page maintained by
Margaret Lamb,
Queen's University, Kingston, Ontario. Last modified