Saturday, February 28, 2009

List of Different web servers on GNU Linux

List of Different web servers on GNU Linux

Today we have different web servers available on the GNU/Linux platform.Here i am listing only the web servers that can be used for a mainstream web hosting environment

The web servers can be classified basically into 2

1. Process based webserver - In a process based web server each new connection is handled by a new web server process or thread. Following are some of the process based servers available on the GNU /Linux platform.A notable draw back for a process based web server is the famous C10K problem ( ).That said there are many implementations of this model that are high performance in nature

* Apache HTTPD - - the most famous web server and the most widely used - supports a very large number of modules and very feature rich
* Cherokee - - is a fast flexible easy to configure web server - A notable feature is the administrative interface available that lessens the burden of tampering with the configuration files
* LiteSpeed - - Apache compatible web server ,but claimed to be of having improved perfomance

2- Asynchronus web server or non-blocking i/o webserver - Or in laymans words a web server that uses a single process to handle multiple request ,switching over to the next request when the previous one is waiting for an i/o request is to be fullfilled. This architecture is more scalable and theoretically solves the C10K problem.The famous members of this family of servers are

* Nginx - - pronounced EngineX - is a powerfull light weight web server and has a cleaner configuration -It is also feature rich and widely used
* Lighttpd - - This is another powerfull and light weight web server and has a very large number of modules and features

All the above mentioned web servers are widely used in the web hosting industry ,in dedicated ,vps and shared hosting environments

Friday, February 27, 2009

SED Tutorial

SED Tutorial

* The sed utility is an "editor"
* It is also noninteractive. This means you have to insert commands to be executed on the data at the command line or in a script to be processed.
* sed accepts a series of commands and executes them on a file (or set of files).
* sed fittingly stands for stream editor.
* It can be used to change all occurrences of "SAD" to "SED" or "New York" to "Newport."
* The stream editor is ideally suited to performing repetitive edits that would take considerable time if done manually.

How sed Works

The sed utility works by sequentially reading a file, line by line, into memory. It then performs all actions specified for the line and places the line back in memory to dump to the terminal with the requested changes made. After all actions have taken place to this one line, it reads the next line of the file and repeats the process until it is finished with the file. As mentioned, the default output is to display the contents of each line on the screen. Two important factors come into play here—first, the output can be redirected to another file to save the changes; second, the original file, by default, is left unchanged. The default is for sed to read the entire file and make changes to each line within it. It can, however, be restricted to specified lines as needed.

The syntax for the utility is:

sed [options] '{command}' [filename]

In this tutorial we will walk through the most commonly used commands and options and illustrate how they work and where they would be appropriate for use.

The Substitute Command

One of the most common uses of the sed utility, and any similar editor, is to substitute one value for another. To accomplish this, the syntax for the command portion of the operation is:

's/{old value}/{new value}/'

Thus, the following illustrates how "lion" can be changed to "eagle" very simply:

$ echo The lion group will meet on Tuesday after school | sed
The eagle group will meet on Tuesday after school

Notice that it is not necessary to specify a filename if input is being derived from the output of a preceding command—the same as is true for awk, sort, and most other LinuxUNIX command-line utility programs.

Multiple Changes

If multiple changes need to be made to the same file or line, there are three methods by which this can be accomplished. The first is to use the "-e" option, which informs the program that more than one editing command is being used. For example:

$ echo The lion group will meet on Tuesday after school | sed -e '
s/lion/eagle/' -e 's/after/before/'
The eagle group will meet on Tuesday before school

This is pretty much the long way of going about it, and the "-e" option is not commonly used to any great extent. A more preferable way is to separate command with semicolons:

$ echo The lion group will meet on Tuesday after school | sed '
s/lion/eagle/; s/after/before/'
The eagle group will meet on Tuesday before school

Notice that the semicolon must be the next character following the slash. If a space is between the two, the operation will not successfully complete and an error message will be returned. These two methods are well and good, but there is one more method that many administrators prefer. The key thing to note is that everything between the two apostrophes (' ') is interpreted as sed commands. The shell program reading in the commands will not assume you are finished entering until the second apostrophe is entered. This means that the command can be entered on multiple lines—with Linux changing the prompt from PS1 to a continuation prompt (usually ">")—until the second apostrophe is entered. As soon as it is entered, and Enter pressed, the processing will take place and the same results will be generated, as the following illustrates:

$ echo The lion group will meet on Tuesday after school | sed '
> s/lion/eagle/
> s/after/before/'
The eagle group will meet on Tuesday before school

Global Changes

Let's begin with a deceptively simple edit. Suppose the message that is to be changed contains more than one occurrence of the item to be changed. By default, the result can be different than what was expected, as the following illustrates:

$ echo The lion group will meet this Tuesday at the same time
as the meeting last Tuesday | sed 's/Tuesday/Thursday/'
The lion group will meet this Thursday at the same time
as the meeting last Tuesday

Instead of changing every occurrence of "Tuesday" for "Thursday," the sed editor moves on after finding a change and making it, without reading the whole line. The majority of sed commands function like the substitute one, meaning they all work for the first occurrence of the chosen sequence in each line. In order for every occurrence to be substituted, in the event that more than one occurrence appears in the same line, you must specify for the action to take place globally:

$ echo The lion group will meet this Tuesday at the same time
as the meeting last Tuesday | sed 's/Tuesday/Thursday/g'
The lion group will meet this Thursday at the same time
as the meeting last Thursday

Bear in mind that this need for globalization is true whether the sequence you are looking for consists of only one character or a phrase.

sed can also be used to change record field delimiters from one to another. For example, the following will change all tabs to spaces:

sed 's/ / /g'

where the entry between the first set of slashes is a tab, while the entry between the second set is a space. As a general rule, sed can be used to change any printable character to any other printable character. If you want to change unprintable characters to printable ones—for example, a bell to the word "bell"—sed is not the right tool for the job (but tr would be).

Sometimes, you don't want to change every occurrence that appears in a file. At times, you only want to make a change if certain conditions are met—for example, following a match of some other data. To illustrate, consider the following text file:

$ cat sample_one
one 1
two 1
three 1
one 1
two 1
two 1
three 1

Suppose that it would be desirable for "1" to be substituted with "2," but only after the word "two" and not throughout every line. This can be accomplished by specifying that a match is to be found before giving the substitute command:

$ sed '/two/ s/1/2/' sample_one
one 1
two 2
three 1
one 1
two 2
two 2
three 1

And now, to make it even more accurate:

$ sed '
> /two/ s/1/2/
> /three/ s/1/3/' sample_one
one 1
two 2
three 3
one 1
two 2
two 2
three 3

Bear in mind once again that the only thing changed is the display. If you look at the original file, it is the same as it always was. You must save the output to another file to create permanence. It is worth repeating that the fact that changes are not made to the original file is a true blessing in disguise—it lets you experiment with the file without causing any real harm, until you get the right commands working exactly the way you expect and want them to.

The following saves the changed output to a new file:

$ sed '
> /two/ s/1/2/
> /three/ s/1/3/' sample_one > sample_two

The output file has all the changes incorporated in it that would normally appear on the screen. It can now be viewed with head, cat, or any other similar utility.

Script Files

The sed tool allows you to create a script file containing commands that are processed from the file, rather than at the command line, and is referenced via the "-f" option. By creating a script file, you have the ability to run the same operations over and over again, and to specify far more detailed operations than what you would want to try to tackle from the command line each time.

Consider the following script file:

$ cat sedlist
/two/ s/1/2/
/three/ s/1/3/

It can now be used on the data file to obtain the same results we saw earlier:

$ sed -f sedlist sample_one
one 1
two 2
three 3
one 1
two 2
two 2
three 3

