free space

Tuesday, March 10, 2009

basic linux commands


prompt

If you login as root, the prompt will be machinename:~# and if you login as user, the prompt will be machinename:~$.

The tilde character (~) represents the home directory; appended to the end of a filename, it means a backup of a file that has been edited (the file as it existed before it was last edited, and if your configuration is set up to make backups).

shell account

How to Explore Your Shell Account


So you’re in your shell account. You’ve tried the “ls -alF” command and
are pretty sure this really, truly is a shell account. What do you do
next?

A good place to start is to find out what kind of shell you have. There
are many shells, each of which has slightly different ways of working. To
do this, at your prompt give the command “echo $SHELL.” Be sure to type in
the same lower case and upper case letters. If you were to give the
command ECHO $shell, for example, this command won’t work.

If you get the response:

/bin/sh

That means you have the Bourne shell.

If you get:

/bin/bash

Then you are in the Bourne Again (bash) shell.

If you get:

/bin/ksh

You have the Korn shell.

If the “echo $SHELL” command doesn’t work, try the command “echo $shell,”
remembering to use lower case for “shell.” This will likely get you the
answer:

/bin/csh

This means you have the C shell.
Why is it important to know which shell you have? For right now, you’ll
want a shell that is easy to use. For example, when you make a mistake in
typing, it’s nice to hit the backspace key and not see ^H^H^H on your
screen. Later, though, for running those super hacker exploits, the C
shell may be better for you.

Fortunately, you may not be stuck with whatever shell you have when you
log in. If your shell account is any good, you will have a choice of
shells.

Trust me, if you are a beginner, you will find bash to be the easiest
shell to use. You may be able to get the bash shell by simply typing the
word “bash” at the prompt. If this doesn’t work, ask tech support at your
ISP for a shell account set up to use bash.

If you want to find out what other shells you have the right to use, try
“csh” to get the C shell; “ksh” to get the Korn shell, “sh” for Bourne
shell, “tcsh” for the Tcsh shell, and “zsh” for the Zsh shell. If you
don’t have one of them, when you give the command to get into that shell
you will get back the answer “command not found.”

Now that you have chosen your shell, the next thing is to explore. See
what riches your ISP has allowed you to use. For that you will want to
learn, and I mean *really learn* your most important Unix commands and
auxiliary programs. Because I am supreme arbiter of what goes into these
Guides, I get to decide what the most important commands are. Hmm, “ten”
sounds like a famous number. So you’re going to get the:



Ten Meinel Hall of Fame Shell Account Exploration Tools

1) man
This magic command brings up the online Unix manual. Use it on each of
the commands below, today! Wonder what all the man command options are?
Try the"man -k" option.

2) ls
Lists files. I suggest getting people in the habit of using "ls -alF".
This will come into play down the road for security-conscious users.”
You’ll see a huge list of files that you can’t see with the “ls” command
alone, and lots of details. If you see such a long list of files that they
scroll off the terminal screen, one way to solve the problem is to use “ls
-alF|more.”

3) pwd
Shows what directory you are in.

4) cd
Changes directories. Kewl directories to check out include /usr, /bin and
/etc. For laughs, I advise exploring in /tmp. Changes
directories. Kewl directories to check out include /usr, /bin and
/etc. /usr directory belongs to the accounts, /bin belongs to the commands
and executable programs/files, and /tmp of course, the temporary
directory.

5) more
This shows the contents of text files. Also you might be able to find
“less” and “cat” which are similar commands.

6) whereis
Think there might be a nifty program hidden somewhere? Maybe a game you
love? This will find it for you. Similar commands are “find” and “locate.”
Try them all for extra fun.

7) vi
An editing program. You’ll need it to make your own files and when you
start programming while in your shell account. You can use it to write a
lurid file for people to read when they finger you. Or try “emacs.” It’s
another editing program and IMHO more fun than vi. Other editing programs
you may find include “ed” (an ancient editing program which I have used to
write thousands of lines of Fortran 77 code), “ex,” “fmt,” “gmacs,” you
may find include “ed” (an ancient editing program which I have used to
write thousands of lines of Fortran 77 code), “ex,” “fmt,” “gmacs,”
“gnuemacs,” and “pico.”

8) grep
Extracts information from files, especially useful for seeing what’s in
syslog and shell log files. Similar commands are “egrep,” “fgrep,” and
“look.”

9) chmod
Change file permissions.

10) rm
Delete file. If you have this command you should also find “cp” for copy
file, and “mv” for move file.



0 comments:

F

free counters

sponsors

haa

sponsors

sponsors

haaaaa

visit

 

console operating system linux solaris solaris10 solari rachel solari sun microsystems linx | Copyright 2009 Tüm Hakları Saklıdır | Blogger Template by GoogleBoy ve anakafa | Sponsored by Noow!