Linux/bash Tutorial

 

Originally written by Josh Hursey, updated by Jim Rogers and then Charlie Peck.


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 Microsoft Windows systems, the shell is your primary mechanism for controlling the system.
Note about notation 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.

Currently maintained by Charlie Peck, charliep at cs dot earlham dot edu.