Notice that apostrophes are not used inside the source file, or from the command line when the "-f" option is invoked. Script files, also known as source files, are invaluable for operations that you intend to repeat more than once and for complicated commands where there is a possibility that you may make an error at the command line. It is far easier to edit the source file and change one character than to retype a multiple-line entry at the command line.

Restricting Lines

The default is for the editor to look at, and for editing to take place on, every line that is input to the stream editor. This can be changed by specifying restrictions preceding the command. For example, to substitute "1" with "2" only in the fifth and sixth lines of the sample file's output, the command would be:

$ sed '5,6 s/1/2/' sample_one
one 1
two 1
three 1
one 1
two 2
two 2
three 1

In this case, since the lines to changes were specifically specified, the substitute command was not needed. Thus you have the flexibility of choosing which lines to changes (essentially, restricting the changes) based upon matching criteria that can be either line numbers or a matched pattern.

Prohibiting the Display

The default is for sed to display on the screen (or to a file, if so redirected) every line from the original file, whether it is affected by an edit operation or not; the "-n" parameter overrides this action. "-n" overrides all printing and displays no lines whatsoever, whether they were changed by the edit or not. For example:

$ sed -n -f sedlist sample_one

$ sed -n -f sedlist sample_one > sample_two
$ cat sample_two

In the first example, nothing is displayed on the screen. In the second example, nothing is changed, and thus nothing is written to the new file—it ends up being empty. Doesn't this negate the whole purpose of the edit? Why is this useful? It is useful only because the "-n" option has the ability to be overridden by a print command (-p). To illustrate, suppose the script file were modified to now resemble the following:

$ cat sedlist
/two/ s/1/2/p
/three/ s/1/3/p

Then this would be the result of running it:

$ sed -n -f sedlist sample_one
two 2
three 3
two 2
two 2
three 3

Lines that stay the same as they were are not displayed at all. Only the lines affected by the edit are displayed. In this manner, it is possible to pull those lines only, make the changes, and place them in a separate file:

$ sed -n -f sedlist sample_one > sample_two

$ cat sample_two
two 2
three 3
two 2
two 2
three 3

Another method of utilizing this is to print only a set number of lines. For example, to print only lines two through six while making no other editing changes:

$ sed -n '2,6p' sample_one
two 1
three 1
one 1
two 1
two 1

All other lines are ignored, and only lines two through six are printed as output. This is something remarkable that you cannot do easily with any other utility. head will print the top of a file, and tail will print the bottom, but sed allows you to pull anything you want to from anywhere.

Deleting Lines

