Linux/bash
Tutorial
Josh Hursey
Last updated: EST
Introduction
Linux is an operating system that was initially created as a hobby by a young
student, Linus Torvalds, at the University of Helsinki in Finland. Linus had
an interest in Minix, a small UNIX system, and decided to develop a system
that exceeded the Minix standards. He began his work in 1991 when he released
version 0.02 and worked steadily until 1994 when version 1.0 of the Linux
Kernel was released. The current full-featured version is 2.4 (released
January 2001) and development continues.
Linux is developed under the GNU General Public License and its source code is
freely available to everyone. This however, doesn't mean that Linux and its
assorted distributions are free -- companies and developers may charge money for
it as long as the source code remains available. Linux may be used for a wide
variety of purposes including networking, software development, and as an
end-user platform. Linux is often considered an excellent, low-cost alternative
to other more expensive operating systems.
Due to the very nature of Linux's functionality and availability, it has become
quite popular worldwide and a vast number of software programmers have taken
Linux's source code and adapted it to meet their individual needs. At this
time, there are dozens of ongoing projects for porting Linux to various
hardware configurations and purposes.
Linux has an official mascot, the Linux Penguin, which was selected by Linus
Torvalds to represent the image he associates with the operating system he
created.
Although many variations of the word Linux exist, it is most often pronounced
with a short " i " and with the first syllable stressed, as in LIH-nucks.
Taken from linux.org's What is
Linux webpage: http://www.linux.org/info/index.html
Useful Commands
The standard "shell" program (command interpreter) for most distributions
of linux is bash
(which stands for "Bourne Again Shell", a
geek joke). Unlike MacIntosh or MSWindows systems, the shell is your
primary mechanism for controlling the system.
Note about notation
- All of the following commands should be typed into the Little
Shell
- All commands should be typed after a blank prompt, which looks like:
[grace@acl13 ~]$
- Any thing enclosed in brackets [] or <> should be
replaced with something meaningful to what you are doing. For example:
The instruction: mv [From File] [To File or directory]
Should be typed as: mv a.cpp b.cpp
Where a.cpp is the orignal file and b.cpp is the file you wish to move
the file to.
Also could be typed as: mv a.cpp source/
Where a.cpp is the orignal file and source is the directory into which
you want the file moved to.
- <...> Means that the previous option can be repeated any number
of times.
- Options in [] are required, and options in <> are
optional.
Changing your password
yppasswd
Deleting Files
rm [filename.cpp] <...>
Example: rm buggy.cpp
Copying one File to Another File (Replacing it)
cp [from_filename.cpp] [to_filename.cpp]
Example: cp not_buggy.cpp buggy.cpp
Moving Files to a directory
mv [from_filename.cpp] [directory_name]
Example: mv good.cpp assignment1/
Renaming a file
mv [from_filename.cpp] [to_filename.cpp]
Example: mv good.cpp bad.cpp
Note: The [from_filename.cpp] (or good.cpp in the
example) will be removed.
Creating a Directory
mkdir [directory_name]
Example: mkdir cs127
Removing a Directory
rmdir [directory_name]
Example: rmdir cs127
Changing Directories (moving up into a directory)
cd [directory_name]
Example: cd cs127
Moving back down from a directory
cd ..
Example: cd ..
Coming Home (when lost in directories)
cd
Example: cd
List all files and directories
ls
Example: ls
Cool Linux Tricks
Auto-TAB complete
If you are typing a filename, press the TAB key to have linux try
and complete the name of the file. If you press TAB twice in a row
it will give you a listing of possible options that could complete this
statement.
Auto-copy on Highlight
If you Left Click and drag over a section of text, Linux automatically puts
this in a buffer. If you are fortunate enough to be working with a three
button mouse then by pressing the middle button it will "Paste" that
highlighted section of text to where you middle clicked.
Maintained By: Josh Hursey
(joshh@cs.earlham.edu)