November 14th, 2002, 03:55 AM
**** brick Linux Tutorial
Linux Basics Tutorial v1.0
For you fellow computer enthusiasts that are just getting to know Linux or dont know anything about Linux this tutorial is a fair attempt to inform you, and get you doing some basic things and tricks on your Linux box. Some history of Linux is what we will start off with in this tutorial. Linux is actually the off spring of the popular OS UNIX that is available for PCs and other types such as Macs, mainframes, and other computing devices. The idea for the Linux OS comes from a former college student named Linus Torvalds. Torvalds attended school at the University of Helsinki in Finland. Torvalds was attending Computer Science classes and though that creating a UNIX like OS would be awesome. Torvalds then posted the source code freely on the global network that were all familiar with, and with the assistance of thousands of programmers, hackers, and enthusiasts, we have Linux. The Linux source code and OS is available for free, and anyone wishing even today to modify the source code can do so. Now on to some Linux distributors. Some of the more popular distributors are: Red Hat, S.u.S.E., Caldera, Mandrake, Debian, and Slackware. As I stated earlier, the Linux OS is free, but when you see the box Red Hat Linux 7.0 with a 70 dollar price tag on it, you are getting the OS, but what you are really paying for is the service that each distributor provides.
Next, rather than give you a tutorial on booting, loading, and installing Linux, I shall move to some common commands and tricks. Reason being for this is, the Linux installation process varies from distributors and also I dont want to fill the entire page up with problems and conflicts that may occur in this process (problems in the installation process happen quite often!). Also, I will list some common shells for Linux later on, as of now, we shall only cover pure Linux commands (command line stuff).
Working with Directories
1. pwd - This command tells you which directory that you are currently in.
2. cd dirname - Changes your current directory from the one in which you are currently in.
3. mkdir dirname - This creates a new directory for you.
4. rmdir driname - This will remove or delete any empty directory.
Command History and Using the History Command to Your Advantage
The command history will display a list a current list of commands that have been made previously. This command will allow you to execute commands without having to re-type them. The number of saved commands stored in the history command can be edited to your liking with the command HISTSIZE.
Note: In Emacs mode, you can press Ctrl+P to re-execute the previous command, or you can try the arrow keys to get the same affect. Try these commands to see if you are in Emacs mode. If you are in VI mode you can press Esc and then use the k and j keys to edit command history, and then use enter to execute any one command. Try these commands to see if you are in VI mode.
Creating Shell Aliases
The shell alias command purpose is to allow the user to create, customize, and substitute their own names in for common commands. The shell alias command will also prove to be very useful when wanting to create nice short cuts to commonly used tasks. You can take a command that you once needed to type in many times a and also print many times a day, and create one command that will serve both purposes.
1. name - This will specify the name of the alias. If a name is not present, this command will list all current aliases.
2. command - This will specify the function of the alias.
3. unalias - Deletes a alias. (Example: unalias jpsop, the alias will then be deleted)
Example: In this example were going to create a alias that will print a text file which would normally take two commands, and convert it to one command.
alias jpsop= 'jps -P sop'
This alias will create the command jpsop and its function when executed will tell the printer to print what we want.
Example of our Alias:
jpsop "Linux kicks Ass!"
That alias command we created (jpsop) will tell the printer to print "Linux kicks Ass!"
Changing Shell Modes
Each shell you will find to be unique in its own way. There are many other shells, but these two seem to be the most common and will serve your purposes very well.
1. set -o vi - This command will change the shell mode to VI
2. set -o emacs - This command will change the shell mode to Emacs
Editing The VI and Emacs Shell Modes
Editing the VI and Emacs shell modes will become a second nature, they prove very useful in customizing your Linux box.
Note: Be sure to hit Esc to active the ability to use these commands in VI mode.
a. K - Moves one command back in history list.
b. J - Moves one command forward in the history list.
c. H - Moves back one character back in the command line.
d. L - Moves one character forward on the command line.
e. b - Moves one word backward.
f. * - Moves one word forward.
g. 0 - Moves to the beginning of the command line.
h. $ - Moves to the end of the command line.
i. i - Enters insert mode.
j. Esc- Exits the insert mode.
k. a - Appends to a line.
l. X - Deletes one character backward.
m. x - Deletes one character forward.
n. dw - Deletes one word forward.
o. D - Deletes forward unitl the end of the line.
p. Esc+_ - Inserts last word of preceding command.
a. Ctrl+P - Moves one command back in history list.
b. Ctrl+N - Moves one command forward in the history list.
c. Ctrl+F - Moves back on character back in the command line.
d. Ctrl+B - Moves one charecter coward on the command line.
e. Esc+B - Moves one word backward.
f. Esc+F - Moves one word forward.
g. Ctrl+A - Moves to the of the command line.
h. Ctrl+E - Moves to the end of the command line.
i. Esc+ Del - Deletes back one character.
j. Ctrl+D - Deletes forward one character.
k. Esc+D - Deletes forward one word.
l. Esc+K - Deletes forward to the end of line.
m. Esc+. - Inserts last word of preceding command.
To quote characters in Linux, there are 3 ways:
1. Using the double quotation marks. ""
2. Using the single quotation marks. ''
3. To quote a single character, you can precede it with a backlash. \r
Quick Environment Variables
Use environment variables to customize and set a working Linux Environment.
1. HOME - Path to your home directory.
2. DISPLAY - Display the location for your X-Window System (more on X-Windows later).
3. HOSTNAME - This will display the name of the computer system.
4. MAIL - This will display the path to your email file.
5. PATH - This will display a search path.
6. SHELL - Will display the path to the default shell in your Linux box.
7. TERM - Displays your terminal type.
8. EDITOR - Default editor on your box used by various programs.
In Linux when you start a program, there are three main files that are associated with it, they are:
1. stdout - standard output
2. stdin - standard input
3. stderr - standard error
1. bash (born again shell) - The shell for Linux that was developed by the Free Software Foundation.
Startup Files Associated With BASH
You will find that most startup files are in the home directory of your box and start with a period or dot (.).
1. .bash_profile - This load at the login time.
2. .bashrc - Loads each time a new shell is started.
BASH Setup Files
1. /etc/profile - Loads at login time
2. $HOME/.proflie - Loads at login time
3. $HOME/.bashrc - Loads at the shell startup
4. $HOME/.bash_logout - Executed at logout.
There will be a follow up to this **** brick tutorial.
The End Justifies The Means...