Substituting one value for another is far from the only function that can be performed with a stream editor. There are many more possibilities, and the second-most-used function in my opinion is delete. Delete works in the same manner as substitute, only it removes the specified lines (if you want to remove a word and not a line, don't think of deleting, but think of substituting it for nothing—s/cat//).

The syntax for the command is:

'{what to find} d'

To remove all of the lines containing "two" from the sample_one file:

$ sed '/two/ d' sample_one
one 1
three 1
one 1
three 1

To remove the first three lines from the display, regardless of what they are:

$ sed '1,3 d' sample_one
one 1
two 1
two 1
three 1

Only the remaining lines are shown, and the first three cease to exist in the display. There are several things to keep in mind with the stream editor as they relate to global expressions in general, and as they apply to deletions in particular:

# The up carat (^) signifies the beginning of a line, thus

sed '/^two/ d' sample_one

would only delete the line if "two" were the first three characters of the line.
# The dollar sign ($) represents the end of the file, or the end of a line, thus

sed '/two$/ d' sample_one

would delete the line only if "two" were the last three characters of the line.

The result of putting these two together:

sed '/^$/ d' {filename}

deletes all blank lines from a file. For example, the following substitutes "1" for "2" as well as "1" for "3" and removes any trailing lines in the file:

$ sed '/two/ s/1/2/; /three/ s/1/3/; /^$/ d' sample_one
one 1
two 1
three 1
one 1
two 2
two 2
three 1

A common use for this is to delete a header. The following command will delete all lines in a file, from the first line through to the first blank line:

sed '1,/^$/ d' {filename}

Appending and Inserting Text

Text can be appended to the end of a file by using sed with the "a" option. This is done in the following manner:

$ sed '$a
> This is where we stop
> the test' sample_one
one 1
two 1
three 1
one 1
two 1
two 1
three 1
This is where we stop
the test

Within the command, the dollar sign ($) signifies that the text is to be appended to the end of the file. The backslashes () are necessary to signify that a carriage return is coming. If they are left out, an error will result proclaiming that the command is garbled; anywhere that a carriage return is to be entered, you must use the backslash.

To append the lines into the fourth and fifth positions instead of at the end, the command becomes:

$ sed '3a
> This is where we stop
> the test' sample_one
one 1
two 1
three 1
This is where we stop
the test
one 1
two 1
two 1
three 1

This appends the text after the third line. As with almost any editor, you can choose to insert rather than append if you so desire. The difference between the two is that append follows the line specified, and insert starts with the line specified. When using insert instead of append, just replace the "a" with an "i," as shown below:

$ sed '3i
> This is where we stop
> the test' sample_one
one 1
two 1
This is where we stop
the test
three 1
one 1
two 1
two 1
three 1

The new text appears in the middle of the output, and processing resumes normally after the specified operation is carried out.

Reading and Writing Files

The ability to redirect the output has already been illustrated, but it needs to be pointed out that files can be read in and written out to simultaneously during operation of the editing commands. For example, to perform the substitution and write the lines between one and three to a file called sample_three:

$ sed '
> /two/ s/1/2/
> /three/ s/1/3/
> 1,3 w sample_three' sample_one
one 1
two 2
three 3
one 1
two 2
two 2
three 3

$ cat sample_three
one 1
two 2
three 3

Only the lines specified are written to the new file, thanks to the "1,3" specification given to the w (write) command. Regardless of those written, all lines are displayed in the default output.

The Change Command

In addition to substituting entries, it is possible to change the lines from one value to another. The thing to keep in mind is that substitute works on a character-for-character basis, whereas change functions like delete in that it affects the entire line:

$ sed '/two/ c
> We are no longer using two' sample_one
one 1
We are no longer using two
three 1
one 1
We are no longer using two
We are no longer using two
three 1

Working much like substitute, the change command is greater in scale—completely replacing the one entry for another, regardless of character content, or context. At the risk of overstating the obvious, when substitute was used, then only the character "1" was replaced with "2," while when using change, the entire original line was modified. In both situations, the match to look for was simply the "two."

Change All but...

With most sed commands, the functions are spelled out as to what changes are to take place. Using the exclamation mark, it is possible to have the changes take place everywhere but those specified—completely reversing the default operation.

For example, to delete all lines that contain the phrase "two," the operation is:

$ sed '/two/ d' sample_one
one 1
three 1
one 1
three 1

And to delete all lines except those that contain the phrase "two," the syntax becomes:

$ sed '/two/ !d' sample_one
two 1
two 1
two 1

If you have a file that contains a list of items and want to perform an operation on each of the items in the file, then it is important that you first do an intelligent scan of those entries and think about what you are doing. To make matters easier, you can do so by combining sed with any iteration routine (for, while, until).

As an example, assume you have a text file named "animals" with the following entries:


And you want to run the following routine:

for I in $*
echo Old McDonald had a $I
echo E-I, E-I-O

The result will be that each line is printed at the end of "Old McDonald has a." While this is correct for the majority of the entries, it is grammatically incorrect for the "elephant" entry, as the result should be "an elephant" rather than "a elephant." Using sed, you can scan the output from your shell file for such grammatical errors and correct them on the fly, by first creating a file of commands:

/ a a/ s/ a / an /
/ a e/ s/ a / an /
/a i/ s / a / an /
/a o/ s/ a / an /
/a u/ s/ a / an /

and then executing the process as follows:

$ sh mcd.ksh 'cat animals' | sed -f sublist

Now, after the mcd script has been run, sed will scan the output for anywhere that the single letter a (space, "a," space) is followed by a vowel. If such exists, it will change the sequence to space, "an," space. This corrects the problem before it ever prints on the screen and ensures that editors everywhere sleep easier at night. The result is:

Old McDonald had a pig
E-I, E-I-O
Old McDonald had a horse
E-I, E-I-O
Old McDonald had an elephant
E-I, E-I-O
Old McDonald had a cow
E-I, E-I-O
Old McDonald had a dog
E-I, E-I-O
Old McDonald had a cat
E-I, E-I-O

Quitting Early

The default is for sed to read through an entire file and stop only when the end is reached. You can stop processing early, however, by using the quit command. Only one quit command can be specified, and processing will continue until the condition calling the quit command is satisfied.

For example, to perform substitution only on the first five lines of a file and then quit:

$ sed '
> /two/ s/1/2/
> /three/ s/1/3/
> 5q' sample_one
one 1
two 2
three 3
one 1
two 2

The entry preceding the quit command can be a line number, as shown, or a find/matching command like the following:

$ sed '
> /two/ s/1/2/
> /three/ s/1/3/
> /three/q' sample_one
one 1
two 2
three 3

You can also use the quit command to view lines beyond a standard number and add functionality that exceeds those in head. For example, the head command allows you to specify how many of the first lines of a file you want to see—the default number is ten, but any number can be used from one to ninety-nine. If you want to see the first 110 lines of a file, you cannot do so with head, but you can with sed:

sed 110q filename

Handling Problems

The main thing to keep in mind when dealing with sed is how it works. It works by reading one line in, performing all the tasks it knows to perform on that one line, and then moving on to the next line. Each line is subjected to every editing command given.

This can be troublesome if the order of your operations is not thoroughly thought out. For example, suppose you need to change all "two" entries to "three" and all "three" to "four":

$ sed '
> /two/ s/two/three/
> /three/ s/three/four/' sample_one
one 1
four 1
four 1
one 1
four 1
four 1
four 1

The very first "two" read was changed to "three." It then meets the criteria established for the next edit and becomes "four." The end result is not what was wanted—there are now no entries but "four" where there should be "three" and "four."

When performing such an operation, you must pay diligent attention to the manner in which the operations are specified and arrange them in an order in which one will not clobber another. For example:

$ sed '
> /three/ s/three/four/
> /two/ s/two/three/' sample_one
one 1
three 1
four 1
one 1
three 1
three 1
four 1

This works perfectly, since the "three" value is changed prior to "two" becoming "three."

Labels and Comments

Labels can be placed inside sed script files to make it easier to explain what is transpiring, once the files begin to grow in size. There are a variety of commands that relate to these labels, and they include:

# : The colon signifies a label name. For example:


Labels beginning with the colon can be addressed by "b" and "t" commands.

# b {label} Works as a "goto" statement, sending processing to the label preceded by a colon. For example,


sends processing to the line


If no label is specified following the b, processing goes to the end of the script file.

# t {label} Branches to the label only if substitutions have been made since the last input line or execution of a "t" command. As with "b," if a label name is not given, processing moves to the end of the script file.

# # The pound sign as the first character of a line causes the entire line to be treated as a comment. Comment lines are different from labels and cannot be branched to with b or t commands.

Network File System(NFS)

Network File System
Among the many different file systems that Linux supports is the Network File System, also known as NFS. NFS allows a system to share directories and files with others over a network. By using NFS, users and programs can access files on remote systems almost as if they were local files.

* There is no need for users to have separate home directories on every network machine. Home directories could be set up on the NFS server and made available throughout the network.

The server has to be running the following daemons:

* nfsd The NFS daemon which services requests from the NFS clients.
* mountd The NFS mount daemon which carries out the requests that nfsd passes on to it.
* rpcbind This daemon allows NFS clients to discover which port the NFS server is using.

# NAS uses TCP/IP Networks: Ethernet, FDDI, ATM
vi Editor, Learn vi
About vi editor

* vi is Found on Nearly Every Unix Computer
* vi is the standard Unix editor
* vi is Powerful and Fast
* Your terminal displays a section of the file you are editing
* vi can do anything you want
* You don't need to remove your fingers from the standard typing keys-the keys themselves give commands to vi
* vi Stays Out of Your Way
* vi has no menus
* vi commands are short

Starting vi
Open a file with vi.
Type: vi myfile.txt
If myfile.txt does not exist, a screen will appear with just a cursor at the top followed by tildes (~) in the first column.

If myfile.txt does exist, the first few line of the file will appear.

The status line at the bottom of your screen shows error messages and provides information and feedback, including the name of the file.

vi Modes

Command Mode

# Command mode is the mode you are in when you start (default mode)
# Command mode is the mode in which commands are given to move around in the file, to make changes, and to leave the file
# Commands are case sensitive: j not the same as J
# Most commands do not appear on the screen as you type them. Some commands will appear on the last line: : / ?

Insert (or Text) Mode

# The mode in which text is created. (You must press at the end of each line unless you've set wrap margin.)
# There is more than one way to get into insert mode but only one way to leave: return to command mode by pressing
# When in doubt about which mode you are in, press

Basic Cursor Movement
k Up one line
j Down one line
h Left one character
l Right one character (or use )
w Right one word
b Left one word

NOTE: Many vi commands can take a leading count (e. g., 6k, 7e).

Entering, Deleting, and Changing Text
i Enter text entry mode
x Delete a character
dd Delete a line
r Replace a character
R Overwrite text, press to end

Setting Basic Options in vi
Displaying Line Numbers
:set nu Display line numbers
:set nonu Hide line numbers

Setting Right Margin
:set wm=number Set Wrap Margin number of spaces from right edge of screen
:set wm=10 Set Wrap Margin 10 spaces from right edge of screen
:set wm=0 Turn off Wrap Margin

Exiting vi
To exit you must be in command mode-press if you are not in command mode

You must press after commands that begin with a : (colon)
ZZ Write (if there were changes), then quit
:wq Write, then quit
:q Quit (will only work if file has not been changed)
:q! Quit without saving changes to file

# Basics Summary
A Basic vi Session
To enter vi, type: vi filename
To enter insert mode, type: i
Type in the text: This is easy.
To leave insert mode and return to command mode, press:
In command mode, save changes and exit vi by typing: :wq
You are back at the Unix prompt.

More On Cursor Movement
e Move to end of current word
$ Move to end of current line
^ Move to beginning of current line
+ Move to beginning of next line
- Move to beginning of previous line
G Go to last line of the file
:n Go to line with this number (:10 goes to line 10)
d Scroll down one-half screen
u Scroll up one-half screen
f Scroll forward one full screen
b Scroll backward one full screen
) Move to the next sentence
( Move to the previous sentence
} Move to the next paragraph
{ Move to the previous paragraph
H Move to the top line of the screen
M Move to the middle line of the screen
L Move to the last line of the screen
% Move to matching bracket: ( { [ ] } )

Entering Text Mode
i Insert text before current character
a Append text after current character
I Begin text insertion at the beginning of a line
A Append text at end of a line
o Open a new line below current line
O Open a new line above current line

Commands and Objects
Format Example
operator number object c2w
number operator object 2cw

c change
d delete
y yank

Objects and Locations
w one word forward
b one word backward
e end of word
H, M, L top, middle, or bottom line on screen
), ( next sentence, previous sentence
}, { next paragraph, previous paragraph
^, $ beginning of line, end of line
/pattern/ forward to pattern

Replacing and Changing Text
r Replace only the character under the cursor. (Note: using r you remain in command mode.)
R Beginning with the character under the cursor, replace as many characters on this line as you want. (You are in overtype mode until you press
cw Beginning with the character under the cursor, change a word to whatever you type. (You are in insert mode until you press )
c$ Beginning with the character under the cursor,
C change a line to whatever you type. (You are in insert mode until you press )

Deleting Text
x Delete a character
dw Delete an alphabetic word and the following space (6dw deletes six words)
dW Delete a blank-delimited word and the following space
dd Delete a line (6dd deletes six lines)
d$ Delete all characters to the end of the line.
d} Delete all characters to the end of the paragraph.
:5,30d Delete lines 5 through 30

Deleted text goes into a temporary buffer that is replaced each time you delete (or copy) more text. The current contents of the buffer can be put back into your file.

Copying and Pasting Text
yy Copy (yank) the current line
6yy Copy (yank) six lines, beginning with the current line
yw Copy the current word
p Put the text after the cursor position
P Put the text before the cursor position
Copied text goes into a temporary buffer that is replaced each time you copy (or delete) more text. Only the current contents of the temporary buffer can be put back into your file. As a result, when you use copy (y), use the put (p) command immediately.

A yank and put procedure using colon commands:
:5,10y Copy lines 5-10

Move cursor
:put Put after cursor

Other Useful Commands
. Repeat last command
n. Repeat last command n number of times
J Join next line to current line
u Undo last single change
U Restore current line
~ Change letter's case (capital to lower and vice versa)

Temporary Buffer
Deleted or copied text goes into a temporary unnamed buffer. The contents of the temporary buffer may be retrieved by using the p or P commands.
p Put words from temporary buffer after cursor or put lines from temporary buffer below current line
P Put words from temporary buffer before cursor or put lines from temporary buffer above current line

Lettered Buffers
There are 26 lettered buffers (a-z). Contents of a lettered buffer are saved until you copy or delete more characters into it, or until you quit your current vi session.
"ayy Copy (yank) a line into buffer a
"Ayy Appends to buffer a
"a10yy Copies 10 lines into buffer a
"a10dd Deletes 10 lines of text into buffer a
"ap Put contents of lettered buffer a below the current line

Both temporary and lettered buffers last only for the current vi session.

Copying, Deleting, or Moving Text Using Line Numbers
These commands start with a colon (:) and end with a or g shows the line number of the current line
The basic form of colon commands is

:beginning_line, ending_line command destination

where destination is the line after which you want the text placed.
:5,10 co 105 Copy lines 5-10 to the line after 105
:5,20 m $ Move lines 5-20 to end of file
:7,300 d Delete lines 7-300 (to buffer)

Searching for Text
/text Search forward (down) for text (text can include spaces and characters with special meanings.)
?text Search backward (up) for text
n Repeat last search in the same direction
N Repeat last search in the opposite direction
fchar Search forward for a charcter on current line
Fchar Search backward for a character on current line
; Repeat last character search in the same direction
% Find matching ( ), { }, or [ ]

The simplest way to do substitutions over a range of lines, or throughout the file, is to use the s colon command. The basic form of this command is the following:

n1 is the beginning line
n2 is the ending line number
s means to substitute text matching the pattern (old) with text specified by (new)
g (global) is optional. It indicates you want to substitute all occurrences on the indicated lines. If you use g, the editor substitutes only the first occurrence on the indicated lines.
c (confirm) is optional. It indicates you want to confirm each substitution before vi completes it.

:%s/old/new/g Substitutes old with new throughout the file
:.,$s/old/new/g Substitutes old with new from the current cursor position to the end of the file
:^,.s/old/new/g Substitutes old with new from the beginning of the file to the current cursor position
:& Repeats the last substitute (:s) command


Writing to and Reading from Files
:w file Write current file to file
:w>>file Append current file to file
:5,10w file Write lines 5 through 10 to file
:5,10w>>file Append Lines 5 through 10 to file
:r file Read a copy of file into current file
:!ls See a list of files in your current directory

More About Options From Command Mode-within vi for the current file only
:set all Display all options
:set Display current settings of options
:set nooption Unset option
:set ai Set Auto Indentation during text entry
:set ic Set Ignore Case during searches
:set nu Show line Numbers
:set sm Show Matching ( or { when ) or } is entered
:set wm=10 Set Wrap Margin 10 spaces from right edge of screen

Customizing vi Sessions Options can be set four ways:
# During a vi session

* :set nu

# In a .exrc file in your home directory. Sample contents of a .exrc file

* set nu
* set ai
* set wm=10

# In a .exrc file in a subdirectory.
# By setting the EXINIT environmental variable. Example of setting the EXINIT environmental variable

* setenv EXINIT "set nu ai ic"

Order of Precedence
# If a .exrc file exists in the current directory, vi reads it when beginning a session.
# If no .exrc file exists in the current directory, vi checks the home directory for a .exrc file. If such a file exists, vi reads it when beginning a session.
# If no .exrc file is found, vi uses its defaults.
# Values set in the EXINIT environmental variable override any values set in a .exrc file.

Creating a .exrc File

At the system prompt, type: vi .exrc
Type the following commands, each on a separate line:
# set ai
# set ic
# set nu
# set wm=8 Do not leave blank lines at the beginning or end of the .exrc file.
When you are finished, type: ZZ

Abbreviations & Mapping
Abbreviations are text strings that automatically expand into larger strings during insert mode.
:ab UW University of Washington

Mapping defines a single key to execute a sequence of keystrokes when the single key is pressed in command mode. In the following example,the @ key is mapped to replace the current word with "University of Washington". The v allows you to enter the key into the command sequence.
:map @ cwUniversity of Washington v

Mapping can also be used to call commands external to vi, such as sort or fmt. In the following example, the @ sign is mapped to the sort command, so that the current paragraph (indicated by the }) will be sorted. The v allows you to enter the key into the command sequence. The second completes the map command.
:map @ !}sort v

