This is only a basic guide into UNIX, if you wish to learn
more I suggust you get your self a book as I do with all other topics I talk about. Now that you have your shell account. You
will properly want to and learn some Unix commands. You can always use a search
engine to dig you up some more info and the online manuals and faqs. If you got a
shell account at sdf.lonestar.org, I know they have a very good help and faq, which you
should read. You can do that by typing faq or help at your command line. Just
play around in your account, learning the commands and what they do. Read the help
files on each command (man <command>) to learn all the different switches.
Lets start with a few commands you will need to become
familiar with. Unix is CaSe SenSiTiVe. All command must be carried out in
lowercase. If you call a file phile.txt and another one Phile.txt and another
phiLe.txt. They are all different files.
Operation |
Unix Command |
What directory you are in |
pwd |
List Files |
ls |
List Files with detailed Information |
ls -l |
List Hidden Files (hidden files have a . (dot)
in front of them. |
ls -a |
List hidden files with detailed information. |
ls -la |
List files in another directory |
ls /directory/directory |
Copy file |
cp filename newfilename |
Move or rename file |
mv filename newfilename |
Delete a file |
rm filename |
Change directory |
cd dirname |
Goto your "home" directory.
(not applicable on SunOS5 or above) |
cd ~ |
Change shell |
chsh shell |
Change password |
passwd |
Make directory |
mkdir directoryname |
Delete directory |
rmdir directoryname |
Help - very useful |
man command |
Change the permissions on a file - read the
help file on this one for more switches |
chmod |
If you excute a command and the info keeps on
scrolling, you can
stop it to read page by page - push the space bar to read the next
screen |
command|more |
Make a file |
Use editing program such as vi or pico.
pico filename (this is the same for editing the file) |
Quick viewing of a file and edit. |
cat filename |
Find file |
locate name |
Who is on the system |
finger / who / finger username |
This will give you enough to play around and go and
discover other useful commands.
You have now logged into your shell and are at your command
prompt. It will be nice to view the files that you have in your directory. You type
in ls -la . You recieve a load of what looks like garbage.
$ls -la
File Permission, Links, Owner, User, group, Size, Last Edit, Filename
total 152
drwxr-xr-x 8 tresspas users 1024 Jan 7 07:37 .
drwxr-xr-x 7879 visitor root 120832 Jan 7 09:59 ..
-rw------- 1 tresspas users 48 Dec 24 15:27 .created
-rw-r--r-- 1 tresspas users 214 Dec 30 09:21 .display
drwx------ 2 tresspas users 1024 Dec 25 12:20 .elm
-rw-r--r-- 1 tresspas users 21 Jan 6 08:23 .excute
-rw------- 1 tresspas users 20 Jan 7 10:00 .from
-rw------- 1 tresspas users 282 Jan 7 03:10 .hist
-rw------- 1 tresspas users 19 Jan 7 10:00 .lastlogin
-rw-r--r-- 1 tresspas arpa 31 Jan 5 10:20 .newsrc
-rw-r--r-- 1 tresspas users 10326 Jan 7 07:37 .pinerc
-rw------- 1 tresspas users 2407 Dec 24 15:27 .profile
-rw-r--r-- 1 tresspas arpa 25 Jan 5 10:20 .rnlast
-rw-r--r-- 1 tresspas arpa 2 Jan 5 10:20 .rnsoft
-rw-r--r-- 1 tresspas users 14 Jan 5 11:38 .saves-18696-sdf.lonestar
.org~
-rw------- 1 tresspas users 82 Dec 24 15:27 .signature
-rw-r--r-- 1 tresspas users 474 Jan 7 09:59 DEADJOE
drwx------ 2 tresspas users 1024 Dec 30 07:33 Mail
drwxr-xr-x 2 tresspas arpa 1024 Jan 5 10:19 News
drwx------ 2 tresspas users 1024 Jan 6 08:41 backup
drwxr-xr-x 2 tresspas users 1024 Jan 7 07:37 html
drwx------ 2 tresspas users 1024 Jan 6 10:07 mail
File Permission, thats the thing that looks like this,
drwxr-xr-x. Theres alot of information there, it shows who has read, write and
excute permissions. Lets start with the first letter.
All d says is whether it is a directory or not.
The next 3 are the owner of the file, the second 3 is the user group, and the last
3 is everyone. So r = read, w = write and x = excute. Lets look at drwxr-xr-x
again, what does it tell us ?
Well I know its in a directory, the owner has read, write and excute permissions,
people who belong to the user group have read and excute permissions and everyone has read
and excute permission. (If - is in place, it means that it does not apply to that
group.) I'd try and get your head around that one quickly as it is important to
know.
Say now I want to go and edit my homepage. I will
have to go up one directory and select and editor to edit the file with. The editor
I use is called joe, but there are many about
$cd html
$joe index.html
And then the program loads up and the contents of the file
are displayed. Read the help files on the system and each editor to find out more
about them.
For quick and easy access to a files contents and to edit
(if you have the permissions) you can use the cat command.
$cat index.html
<html>
<head>
<title>Blah blah blah
You then use Ctrl + C to stop the process and you are asked
if you want to save. Ctrl + C will halt any process that maybe running at the time,
if allowed. Say you run locate cc and it is scrolling pages and pages of text, you
can press Ctrl + C to halt the command and then run the command again locate cc|more and
read your leisure. Have a play around a see what you can do ! |