Note: You can also put abbreviation and mapping commands in your .exrc file.


Find the line that reads
Change it to read
Write and quit the file. (ZZ or :wq) vi-ing More Than One File
You can edit more than one file at a time with vi.
From The Unix Shell Prompt
vi file1 file2 vi two (or more) files at the same time From Command Mode
:n Move to file2 from file1
:rew Rewind back to file1
:e! Restore original file1 file2 (start all over)
ZZ Save and quit file. (Must be done for each file.)

Moving the Left Margin
When you print a file you may want the left margin moved to the right. This leaves room for a three-hole punch.
:1,$> Move entire file 1 shift width (eight spaces) to the right
:1,$< Move entire file eight spaces to the left
:%s/^/ /g Insert any number of spaces at the beginning of each line in the entire file. Simply press the space bar the desired number of times.
:20>> Moves next 20 lines over 1 shift width.

Issuing Shell Commands From vi
You can issue a single shell command while in the vi editor. For example, to list the files in your directory (ls), follow these steps:

Press d to return to vi editing.

Double Spacing a File
Occasionally, you may want a double spaced version of your file for editing or review.
:w Write changes to your file (just in case).
:!ls List contents of your current directory on the screen. Press to return to vi. You can issue many shell commands by temporarily leaving the vi editor. From Command Mode
:w Write changes to your file.
:sh Return to the shell to enter a number of commands without leaving vi.
:w original.backup Save a backup copy of the original file
:%! sed G Double space the entire file.
:1,5! sed G Double space the lines from 1-5.

Some Important GNU/Linux commands

alias Create an alias
awk Find and Replace text, database sort/validate/indexbreak
cal Display a calendar
case Conditionally perform a command
cat Display the contents of a file
cd Change Directory
cfdisk Partition table manipulator for Linuxchgrp
chroot Run a command with a different root directory
cksum Print CRC checksum and byte counts
clear Clear terminal screen
cmp Compare two files
comm Compare two sorted files line by line
command Run a command - ignoring shell functions
continue Resume the next iteration of a loop
cp Copy one or more files to another
crontab Schedule a command to run at a later timec
split Split a file into context-determined pieces
cut Divide a file into several parts
date Display or change the date & time
dc Desk Calculator
dd Data Dump - Convert and copy a file
declare Declare variables and give them attributes
df Display free disk space
diff Display the differences between two files
diff3 Show differences among three files
dir Briefly list directory contents
dircolors Colour setup for `ls'
dirname Convert a full pathname to just a path
dirs Display list of remembered directories
du Estimate file space usage
echo Display message on screen
ed A line-oriented text editor (edlin)
egrep Search file(s) for lines that match an extended expression
eject Eject CD-ROM
enable Enable and disable builtin shell commands
env Display, set, or remove environment variables
eval Evaluate several commands/arguments
exec Execute a command
exit Exit the shell
expand Convert tabs to spaces
export Set an environment variable
expr Evaluate expressions
factor Print prime factors
false Do nothing, unsuccessfully
fdformat Low-level format a floppy disk
fdisk Partition table manipulator for Linux
fgrep Search file(s) for lines that match a fixed string
find Search for files that meet a desired criteria
fmt Reformat paragraph text
fold Wrap text to fit a specified width.
for Expand words, and execute commands
format Format disks or tapes
free Display memory usage
fsck Filesystem consistency check and repair.
function Define Function Macros
gawk Find and Replace text within file(s)
getopts Parse positional parameters
grep Search file(s) for lines that match a given pattern
groups Print group names a user is in
gzip Compress or decompress named file(s)
hash Remember the full pathname of a name argument
head Output the first part of file(s)
history Command History
hostname Print or set system name
id Print user and group id's
if Conditionally perform a command
import Capture an X server screen and save the image to file
info Help info
install Copy files and set attributes
join Join lines on a common field
kill Stop a process from running
less Display output one screen at a time
let Perform arithmetic on shell variables
ln Make links between files
local Create variables
locate Find files
logname Print current login name
logout Exit a login shell
lpc Line printer control program
lpr Off line print
lprint Print a file
lprintd Abort a print job
lprintq List the print queue
lprm Remove jobs from the print queue
ls List information about file(s)
m4 Macro processor
man Help manual
mkdir Create new folder(s)
mkfifo Make FIFOs (named pipes)
mknod Make block or character special files
more Display output one screen at a time
mount Mount a file system
mtools Manipulate MS-DOS files
mv Move or rename files or directories
nice Set the priority of a command or job
nl Number lines and write files
nohup Run a command immune to hangups
passwd Modify a user password
paste Merge lines of files
pathchk Check file name portability
popd Restore the previous value of the current directory
pr Convert text files for printing
printcap Printer capability database
printenv Print environment variables
printf Format and print data
ps Process status
pushd Save and then change the current directory
pwd Print Working Directory
quota Display disk usage and limits
quotacheck Scan a file system for disk usage
quotactl Set disk quotas
ram ram disk device
rcp Copy files between two machines.
read read a line from standard input
readonly Mark variables/functions as readonly
remsync Synchronize remote files via email
return Exit a shell function
rm Remove files
rmdir Remove folder(s)
rpm Remote Package Manager
rsync Remote file copy (Synchronize file trees)
screen Terminal window manager
sdiff Merge two files interactively
sed Stream Editor
select Accept keyboard input
seq Print numeric sequences
set Manipulate shell variables and functions
shift Shift positional parameters
shopt Shell Options
shutdown Shutdown or restart linux
sleep Delay for a specified time
sort Sort text files
source Run commands from a file `.'
split Split a file into fixed-size pieces
su Substitute user identity
sum Print a checksum for a file
symlink Make a new name for a file
sync Synchronize data on disk with memory
tac Concatenate and write files in reverse
tail Output the last part of files
tar Tape ARchiver
tee Redirect output to multiple files
test Evaluate a conditional expression
time Measure Program Resource Use
times User and system times
touch Change file timestamps
top List processes running on the system
traceroute Trace Route to Host
trap Run a command when a signal is set(bourne)
tr Translate, squeeze, and/or delete characters
true Do nothing, successfully
tsort Topological sort
tty Print filename of terminal on stdin
type Describe a command
ulimit Limit user resources
umask Users file creation mask
umount Unmount a device
unalias Remove an alias
uname Print system information
unexpand Convert spaces to tabs
uniq Uniquify files
units Convert units from one scale to another
unset Remove variable or function names
unshar Unpack shell archive scripts
until Execute commands (until error)
useradd Create new user account
usermod Modify user account
users List users currently logged in
uuencode Encode a binary file uudecode Decode a file created by uuencode
v Verbosely list directory contents (`ls -l -b')
vdir Verbosely list directory contents (`ls -l -b')
watch Execute/display a program periodically
wc Print byte, word, and line counts
whereis Report all known instances of a command
which Locate a program file in the user's path.
while Execute commands
who Print all usernames currently logged in
whoami Print the current user id and name (`id -un')
xargs Execute utility, passing constructed argument list(s)
yes Print a string until interrupted
.period Run commands from a file
### Comment / Remark

grep usage

grep usage
Here is an example shell command that invokes GNU grep:

grep -i 'hello.*world' hello.h hello.c

This lists all lines in the files `hello.h' and `hello.c' that contain the string `hello' followed by the string `world'; this is because `.*' matches zero or more characters within a line. See section 5. Regular Expressions. The `-i' option causes grep to ignore case, causing it to match the line `Hello, world!', which it would not otherwise match. Invoking grep, for more details about how to invoke grep.

Here are some common questions and answers about grep usage.

How can I list just the names of matching files?

grep -l 'main' *.c

lists the names of all C files in the current directory whose contents mention `main'. How do I search directories recursively?

grep -r 'hello' /home/test

searches for `hello' in all files under the directory `/home/test'. For more control of which files are searched, use find, grep and xargs. For example, the following command searches only C files:

find /home/test -name '*.c' -print | xargs grep 'hello' /dev/null

This differs from the command:

grep -r 'hello' *.c

which merely looks for `hello' in all files in the current directory whose names end in `.c'. Here the `-r' is probably unnecessary, as recursion occurs only in the unlikely event that one of `.c' files is a directory. What if a pattern has a leading `-'?

grep -e '--cut here--' *

searches for all lines matching `--cut here--'. Without `-e', grep would attempt to parse `--cut here--' as a list of options. Suppose I want to search for a whole word, not a part of a word?

grep -w 'hello' *

searches only for instances of `hello' that are entire words; it does not match `Othello'. For more control, use `<' and `>' to match the start and end of words. For example:

grep 'hello>' *

searches only for words ending in `hello', so it matches the word `Othello'. How do I output context around the matching lines?

grep -C 2 'hello' *

prints two lines of context around each matching line. How do I force grep to print the name of the file?

Append `/dev/null':
grep 'eli' /etc/passwd /dev/null

gets you:
/etc/passwd:bill:TWEFWEG.IMe.:98:11:Bill Gates:/home/do/bgates:/bin/bash Why do people use strange regular expressions on ps output?

ps -ef | grep '[c]ron'

If the pattern had been written without the square brackets, it would have matched not only the ps output line for cron, but also the ps output line for grep. Note that some platforms ps limit the ouput to the width of the screen, grep does not have any limit on the length of a line except the available memory. Why does grep report "Binary file matches"?
If grep listed all matching "lines" from a binary file, it would probably generate output that is not useful, and it might even muck up your display. So GNU grep suppresses output from files that appear to be binary files. To force GNU grep to output lines even from files that appear to be binary, use the `-a' or `--binary-files=text' option. To eliminate the "Binary file matches" messages, use the `-I' or `--binary-files=without-match' option. Why doesn't `grep -lv' print nonmatching file names?
`grep -lv' lists the names of all files containing one or more lines that do not match. To list the names of all files that contain no matching lines, use the `-L' or `--files-without-match' option.
I can do OR with `|', but what about AND?

grep 'paul' /etc/motd | grep 'franc,ois'

finds all lines that contain both `paul' and `franc,ois'. How can I search in both standard input and in files?
Use the special file name `-':

cat /etc/passwd | grep 'alain' - /etc/motd

How to express palindromes in a regular expression? It can be done by using the back referecences, for example a palindrome of 4 chararcters can be written in BRE.

grep -w -e '(.)(.).21' file

It matches the word "radar" or "civic".
Guglielmo Bondioni proposed a single RE that finds all the palindromes up to 19 characters long.

egrep -e '^(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?).?987654321$' file

Note this is done by using GNU ERE extensions, it might not be portable on other greps. Why are my expressions whith the vertical bar fail?

/bin/echo "ba" | egrep '(a)1|(b)1'

The first alternate branch fails then the first group was not in the match this will make the second alternate branch fails. For example, "aaba" will match, the first group participate in the match and can be reuse in the second branch. What do grep, fgrep, egrep stand for ?
grep comes from the way line editing was done on Unix. For example, ed uses this syntax to print a list of matching lines on the screen.

global/regular expression/print

fgrep stands for Fixed grep, egrep Extended grep.

Linux find command

Linux find command

The find command allows the Unix user to process a set of files and/or directories in a file subtree.

You can specify the following:

* where to search (pathname)
* what type of file to search for (-type: directories, data files, links)
* how to process the files (-exec: run a process against a selected file)
* the name of the file(s) (-name)
* perform logical operations on selections (-o and -a)
* Search for file with a specific name in a set of files (-name)

find . -name "rc.conf" -print

This command will search in the current directory and all sub directories for a file named rc.conf.

Note: The -print option will print out the path of any file that is found with that name. In general -print wil print out the path of any file that meets the find criteria.

How to apply a unix command to a set of file (-exec).

find . -name "rc.conf" -exec chmod o+r '{}' \;

This command will search in the current directory and all sub directories. All files named rc.conf will be processed by the chmod -o+r command. The argument '{}' inserts each found file into the chmod command line. The\; argument indicates the exec command line has ended.

The end results of this command is all rc.conf files have the other permissions set to read access (if the operator is the owner of the file).

How to apply a complex selection of files (-o and -a).

find /usr/src -not \( -name "*,v" -o -name ".*,v" \) '{}' \; -print

This command will search in the /usr/src directory and all sub directories. All files that are of the form '*,v' and '.*,v' are excluded.

Important arguments to note are:

* -not means the negation of the expression that follows
* \( means the start of a complex expression.
* \) means the end of a complex expression.
* -o means a logical or of a complex expression.

In this case the complex expression is all files like '*,v' or '.*,v'
The above example is shows how to select all file that are not part of the RCS system. This is important when you want go through a source tree and modify all the source files... but ... you don't want to affect the RCS version control files.

How to search for a string in a selection of files (-exec grep ...).

find . -exec grep "searchthisstring" '{}' \; -print

This command will search in the current directory and all sub directories. All files that contain the string will have their path printed to standard output.

If you want to just find each file then pass it on for processing use the -q grep option. This finds the first occurrance of the search string. It then signals success to find and find continues searching for more files.

find . -exec grep -q "searchthisstring" '{}' \; -print

This command is very important for process a series of files that contain a specific string. You can then process each file appropriately.

User configuration files: . (dot) files and rc files

User configuration files: . (dot) files and rc files
configuration files: the first one at a "system" level, located in /etc/; and the other one, "private" to the user, that can be found in home directory.

Commonly used rc and . (dot) files

Filename Description
.bash_login Look at "man bash". Treated by bash like .bash_profileif that doesn't exist.
.bash_logout Look at "man bash".Sourced by bash login shells at exit.
.bash_profile Sourced by bash login shells after /etc/profile.
.bash_history The list of commands executed previously.
.bashrc Look at "man bash". Sourced by bash non-login interactive shells (no other files are). Non-interactive shells source nothing unless BASH_ENV or ENV are set.
.emacs Read by emacs at startup.
.forward If this contains an e-mail address, then all mail to owner of ~ will be forwarded to that e-mail address.
.fvwmrc .fvwm2rc Config files for fvwm and fvwm2 (the basic XWindow manager).
.hushlogin Look at "man login". Causes a "quiet" login (no mail notice, last login info, or MOD).
.mail.rc User init file for mail program.
.ncftp/ Directory for ncftp program; contains bookmarks, log, macros, preferences, trace. See man ncftp. The purpose of ncftp is to provide a powerful and flexible interface to the Internet standard File Transfer Protocol. It is intended to replace the stock ftp program that comes with the system.
.profile Look at "man bash". Treated by bash like ~/.bash_profile if that and .bash_login don't exist, and used by other Bourn- heritage shells too.
.pinerc Pine configuration
.muttrc Mutt configuration
.exrc Configuration of vi can be controlled by this file. Example: set ai sm ruler Writing the above line in this file makes vi set the auto-indentation, matching brackets and displaying line number and rows- columns options.
.vimrc Default "Vim" configuration file. Same as .exrc.
.gtkrc GNOME Toolkit.
.kderc KDE configuration.
.netrc Default login names and passwords for ftp.
.rhosts Used by the r-tools: rsh, rlogin, etc. Very weak security since host impersonation is easy. Must be owned by user (owner of ~/) or superuser. Lists hosts from which users may access this account. Ignored if it is a symbolic link.
.rpmrc See "man rpm". Read by rpm if /etc/rpmrc is not present.
.signature Message text that will be appended automatically to the mail sent from this account.
.twmrc Config file for twm (The Window Manager).
.xinitrc Read by X at startup (not by xinit script). Mostly starts some progs.
Example: exec /usr/sbin/startkde If the above line is present in this file, then the KDE Window Manager is started in when the startx command is issued from this account.
.xmodmaprc This file is passed to the xmodmap program, and could be named anything (.Xmodmap and, for example).
.xserverrc Run by xinit as the X server if it can find X to execute. ~/News/Sent-Message-IDs Default mail history file for gnus.
.Xauthority Read and written by xdm program to handle authorization. See the X, xdm, and xauth man pages.
.Xdefaults,.Xdefaults-hostname Read by X applications during startup on hostname. If the -hostname file can't be found, .Xdefaults is looked for.
.Xmodmap Points to .xmodmaprc; Red Hat had (has) .xinitrc using this name.
.Xresources Usually the name for the file passed to xrdb to load the X resources database, to avoid the need for applications to read a long .Xdefaults file. (~/.Xres has been used by some.)

What is Sticky bit?

Sticky bit

The most common use of the sticky bit today is on directories, where, when set, items inside the directory can only be renamed or deleted by the item's owner, the directory's owner, or the superuser. Generally this is set on the /tmp directory to prevent ordinary users from deleting or moving other users' files.

In addition, Solaris (as of Solaris 2.5) defines special behavior when the sticky bit is set on non-executable files: those files, when accessed, will not be cached by the kernel. This is usually set on swap files to prevent access on the file from flushing more important data from the system cache. It is also used occasionally for benchmarking tests.

The sticky bit can only be set by superuser root. Using the chmod command, it can be set using its octal mode 1000 or by its symbol t (s is already used by the setuid bit). For example, to add the bit on the directory /usr/local/tmp, one would type chmod +t /usr/local/tmp. Or, to make sure that directory has standard tmp permissions, one could also type chmod 1777 /usr/local/tmp.

In Unix symbolic file system permission notation, the sticky bit is represented by the letter t in the final character-place. For instance, on Solaris 8, the /tmp directory, which by default has the sticky-bit set, shows up as:

$ ls -ld /tmp

drwxrwxrwt 4 root sys 485 Nov 10 06:01 /tmp

If the sticky-bit is set on a file or directory without the execution bit set for the others category (non-user-owner and non-group-owner), it is indicated with a capital T:

# ls -l test

-rw-r--r-- 1 root other 0 Nov 10 12:57 test

# chmod +t test; ls -l test

-rw-r--r-T 1 root other 0 Nov 10 12:57 test

Friday, February 20, 2009

Cpanel /scripts folder with explanation of every script.

starts with /scripts/

adddns - Adds a DNS zone.
addfpmail - Add frontpage mail extensions to all domains without them.
addfpmail2 -Add frontpage mail extensions to all domains without them.
addnetmaskips - Add the netmask to all IPs that have no netmask.
addnobodygrp - Adds the group nobody and activates security.
addpop - Add a Pop Account.
addservlets - Add JSP support to an account (requires tomcat).
addstatus - (Internal use never called by user).
adduser - Add a user to the system.
admin - Run WHM Lite.
apachelimits - Add rlimits to Apache
betaexim - Installs the latest version of exim.
biglogcheck - looks for logs nearing 2 gigabytes in size
bsdcryptoinstall - Installs crypto on FreeBSD.
bsdldconfig - Configures the proper lib directories in FreeBSD.
bsdpkgpingtest - Tests the connection speed for downloading FreeBSD packages.
buildbsdexpect - Install expect on FreeBSD.
buildeximconf - Rebuilds exim.conf.
buildpostgrebsd-dev - Installs postgresql on FreeBSD.
checkbadconf - Checks /usr/local/apache/conf/httpd.conf for bad users.
checkbsdgroups - Checks and repairs proftpd ownership on FreeBSD.
checkccompiler - Checks to make sure the C compiler works on your system.
checkfpkey - Checks for the FrontPage suid key
checkgd - Checks to see if GD is built.
checkinterchange - (Internal use).
checklibssl - Checks to make sure the proper libssl symlinks exist.
checkmaxclients - Checks to see if apache has reached the maximum clients allowed.
checkoldperl - Checks to see if the version of Perl on your system is old.
checkrsync - Checks to make sure rsync is up to date.
checksuexecpatch - Checks to see if mailman has been patched for suexec.
checksuspendpages - Checks to see if suspend pages are properly named.
checkup2date - Makes sure up2date is set up properly (RedHat)
checkyum - Makes sure yum is set up properly.
chkpaths - Makes sure /usr/sbin/chown has a symlink to /bin/chown
chownpublichtmls - Change ownership of all users web space to them, which is useful for converting to suexec. Files owned by nobody are deleted.
chpass - Change password.
ckillall - Allows you to kill a process (used like killall).
ckillall2 - Allows you to kill a process.
cleanbw - Cleans up old bandwidth logs.
cleandns8 - Clean up named.conf.
cleangd - Cleans up old GD installs and reinstalls GD
cleanmd5 - Fix CPAN md5 problems.
cleanmsglog - cleans exim’s msglog
cleanupmysqlprivs - Cleans up improper mySQL privileges.
compilers - Disables the usage of compilers for unprivileged users.
convert2maildir - Converts mail from mbox to maildir format and installs courier impap and pop (cpimap is removed).
courierup - Updates/Installs Courier
cpbackup - Runs backups.
distupgrade - Upgrades RedHat to the newest version (for testing only)
dnscluster - Enables DNS clustering.
dnsqueuecron - Adds a cron job to dump the DNS queue.
dnstransfer - Only if the server has a DNS master (sync with DNS master).
downgradefp - Downgrades FrontPage Extensions (to 5.0-0)
dropmysqldb - Drops a mySQL database.
easyapache - Upgrade Apache
editquota - Change a users quota.
enablechkservdwebmail - Enable service checking of webmaild.
enablefileprotect - Protects home directories if file protection is built in apache.
ensurepkg - Installs a FreeBSD package.
ensurerpm - Installs a rpm.
exim3 - Installs exim 3.
exim4 - Installs exim 4.
exim4-rh73test - Installs exim release #260. (RedHat only)
eximcron - Creates a cron job for exim_tidy_db.
eximlocalsend - Enables/Disables exim local sending.
exim_tidydb - Cleans the exim message log.
eximup - Installs/Updates exim.
fetchgd - Includes
findhacks - Search for common Trojan Horses.
findoddrootprocesses - Lists root processes that may need to be checked out.
findphpversion - Check to see if your php version file is up to date.
findtrojans - Exhaustive Trojan Horse search.
fixallcartswithsuexec - Fixes permissions on carts when using suexec.
fixallinterchangeperm - Fixes permissions on all users’ Interchange Shopping Carts.
fixbinpath - Makes sure all bin file paths are correct.
fixbuggynamed - Updates bind to solve any problems with bugs.
fixcommonproblems - Attempt to fix the most common problems.
fixetchosts - Fixes problems with /etc/hosts
fixeverything - Fix common problems and quotas.
fixfpwml - Fix for .wml errors with frontpage.
fixheaders - Run if nothing compiles errors with .h files on compile.
fixinterchange - Reinstall interchange Perl modules.
fixinterchangeperm - fix permissions on a user’s interchange cart.
fixipsnm - Same as addnetmask ips, but Perl though.
fixlibnet - Reinstall Bundle::libnet (Perl).
fixlocalhostwithphp - Change /etc/hosts to work better with PHP 4.2.0 + MySQL.
fixmailman - Updates and restarts mailman.
fixmailmanwithsuexec -
fixmuse - Reinstalls muse.
fixmysql - Fixes problems with mySQL.
fixmysqlbsd - Fixes problesm with mySQL on FreeBSD.
fixnamed - Updates bind to handle many DNS zones (more than 512).
fixndc - Repair redhat’s broken named.conf on 7.2.
fixoldlistswithsuexec - Run after enabling suexec on the server to change the URLs that Mailman gives out to ones that don’t give a 500 internal server error.
fixperl - Symlink /usr/local/bin/perl /usr/bin/perl.
fixperlscript - Makes sure a perlscript includes all corresponding modules.
fixpop - Fix a POP account and reset password.
fixproftpdconf - Fixes problems with /usr/local/etc/proftpd.conf
fixproftpddupes - Updates proftpd.
fixquotas - Fix quotas.
fixrndc - Fixes named.conf to prevent rndc staus failed.
fixspamassassinfailedupdate - Reinstalls a failed spamassassin update.
fixsubdomainlogs - Run if subdomain logs don’t show up in cPanel.
fixsuexeccgiscripts - Fix CGI scripts that are broken after suexec installed.
fixvaliases - Fix permisions on valiases.
fixwebalizer - Repair a Webalizer that has stopped updating.
fp3 - Updates the fpexe3 patch.
fpanonuserpatch - Updates FrontPage extensions to include the anonymous user patch.
ftpcheck - Checks for FTPSSL.
ftpquaotacheck - Runs quota checking for all ftp users.
ftpup - Updates your ftp server.
fullhordereset - Resets Horde and displays the current Horde password.
futexfix - Fixes problesm with futex.
futexstartup - Starts futex.
gcc3 - Installs gcc-3.3.3
gencrt - Generate a .crt and .csr file.
grpck - Checks to see if grpck is working properly.
hdparmify - Enable dma/irq/32bit HD access, which speeds up IDE drives.
hdparmon - Turns on hdparm.
initacls - Mounts your file systems with ACL support (make sure your kernel supports ACLs)
initfpsuexec - Enable FrontPage suexec support.
initquotas - Turn on quota support on new drives.
initsslhttpd - Make sure HTTP starts with SSL.
initsuexec - Turn on suexec support if suexec is installed.
installcgipm - Installs
installdbi - Install Bundle::DBD::mysql.
installfpfreebsd - Installs FrontPage 5 Extensions on FreeBSD.
installfpgentoo - Installs FrontPage on Gentoo.
installgd - Builds GD.
installpkg - Installs a FreeBSD package.
installpostgres - Installs PostrgeSQL.
installrpm - Installs a rpm.
installspam - Install SpamAssassin.
installssl - Add a SSL vhost.
installzendopt - Install zend optimzer.
installzendopt-freebsd - Install zend optimizer on a freebsd machine.
isdedicatedip - Checks an ip to see if it is dedicated.
killacct - Delete an account.
killbadrpms - Security script that kills insecure RPMs from the server.
killdns - Delete a DNS zone.
killdrrootvhost - Removes the document root for a virtual host.
killndbm - Remove the broken NDBM_File module from 7.2.
killpvhost - Removes a virtual host from proftpd.conf.
killspamkeys - Removes a spam key.
killsslvhost - Removes a SSL entry for a virtual host.
killvhost - Delete a vhost.
listcheck - Checks mailing lists for issues.
listproblems - Lists common problems.
listsubdomains - List subdomains.
mailperm - Fix almost any mail permission problem.
mailscannerupdate - Updates MailScanner
mailtroubleshoot - Guided mail fix.
makecpphp - Installs php.
makesecondary - Part of DNS transfer.
manualupcp - Updates cPanel manually.
md5crypt - Encrypts a password into MD5.
mseclocal - Sets up Mandrake’s msec to allow exim to run as mailnull.
mysqladduserdb - Create a MySQL databse and user.
mysqlconnectioncheck - Attempts to connect to MySQL, restarts SQL if necessary.
mysqldeluserdb - Delete a MySQL database and user.
mysqlpasswd - Change MySQL password.
mysqlrpmpingtest - Checks your connection speed for downloading mySQL rpms.
mysqlup - Updates mySQL.
ndbmcheck - Checks to see if the nbdm module is loaded (kills in RedHat 7.2)
netftpsslpatch - Patches
newexim - Installs the latest version of exim.
nofsck - Make fsck always use -y
nomodattach - Removes mod_attach from httpd.conf.
nomodauthmysql -Removes mod_auth_mysql from httpd.conf.
nomodbwprotect - Removes mod_bwportect from httpd.conf.
nomodgzipconfmods - Removes mod_gzip from httpd.conf.
nomodperl - Removes mod_perl from httpd.conf.
oldaddoncgi2xaddon - Updates old addons to X addons.
park - Parks a domain.
patcheximconf - Fixes exim.conf.
perlinstaller - Installs perl.
phpini - Create a php.ini file.
pingtest - Checks your download time from cPanel mirrors.
pkgaccount-ala - backs up an Alab*nza account for transfer.
pkgacct-ciXost - backs up a ci*ost account for transfer.
pkgacct-dXm - backs up a d*m account for transfer.
pkgacct-enXim - backs up an en*im account for transfer.
pkgacct-pXa - backs up a p*a account for transfer.
proftpd128 - Installs proftpd-1.2.8.
ptycheck - Fixes permissoins on /dev/ptmx.
pwck -Verifies the integrity of system authentication information.
quickkernel - Updates your kernel.
quicksecure - Quickly kill useless services.
rebuildcpanelsslcrt - Rebuilds the cPanel SSL Certificate.
rebuildcpusers - Rebuilds /var/cpanel/users.
rebuildetcpasswd - Rebuilds /etc/passwd.
rebuildeximbsd - Rebuilds exim on FreeBSD.
rebuildhttpdconffromproftpd - Rebuild httpd.conf from the proftpd.conf file.
rebuildinterchangecfg - Used after moving a domain with Interchange to the server.
rebuildnamedconf - Restore named.conf from files in /var/named.
rebuildproftpd - Restore proftpd.conf from httpd.conf.
reinstallmailman - Reinstalls mailman.
relocatevartousr - Relocates files from /var to /usr in case of disk space issues.
remdefssl - Remove default SSL vhost.
reseteximtodefaults - Resets exim’s default settings.
resetimappasswds - Resets all imap passwords.
resetquotas - Change quotas to what they should be .
restartsrv - Restart a service.
restartsrv_apache - Restart apache.
restartsrv_bind - Restart bind.
restartsrv_clamd - Restart clamd.
restartsrv_courier - Restart courier imap.
restartsrv_cppop - Restart cppop.
restartsrv_entropychat - Restart entropy chat.
restartsrv_exim - Restart exim.
restartsrv_eximstats - Restart exim statistics.
restartsrv_ftpserver - Restart your ftp server.
restartsrv_httpd - Restart httpd.
restartsrv_imap - Restart impad.
restartsrv_inetd - Restart inetd.
restartsrv_interchange - Restart Interchange Shopping Cart.
restartsrv_melange - Restart melange chat.
restartsrv_mysql - Restart mysqld.
restartsrv_named - Restart named.
restartsrv_postgres - Restart postgresql.
restartsrv_postgresql - Restart postgresql.
restartsrv_proftpd - Restart proftpd.
restartsrv_pureftpd - Restart pure-ftpd.
restartsrv_spamd - Restart spamd.
restartsrv_sshd - Restart sshd.
restartsrv_syslogd - Restart syslogd.
restartsrv_tomcat - Restart tomcat.
restartsrv_xinetd - Restart xinetd.
restoremail - Restores a user’s mail.
reswhostmgr - Restart whostmgr.
rpmup - Upgrade redhat/mandrake errata/security.
rrdtoolinstall - Installs RRD Tool.
runstatsonce - Runs statistics (should be used from the crontab).
runweblogs - Run analog/webalizer/etc. for a user.
safeperlinstaller - Installs perl safely.
safeup2date - Runs up2date safely.
safeyum - Runs yum safely.
secureit - Remove unnecessary suid binaries.
securemysql - Attempts to secure the MySQL configuration.
securetmp - Adds securetmp to system startup.
setupfp - Install FrontPage 3 on an account.
setupfp4 - Install FrontPage 4 (2000) installer on an account.
setupfp5 - Install FrontPage 5 (2002) installer on an account.
setupfp5.nosueuxec - Install FrontPage 5 (2002) installer on an account when not using suexec.
showexelist - Shows exe processes.
simpleps - Display the process list.
smartcheck - Checks hard drive integrity.
smtpmailgdionly - Enables SMTP Mail Protection.
spamboxdisable - Disables SpamAssassin’s spambox delivery for all accounts.
suspendacct - Suspends an account.
sysup - update cPanel RPMs.
unlimitnamed - Installs the latest version of bind patched to support greater than 512 ips on the server.
unblockip - Unblocks an IP blocked by portsentry.
unsetupfp4 - Removes FrontPage 4 or 5 from an account.
unslavenamedconf - If the user accidentally sets a DNS master as local server, this will repair named.conf after the loop.
unsuspendacct - Unsuspends an account.
upcp - Updates cPanel.
updated - Updates /scripts.
updatefrontpage - Updates FrontPage
updatenow - Updates /scripts NOW.
updatephpconf - Updates PHP configuration files.
whoowns - Finds out who owns a domain.
wwwacct - Creates an account.
xaddonreport - Reports the current addon scripts installed.

Thursday, February 12, 2009

Difference b/w Active and Passive Ftp

This article will explain the differences between Active and Passive FTP modes. Active mode is used for servers with tight security.

Security is a major concern with any computer connected to the internet, therefore any computer connected to the internet should be protected by a Firewall. In order to connect to certain services, such as FTP, you have to allow those connections in the Firewall, on both the Client and Server side.

Although a client's computer may not have a firewall enabled, a server should always have this enabled for maximum security.In order to connect to an FTP server that has a firewall enabled, you have to connect using a specific connection mode in your FTP program.

There are different connection modes to choose from when connecting to an FTP server, typically either "Active" or "Passive" mode.

Active mode is beneficial to the FTP Server's security, while Passive mode typically requires less configuration changes on the Client's side.