Monday, April 27, 2009

Win XP Tweaks

Windows Prefetcher
******************
[HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ Session Manager \ Memory Management \ PrefetchParameters]

Under this key there is a setting called EnablePrefetcher, the default setting of which is 3. Increasing this number to 5 gives the prefetcher system more system resources to prefetch application data for faster load times. Depending on the number of boot processes you run on your computer, you may get benefits from settings up to 9. However, I do not have any substantive research data on settings above 5 so I cannot verify the benefits of a higher setting. This setting also may effect the loading times of your most frequently launched applications. This setting will not take effect until after you reboot your system.


Master File Table Zone Reservation
**********************************
[HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ FileSystem]

Under this key there is a setting called NtfsMftZoneReservation, the default setting of which is 1. The range of this value is from 1 to 4. The default setting reserves one-eighth of the volume for the MFT. A setting of 2 reserves one-quarter of the volume for the MFT. A setting of 3 for NtfsMftZoneReservation reserves three-eighths of the volume for the MFT and setting it to 4 reserves half of the volume for the MFT. Most users will never exceed one-quarter of the volume. I recommend a setting of 2 for most users. This allows for a "moderate number of files" commensurate with the number of small files included in most computer games and applications. Reboot after applying this tweak.


Optimize Boot Files
*******************
[HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Dfrg \ BootOptimizeFunction]

Under this key is a text value named Enable. A value of Y for this setting enables the boot files defragmenter. This setting defragments the boot files and may move the boot files to the beginning (fastest) part of the partition, but that last statement is unverified. Reboot after applying this tweak.

Optimizing Startup Programs [msconfig]
**************************************

MSConfig, similar to the application included in Win9x of the same name, allows the user to fine tune the applications that are launched at startup without forcing the user to delve deep into the registry. To disable some of the applications launched, load msconfig.exe from the run command line, and go to the Startup tab. From there, un-ticking the checkbox next to a startup item will stop it from launching. There are a few application that you will never want to disable (ctfmon comes to mind), but for the most part the best settings vary greatly from system to system.

As a good rule of thumb, though, it is unlikely that you will want to disable anything in the Windows directory (unless it's a third-party program that was incorrectly installed into the Windows directory), nor will you want to disable anything directly relating to your system hardware. The only exception to this is when you are dealing with software, which does not give you any added benefits (some OEM dealers load your system up with software you do not need). The nice part of msconfig is that it does not delete any of the settings, it simply disables them, and so you can go back and restart a startup application if you find that you need it. This optimization won't take effect until after a reboot.

Bootvis Application
*******************
The program was designed by Microsoft to enable Windows XP to cold boot in 30 seconds, return from hibernation in 20 seconds, and return from standby in 10 seconds. Bootvis has two extremely useful features. First, it can be used to optimize the boot process on your computer automatically. Second, it can be used to analyze the boot process for specific subsystems that are having difficulty loading. The first process specifically targets the prefetching subsystem, as well as the layout of boot files on the disk. When both of these systems are optimized, it can result in a significant reduction in the time it takes for the computer to boot.

Before attempting to use Bootvis to analyze or optimize the boot performance of your system, make sure that the task scheduler service has been enabled – the program requires the service to run properly. Also, close all open programs as well – using the software requires a reboot.

To use the software to optimize your system startup, first start with a full analysis of a fresh boot. Start Bootvis, go to the Tools menu, and select next boot. Set the Trace Repetition Settings to 2 repetitions, Start at 1, and Reboot automatically. Then set the trace into motion. The system will fully reboot twice, and then reopen bootvis and open the second trace file (should have _2 in the name). Analyze the graphs and make any changes that you think are necessary (this is a great tool for determining which startup programs you want to kill using msconfig). Once you have made your optimizations go to the Trace menu, and select the Optimize System item. This will cause the system to reboot and will then make some changes to the file structure on the hard drive (this includes a defragmentation of boot files and a shifting of their location to the fastest portion of the hard disk, as well as some other optimizations). After this is done, once again run a Trace analysis as above, except change the starting number to 3. Once the system has rebooted both times, compare the charts from the second trace to the charts for the fourth trace to show you the time improvement of the system's boot up.

The standard defragmenter included with Windows XP will not undo the boot optimizations performed by this application.



-----------------------------------
General Performance Tweaks
-----------------------------------


IRQ Priority Tweak
******************
[HKEY_LOCAL_MACHINE \ System \ CurrentControlSet \ Control \ PriorityControl]

You will need to create a new DWORD: IRQ#Priority (where # is the number of the IRQ you want to prioritize) and give it a setting of 1. This setting gives the requisite IRQ channel priority over the other IRQs on a software level. This can be extremely important for functions and hardware subsystems that need real-time access to other parts of the system. There are several different subsystems that might benefit from this tweak. Generally, I recommend giving either the System CMOS or the video card priority. The System CMOS generally has an IRQ setting of 8, and giving it priority enhances the I/O performance of the system. Giving priority to the video card can increase frame rates and make AGP more effective.

You can give several IRQs priority, but I am not entirely certain how the system interacts when several IRQs are given priority – it may cause random instabilities in the system, although it is more likely that there's a parsing system built into Windows XP to handle such an occurrence. Either way, I would not recommend it.

QoS tweak
*********
QoS (Quality of Service) is a networking subsystem which is supposed to insure that the network runs properly. The problem with the system is that it eats up 20% of the total bandwidth of any networking service on the computer (including your internet connection). If you are running XP Professional, you can disable the bandwidth quota reserved for the system using the Group Policy Editor [gpedit.msc].

You can run the group policy editor from the Run command line. To find the setting, expand "Local Computer Policy" and go to "Administrative Templates" under "Computer Configuration." Then find the "Network" branch and select "QoS Packet Scheduler." In the right hand box, double click on the "Limit Reservable Bandwidth." From within the Settings tab, enable the setting and then go into the "Bandwidth Limit %" and set it to 0%. The reason for this is that if you disable this setting, the computer defaults to 20%. This is true even when you aren't using QoS.

Free Idle Tasks Tweak
*********************

This tweak will free up processing time from any idle processes and allow it to be used by the foreground application. It is useful particularly if you are running a game or other 3D application. Create a new shortcut to "Rundll32.exe advapi32.dll,ProcessIdleTasks" and place it on your desktop. Double-click on it anytime you need all of your processing power, before opening the application.

Windows Indexing Services
Windows Indexing Services creates a searchable database that makes system searches for words and files progress much faster – however, it takes an enormous amount of hard drive space as well as a significant amount of extra CPU cycles to maintain the system. Most users will want to disable this service to release the resources for use by the system. To turn off indexing, open My Computer and right click on the drive on which you wish to disable the Indexing Service. Enter the drive's properties and under the general tab, untick the box for "Allow the Indexing Service to index this disk for fast file searching."

Priority Tweak
**************
[HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ PriorityControl]

This setting effectively runs each instance of an application in its own process for significantly faster application performance and greater stability. This is extremely useful for users with stability problems, as it can isolate specific instances of a program so as not to bring down the entire application. And, it is particularly useful for users of Internet Explorer, for if a rogue web page crashes your browser window, it does not bring the other browser windows down with it. It has a similar effect on any software package where multiple instances might be running at once, such as Microsoft Word. The only problem is that this takes up significantly more memory, because such instances of a program cannot share information that is in active memory (many DLLs and such will have to be loaded into memory multiple times). Because of this, it is not recommended for anyone with less than 512 MB of RAM, unless they are running beta software (or have some other reason for needing the added stability).

There are two parts to this tweak. First is to optimize XP's priority control for the processes. Browse to HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ PriorityControl and set the "Win32PrioritySeparation" DWORD to 38. Next, go into My Computer and under Tools, open the Folder Options menu. Select the View tab and check the "Launch folder windows in separate process" box. This setting actually forces each window into its own memory tread and gives it a separate process priority.

Powertweak application
**********************
xxx.powertweak.com

Powertweak is an application, which acts much like a driver for our chipsets. It optimizes the communication between the chipset and the CPU, and unlocks several "hidden" features of the chipset that can increase the speed of the system. Specifically, it tweaks the internal registers of the chipset and processor that the BIOS does not for better communication performance between subsystems. Supported CPUs and chipsets can see a significant increase in I/O bandwidth, increasing the speed of the entire system. Currently the application supports most popular CPUs and chipsets, although you will need to check the website for your specific processor/chipset combo – the programmer is working on integrating even more chipsets and CPUs into the software.

Offload Network Task Processing onto the Network Card
*****************************************************
[HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ Tcpip \ Parameters]

Many newer network cards have the ability of taking some of the network processing load off of the processor and performing it right on the card (much like Hardware T&L on most new video cards). This can significantly lower the CPU processes needed to maintain a network connection, freeing up that processor time for other tasks. This does not work on all cards, and it can cause network connectivity problems on systems where the service is enabled but unsupported, so please check with your NIC manufacturer prior to enabling this tweak. Find the DWORD "DisableTaskOffload" and set the value to 0 (the default value is 1). If the key is not already available, create it.

Force XP to Unload DLLs
***********************
[HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Explorer]
"AlwaysUnloadDLL"=dword:00000001

XP has a bad habit of keeping dynamic link libraries that are no longer in use resident in memory. Not only do the DLLs use up precious memory space, but they also tend to cause stability problems in some systems. To force XP to unload any DLLs in memory when the application that called them is no longer in memory, browse to HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Explorer and find the DWORD "AlwaysUnloadDLL". You may need to create this key. Set the value to 1 to force the operating system to unload DLLs.

Give 16-bit apps their own separate processes
*********************************************
[HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ WOW]
"DefaultSeparateVDM"="Yes"

By default, Windows XP will only open one 16-bit process and cram all 16-bit apps running on the system at a given time into that process. This simulates how MS-DOS based systems viewed systems and is necessary for some older applications that run together and share resources. However, most 16-bit applications work perfectly well by themselves and would benefit from the added performance and stability of their own dedicated resources. To force Windows XP to give each 16-bit application it's own resources, browse to HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ WOW and find the String "DefaultSeparateVDM". If it is not there, you may need to create it. Set the value of this to Yes to give each 16-bit application its own process, and No to have the 16-bit application all run in the same memory space.

Disable User Tracking
*********************
[HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Policies \ Explorer]
"NoInstrumentation"=dword:00000001

The user tracking system built into Windows XP is useless to 99% of users (there are very few uses for the information collected other than for a very nosy system admin), and it uses up precious resources to boot, so it makes sense to disable this "feature" of Windows XP. To do so, browse to HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Policies \ Explorer and find the DWORD "NoInstrumentation". You may need to create this key if it is not there. The default setting is 0, but setting it to 1 will disable most of the user tracking features of the system.

Thumbnail Cache
***************
[HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Explorer \ Advanced]
"DisableThumbnailCache"=dword:00000001

Windows XP has a neat feature for graphic and video files that creates a "thumbnail" of the image or first frame of the video and makes it into an oversized icon for the file. There are two ways that Explorer can do this, it can create them fresh each time you access the folder or it can load them from a thumbnail cache. The thumbnail caches on systems with a large number of image and video files can become staggeringly large. To disable the Thumbnail Cache, browse to HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Explorer \ Advanced and find the DWORD "DisableThumbnailCache". You may need to create this key. A setting of 1 is recommended for systems where the number of graphic and video files is large, and a setting of 0 is recommended for systems not concerned about hard drive space, as loading the files from the cache is significantly quicker than creating them from scratch each time a folder is accessed.

Wednesday, April 22, 2009

How to install and use the Windows XP Recovery Console

the Recovery Console is a special boot up method that can be used to help fix problems that are preventing your Windows installation from properly booting up into Windows. This method allows you to access the files, format drives, disable and enable services, and other tasks from a console prompt while the operating system is not loaded. It is suggested that the Recovery Console is to only be used only after Safe mode and the other standard startup options do not work. I feel that the Recovery Console is also useful in other situations such as removing malware files that start in both Safe mode and Standard Mode and thus not allowing you to delete the infection.

This tutorial will guide you through the installation of the Recovery Console and how to use it. For those who are familiar with DOS or the command prompt, you will find the Recovery Console to be very familiar. For those who are not comfortable with this type of environment, I suggest you read through this primer in order to get familiar with this type of interface:

How to install the Recovery Console to your hard drive

I recommend that you install the Recovery Console directly onto your computer so that if you need it in the future, it is readily available. The Recovery Console only takes up approximately 7 megabytes so there is no reason why you should not have it installed in case you need it.

To install the Recovery Console on your hard drive, follow these steps:

1. Insert the Windows XP CD into your CD-ROM drive.

2. Click the Start button.

3. Click the Run menu option.

4 In the Open: field type X:\i386\winnt32.exe /cmdcons , where X is the drive letter for your CD reader, and press the OK button. An image of this step can be found below:




5 After pressing the OK button a setup window will appear similar to the one below



6. Simply press the Yes button to continue with the installation of the Recovery Console. The setup program will then attempt to do a Dynamic Update to make sure you have the latest files as shown below.



7. Simply allow it to continue and then when it is finished, you will be presented with a screen similar to the one below telling you so.



6. Press the OK button and remove the CD from your computer.

Now when you start your computer you will have an option to start the Recovery Console.



How to start the Recovery Console

o start the Recovery Console when it is installed on your hard drive you would do the following:

1. Reboot your computer and as Windows starts it will present you with your startup options as shown in the figure below.




2. With the arrows keys on your keyboard select the option listed as Microsoft Windows Recovery Console and press the enter key on your keyboard.

3. The Recovery Console will start and ask you which Windows installation you would like to log on to. If you have multiple Windows installations, it will list each one, and you would enter the number associated with the installation you would like to work on and press enter. If you have just one Windows installation, type 1 and press enter.

4. It will then prompt you for the Administrator's password. If there is no password, simply press enter. Otherwise type in the password and then press enter. If you do not know your password then see this.

5. If you entered the correct password you will now be presented with a C:\Windows> prompt and you can start using the Recovery Console.

6. Proceed to How to use the Recovery Console.

To start the Recovery Console directly from the Windows XP CD you would do the following:

1. Insert the Windows XP cd in your computer.

2. Restart your computer so you are booting off of the CD.

3. When the Welcome to Setup screen appears, press the R button on your keyboard to start the Recovery Console.

4. The Recovery Console will start and ask you which Windows installation you would like to log on to. If you have multiple Windows installations, it will list each one, and you would enter the number associated with the installation you would like to work on and press enter. If you have just one Windows installation, type 1 and press enter.

5. It will then prompt you for the Administrator's password. If there is no password, simply press enter. Otherwise type in the password and then press enter. If you do not know your password then see this.

6. If you entered the correct password you will now be presented with a C:\Windows> prompt and you can start using the Recovery Console.

7. Proceed to How to use the Recovery Console.


Remove the prompting of a password

When the Recovery Console starts it will ask for your Administrator password before continuing. In many cases when you have XP pre installed on your computer the Recovery Console will not recognize your Administrator's password. In these situations it is possible to edit a registry setting so that the Recovery Console does not ask for a password. This setting works on both Windows XP Home and Pro editions.

To change this setting do the following:

1. Click on the Start button.

2. Click on the Run option

3. Type regedit.exe in the open field and press the OK button.

4. Navigate to the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Setup\RecoveryConsole

5. Change the value of SecurityLevel value to 1

6. Close regedit

7. Reboot your computer.

Now the Recovery Console will no longer ask for a password.


How to use the Recovery Console

Though the Recovery Console looks similar to a standard command prompt it is not the same. Certain commands work, while others do not, and there are new commands available to you. There is no graphical interface, and all commands must be entered by typing them into the console prompt with your keyboard and pressing enter. This may be confusing for those who are not familiar with this type of interface, but after doing a few commands it does becomes easier.

The following is a list of the available commands that you can use in the Recovery Console. When using the recovery console you can type help followed by the command to see a more detailed explanation. For example: help attrib.
Command

Description

Attrib Changes attributes on a file or directory.
Batch
Executes commands that you specify in the text file, Inputfile. Outputfile holds the output of the commands. If you omit the Outputfile parameter, output appears on the screen.
Bootcfg Allows you to modify the Boot.ini file for boot configuration and recovery.
CD (Chdir) Change directory. Operates only in the system directories of the current Windows installation, removable media, the root directory of any hard disk partition, or the local installation sources.
Chkdsk Checks a disk for drive problems or errors. The /p switch runs Chkdsk even if the drive is not flagged as dirty. The /r switch locates bad sectors and recovers readable information. This switch implies /p. Chkdsk requires Autochk. Chkdsk automatically looks for Autochk.exe in the startup folder. If Chkdsk cannot find the file in the startup folder, it looks for the Windows 2000 Setup CD-ROM. If Chkdsk cannot find the installation CD-ROM, Chkdsk prompts the user for the location of Autochk.exe.
Cls Clears the screen
Copy Copies one file to a target location. By default, the target cannot be removable media, and you cannot use wildcard characters. Copying a compressed file from the Windows 2000 Setup CD-ROM automatically decompresses the file.
Del (Delete) Deletes one file. Operates within the system directories of the current Windows installation, removable media, the root directory of any hard disk partition, or the local installation sources. By default, you cannot use wildcard characters.
Dir Displays a list of all files, including hidden and system files.
Disable Disables a Windows system service or driver. The variable service_or_driver is the name of the service or driver that you want to disable. When you use this command to disable a service, the command displays the service's original startup type before it changes the type to SERVICE_DISABLED. Note the original startup type so that you can use the enable command to restart the service.
Diskpart Manages partitions on hard disk volumes. The /add option creates a new partition. The /delete option deletes an existing partition. The variable device is the device name for a new partition (such as \device\harddisk0). The variable drive is the drive letter for a partition that you are deleting (for example, D). Partition is the partition-based name for a partition that you are deleting, (for example: \device\harddisk0\partition1) and can be used instead of the drive variable. The variable size is the size, in megabytes, of a new partition.
Enable Enables a Windows system service or driver. The variable service_or_driver is the name of the service or driver that you want to enable, and start_type is the startup type for an enabled service. The startup type uses one of the following formats:
SERVICE_BOOT_START
SERVICE_SYSTEM_START
SERVICE_AUTO_START
SERVICE_DEMAND_START
Exit Quits the Recovery Console, and then restarts the computer.
Expand Expands a compressed file. The variable source is the file that you want to expand. By default, you cannot use wildcard characters. The variable destination is the directory for the new file. By default, the destination cannot be removable media and cannot be read-only. You can use the attrib command to remove the read-only attribute from the destination directory. The option /f:filespec is required if the source contains more than one file. This option permits wildcard characters. The /y switch disables the overwrite confirmation prompt. The /d switch specifies that the files will not be expanded and displays a directory of the files in the source.
Fixboot Writes a new startup sector on the system partition
Fixmbr Repairs the startup partition's master boot code. The variable device is an optional name that specifies the device that requires a new Master Boot Record. Omit this variable when the target is the startup device.
Format Formats a disk. The /q switch performs a quick format. The /fs switch specifies the file system.
Help If you do not use the command variable to specify a command, help lists all the commands that the Recovery Console supports.
Listsvc Displays all available services and drivers on the computer.
Logon Displays detected installations of Windows and requests the local Administrator password for those installations. Use this command to move to another installation or subdirectory.
Map Displays currently active device mappings. Include the arc option to specify the use of Advanced RISC Computing (ARC) paths (the format for Boot.ini) instead of Windows device paths.
MD (Mkdir) Creates a directory. Operates only within the system directories of the current Windows installation, removable media, the root directory of any hard disk partition, or the local installation sources.
More/Type Displays the specified text file on screen. More will display a text file one page at a time, while Type displays the entire text file at once.
Rd (Rmdir) Removes a directory. Operates only within the system directories of the current Windows installation, removable media, the root directory of any hard disk partition, or the local installation sources.
Ren (Rename) Rename a file or directory. Operates only within the system directories of the current Windows installation, removable media, the root directory of any hard disk partition, or the local installation sources. You cannot specify a new drive or path as the target.
Set Displays and sets the Recovery Console environment variables.
Systemroot Sets the current directory to %SystemRoot%.


Deleting the Recovery Console

Warning: To remove the Recovery Console you need to modify the Boot.ini file. Modifying this file incorrectly can prevent your computer from starting properly. Please only attempt this step if you feel comfortable doing this.

To remove the Recovery Console from your hard drive follow these steps:

1. Double-click on My Computer and then double-click on the drive you installed the Recovery Console (usually the C: drive).

2. Click on the Tools menu and select Folder Options.

3. Click on the View tab.

4. Select Show hidden files and folders and uncheck Hide protected operating system files.

5. Press the OK button.

6. Now at the root folder delete the Cmdcons folder and the Cmldr file.

7. At the root folder, right-click the Boot.ini file, and then click Properties.

8. Click to clear the Read-only check box, and then click the OK button.

9. Click on Start, then Run and type Notepad.exe c:\boot.ini in the Open: field and press the OK button.

10. Remove the entry for the Recovery Console. It will look similar to this:
C:\cmdcons\bootsect.dat="Microsoft Windows Recovery Console" /cmdcons

Make sure you only delete that one entry.

11. When you are done, close the notepad and save when it asks.

12. Right click again on the boot.ini file and select Properties.

13. Put a checkmark back in the Read-only checkbox and then press the OK button.

The recovery console should now be removed from your system.

--
Lawrence Abrams
Bleeping Computer Advanced Microsoft Tutorials
BleepingComputer.com: Computer Help & Tutorials for the beginning computer user.

CP/UDP Ports Explained

Introduction

In this tutorial we will discuss the concept of Ports and how they work with IP addresses. If you have not read our article on IP addresses and need a brush up, you can find the article here. If you understand the concepts of IP addresses, then lets move on to TCP and UDP ports and how they work.

The devices and comptuers connected to the Internet use a protocol called TCP/IP to communicate with each other. When a computer in New York wants to send a piece of data to a computer in England, it must know the destination IP address that it woud like to send the information to. That information is sent most often via two methods, UDP and TCP.

The two Internet workhorses: UDP and TCP

UDP? TCP? I know you are getting confused, but I promise I will explain this in very basic terms so that you can understand this concept.

TCP stands for Transmission Control Protocol. Using this method, the computer sending the data connects directly to the computer it is sending the data it to, and stay connected for the duration of the transfer. With this method, the two computers can guarantee that the data has arrived safely and correctly, and then they disconnect the connection. This method of transferring data tends to be quicker and more reliable, but puts a higher load on the computer as it has to monitor the connection and the data going across it. A real life comparison to this method would be to pick up the phone and call a friend. You have a conversation and when it is over, you both hang up, releasing the connection.

UDP stands for User Datagram Protocol. Using this method, the computer sending the data packages the information into a nice little package and releases it into the network with the hopes that it will get to the right place. What this means is that UDP does not connect directly to the receiving computer like TCP does, but rather sends the data out and relies on the devices in between the sending computer and the receiving computer to get the data where it is supposed to go properly. This method of transmission does not provide any guarantee that the data you send will ever reach its destination. On the other hand, this method of transmission has a very low overhead and is therefore very popular to use for services that are not that important to work on the first try. A comparison you can use for this method is the plain old US Postal Service. You place your mail in the mailbox and hope the Postal Service will get it to the proper location. Most of the time they do, but sometimes it gets lost along the way.

Now that you understand what TCP and UDP are, we can start discussing TCP and UDP ports in detail. Lets move on to the next section where we can describe the concept of ports better.

TCP and UDP Ports

As you know every computer or device on the Internet must have a unique number assigned to it called the IP address. This IP address is used to recognize your particular computer out of the millions of other computers connected to the Internet. When information is sent over the Internet to your computer how does your computer accept that information? It accepts that information by using TCP or UDP ports.

An easy way to understand ports is to imagine your IP address is a cable box and the ports are the different channels on that cable box. The cable company knows how to send cable to your cable box based upon a unique serial number associated with that box (IP Address), and then you receive the individual shows on different channels (Ports).

Ports work the same way. You have an IP address, and then many ports on that IP address. When I say many, I mean many. You can have a total of 65,535 TCP Ports and another 65,535 UDP ports. When a program on your computer sends or receives data over the Internet it sends that data to an ip address and a specific port on the remote computer, and receives the data on a usually random port on its own computer. If it uses the TCP protocol to send and receive the data then it will connect and bind itself to a TCP port. If it uses the UDP protocol to send and receive data, it will use a UDP port. Figure 1, below, is a represenation of an IP address split into its many TCP and UDP ports. Note that once an application binds itself to a particular port, that port can not be used by any other application. It is first come, first served.

<-------------------- 192.168.1.10 -------------------->
0 1 2 3 4 5 .. .. .. .. .. .. .. .. 65531 65532 65533 65534 65535
Figure 1. IP address with Ports

This all probably still feels confusing to you, and there is nothing wrong with that, as this is a complicated concept to grasp. Therefore, I will give you an example of how this works in real life so you can have a better understanding. We will use web servers in our example as you all know that a web server is a computer running an application that allows other computers to connect to it and retrieve the web pages stored there.

In order for a web server to accept connections from remote computers, such as yourself, it must bind the web server application to a local port. It will then use this port to listen for and accept connections from remote computers. Web servers typically bind to the TCP port 80, which is what the http protocol uses by default, and then will wait and listen for connections from remote devices. Once a device is connected, it will send the requested web pages to the remote device, and when done disconnect the connection.

On the other hand, if you are the remote user connecting to a web server it would work in reverse. Your web browser would pick a random TCP port from a certain range of port numbers, and attempt to connect to port 80 on the IP address of the web server. When the connection is established, the web browser will send the request for a particular web page and receive it from the web server. Then both computers will disconnect the connection.

Now, what if you wanted to run an FTP server, which is a server that allows you to transfer and receive files from remote computers, on the same web server. FTP servers use TCP ports 20 and 21 to send and receive information, so you won't have any conflicts with the web server running on TCP port 80. Therefore, the FTP server application when it starts will bind itself to TCP ports 20 and 21, and wait for connections in order to send and receive data.

Most major applications have a specific port that they listen on and they register this information with an organization called IANA. You can see a list of applications and the ports they use at the IANA Registry. With developers registering the ports their applications use with IANA, the chances of two programs attempting to use the same port, and therefore causing a conflict, will be diminished.

Configure GPRS and WAP Settings for an i-mate / O2 XDA II / MDA II (Updated)

sesapo yg nak pakai pda mcm eden ni caro nak setting gprs yg guno windows mobile

In Windows Mobile 2003 Phone Edition you can switch the GPRS Setting method you use when you make a GPRS connection.

In the GPRS setting utility there are two choices to select from. The first choice is PAP authentication. PAP stands for Password Authentication Protocol. This is a less sophisticated authentication process that uses clear text passwords.

The second choice is CHAP authentication. CHAP stands for Challenge Handshake Authentication Protocol. CHAP negotiates a secure form of encrypted authentication between the server and the client.

AT&T wireless used CHAP authentication for connecting to the internet via GPRS.

Windows Mobile 2003 has a simplified wizard for setting up your connection that eliminates a lot of the guess work that existed in the previous version. You can use the wizard to configure and connect your XDA II to the internet for web and WAP browsing.

In this tutorial I will be using the i-Mate from www.Expansys.us with an AT&T Wireless SIM chip installed.

Configure GPRS Access on the AT&T Wireless Network

image image


1 Tap Start
2 Tap Settings
3 Tap Connections
4 Tap GPRS Setting
5 Select the CHAP authentication radio button
6 Optional: Tap the GPRS – Setting tab
* Select the time slot you wish to use:
Class 8 (4R1T) indicates 4 receive slots and 1 transmit slot
Class 10 (3R2T) indicates 3 receive slots and 2 transmit slots
If your primary use is to download content from the internet, email, and other data heavy information Class 8 will provide you with better performance. Class 10 takes away 1 of the receive slots and gives you an extra transmit slot, this will be helpful if you send a lot of email, MMS pictures, transmission of large files or data.
7 Tap OK
* Your device is now ready to make connections.

Configure Device for Internet Web Browsing

1 Tap Connections
2 Under My ISP, select (Add a new modem connection)
3 Enter a name for your connection; I used (GPRS Connection)
4 From the Select a modem drop down box choose Cellular Line (GPRS)
5 Tap Next
6 In the text box labelled (Access point name) type in (proxy) with out the parenthesis
7 Tap Next
8 Leave the User name, Password, and Domain fields blank
9 Tap Finish
10 Tap OK
* Your device is now ready to browse the internet.

image image


Configure Device for WAP Access

1 Under My Work Network, select (Add a new modem connection)
2 Enter a name for your connection; I used (WAP)
3 From the Select a modem drop down choose Cellular Line (GPRS)
4 Tap Next
5 In the text box labelled (Access point name) type in (proxy) with out the parenthesis
6 Tap Next
7 Leave the User name, Password, and Domain fields blank
8 Tap Finish
9 Tap the Proxy Settings tab
10 Place a check in both boxes
11 Leave (Proxy server) blank
12 Tap Advanced
13 Leave HTTP and Socks Server fields blank.
14 Enter 10.250.250.250 for your WAP server. Ensure your port number is 9201
15 Enter 10.250.250.250 for your Secure WAP server. Ensure your port number is 9203
16 Tap OK twice
* Your device is now ready to browse WAP sites. To view the AT&T Wireless WAP site enter wsp://home in the address bar in Internet Explorer.

image image


Your XDAII will now switch between WAP sites and Internet sites on the fly. The connection change takes only a few seconds. Windows Mobile Phone Edition does not have an intuitive way to disconnect your GPRS connection. To manually disconnect you can depress the “end call” button on the device for a couple of seconds and that will end your GPRS session.

Additionally you can start a GPRS connection by accessing an application that uses the internet like internet explorer or by tapping the radio icon on the today screen and selecting your GPRS connection type.

image




Cingular Account Settings

Brian Pepin of UrbanPotato.net has sent me the following setttings for Cingular customers:

Order Wireless Internet Express from Cingular. Online you can order the 1MB/month option, but no more. That's a good starting point, but you're going to chew through a meg very quickly so call them and ask for more. Try to deal: their unlimited plan is over twice as expensive as T-Mobile. I opted for the online because it was about 11:00 PM when I started this project. After about half an hour GPRS was working on my account.

Creating a Cingular Data Connection

Your next order of business is to create a data connection.

1 Tap Start->Settings->Connections and under My ISP tap Add a new modem connection.
2 Name it and choose a modem type of Cellular Line (GPRS)
3 Set the access point name to isp.cingular
4 Set the user name to WIXDC001@W5.MYCINGULAR.COM (case sensitive)
5 Set the password to ZXY203DC9K0402 (case sensitive)
6 Tap Finish to create the connection.

Next, ensure that your GPRS settings are correct.

1 Under Connections ensure that the CSD Line Type is set to 9600 bps(v.32).
2 Ensure that the connection element set to non-transparent.
3 Under GPRS Setting ensure that authentication is set to PAP and the class is 8.

Creating a Cingular WAP Connection

1 Tap Start->Settings->Connections and under My Work Network tap Add a new modem connection.
2 Name it and choose a modem type of Cellular Line (GPRS)
3 Set the access point name to wap.cingular
4 Set the user name to WAP@CINGULAR.COM (case sensitive)
5 Set the password to CINGULAR1 (case sensitive)
6 Tap Finish to create the connection.
7 Next, tap Set up my proxy server
8 Check both "This network connects to the internet" and "This network uses a proxy server". Don't provide a proxy server. Click Advanced.
9 Under WAP and Secure WAP set the following IP address: 66.209.11.61

Finally, in Internet Explorer navigate to http://device.home This takes you to the WAP portal of Cingular's My Wireless Window. You can get a free account there and setup the portal to your liking. It's low budget, but also low bandwidth.



That's it for now, I will make changes as needed to this tutorial. If you use another wireless carrier and would like to share your connection settings we will be happy to post them to help our non AT&T Wireless readers.

P.S.: If this tutorial was helpfull, please visit a couple of our ad sponsors to help support our site.

Install damnsmalllinux

pecayo tak os boleh install dalam pendrive???
thread kali nie buat sahabat PendetaHati yang minta aku terangkan cara-cara macam mana nak install dan configure damn small linux...buat sahabat,pas nih ko jangan riak lak...kongsi ilmu yang ado...berkat hingga akhir hayat...

1)ok first of all,check list benda-benda nih
-A 64MB or larger USB flash drive (fat32 formatted)
-7-Zip (or another extracting utility)
-Syslinux
-dsl-embedded.zip

2)Download dsl-embedded.zip dan extract file menggunakan 7zip kedalam flash drive.
extract trus kat luar..jgn kedalam folder contoh extrac "f:" bukan "f:/data...

3)Download syslinux-3.36.zip kedalam pc..assume extract kedalam c: drive..

4)masuk "cmd" dan masuk kedalam folder /syslinux/win32

5)taipkan syslinux.exe -ma X: (replace X dengan usb drive letter) supaya drive ini boleh boot..

6)reboot pc dan tetapkan bootup kepada flash drive...enjoy sahabat.

virtual memory

virtual memoryialah satu fungsi yang terdapat dalam windows xp hingga windows vista dan windows7. ia dibina dengan mengambil sedikit space hard disk untuk dijadikan RAM MAYA.dengan adanya virtual memory dapat membantu dalam kelajuan pc.jika fungsi ini tidak digunakan ia akan mengakibatkan komputer kita slow...

Nak bace file dalam tape backup

Task: Use tar command to backup /data and /home directory

Usually /dev/rmt/0 is tape device name.
To create a new tar file you can type:
# tar cvf home-back.tar /home /data /etc/file1

To create a new tape backup use:
# tar cvf /dev/rmt/0 /home /data /etc/file1
Task: Display the contents of a tar file/tape

Pass tvf option to tar command:
# tar tvf home-back.tar
OR
# tar tvf /dev/rmt/0
Task: Restore files from tar file / tape

To extract the tar file to the current directory type:
# tar xvf home-back.tar
# tar xvf /dev/rmt/0

Understanding tar command options:

* x : Extract tar file
* v : Verbose
* f : filename : Use to specify file name / tape device name
* t : List tar file contents

Task: Backup files with cpio command

You can also use cpio command, which copies files into and out of a cpio archive. The cpio archive may span multiple volumes. The -i, -o, and -p options select the action to be performed. For example copy all *.c files to tape device or file called prog.cpio:
# ls *.c | cpio -oVc > /dev/rmt/0
OR
# ls *.c | cpio -oVc > prog.cpio
Task: Restore file using cpio

To copy from tape back to a directory, use the command as follows:
# cpio -icvD < /dev/rmt/0
OR
# cpio -icvum < /dev/rmt/0
Task: View the contents of cpio

Use the command as follows:
# cpio -ict < /dev/rmt/0

Understanding cpio command options:

* i : (copy in) Reads an archive from the standard input and conditionally extracts the files contained in it and places them into the current directory tree.
* c : Reads or writes header information in ASCII character form for portability.
* t : Prints a table of contents of the input.
* o : (copy out) Reads a list of file path names from the standard input and copies those files to the standard output in the form of a cpio archive.
* v : Verbose
* u : Use for an unconditional copy; old files will not replace newer versions.
* m ; Retains previous file modification time.
* d: Create as many directories as needed.



tar tvf /dev/rmt/0

Sunday, April 19, 2009

ape yg perlu ada kalau kita pakai windows vista

sesiapa nak pakai win vista pc kita kene ambil tau spek2 pc kita..ni syor saya kepada pembaca sekelian..

prosessor pentium4 keatas
Ram sekurangnya 2GB keatas
hard disk sekurangnya 15GB keatas
grafik card

tu je lah
Windows vista ni pakai grafik yang tinggi

firewall

firewal merupakan satu bentuk keselamatan dalam rangkaian komputer...keselamatan dari ancaman virus dan dari digodam atau di remote..
pada masa kini firewall digunakan di jabatan kerajaan,dan compeny2 besar

os yg biasa digunakan dalam setup firewall ialah linux..
sebab dengan linux kita mudah setting firewall..
dgn ada firewall kita x perlu risau lagi.
yang banyak digunakan ialah firewall panda k..

Thursday, April 16, 2009

perkakasan network

antara perkakasan network yg saya tahu lah selain sever
router
switch
hub
cat5/6
utp cable
fiber optic
coxial cable
dan lain - lain
ni lah yg sy dpt bgtau nak terangkan model2 barang2 diatas banyak..
kalau ada komen blh ajukan....

penerangan sedikit tentang network..

network ni skop die besar p sy bagi serba sedikit penerangan tentang network
network ada byk pecahan
LAN - Local area network
WAN - world area network

LAN ni lebih kepada network dalam satu bangunan.
dalam LAN banyak pecahan iaitu topology

ring - all computers are connected via single cable.However,the ends are not
terminated and the cable form a full loop connecting the last computer
to the first computer.
star - all computer connect to centralized hub via cable sagment. star is the most
popular network configuration in use today
bus - all computers are connected via single cable that run to all pc
mesh - all computer on the network aredirectly connected to every other computer
on the computer.

paham tak? kalau x paham cari lah kamus...x pun poi boli kek kodai.

Thursday, April 2, 2009

masalah network

soalan : ip conflict
jawapan : mungkin ada pc lain yg guna ip address pc kita.ia memyebabkan gangguan dalam
menggunakan internet mahu pun sistem.kene pakai ip adress lain

soalan : apakah itu looping
jawapan : looping berlaku apabila menyambung kan utp cable dari switch
ke swicth.apabila loping berlaku network akan slow..connection down..

soalan : internet slow
jawapan : sama ada serangan virus,,router down..firewall problum.

soalan : berapa jenis cable utp cable
jawapan : ada byk jenis cable seperti utp cable , fiber optik ,coxialcable,fiber,dll

soalan : osi model
jawapan : cari nota cisco

persoalan

soalan : mcmane nak lajukan pc
jawapan: tambah ram,seting pada registery,buat diskcleanup, defragment

soalan : apekah perisian sumber terbuka
jawapan: linux,unix,ubuntu,suse,redhard,open office,solaris
selebihnya buka website (mampu)

soalan : penerangan tentang virtual memory
jawapan: virtual memory hanya ada dalam windows xp ke vista.ia membantu dalam
kelajuan windows dan jika kita off kan kita akan dapati pc kita slow.

soalan: penerangan tentang ram
jawapn: ram (random acsess memory) adalah memory dalam komputer,ia mempunyai banyak
jenis,iainya ialah:
SDRAM 128MB /256MB/512MB/1GB/2GB
DDR 128MB /256MB/512MB/1GB/2GB
DDR2 128MB /256MB/512MB/1GB/2GB
DDR3 128MB /256MB/512MB/1GB/2GB
Kelajuan chache
557mhz / 667mhz /800mhz

psoalan : penerangan tentang hard disk
jawapan : hard disk merupakan storage untuk menyimpan data.
hard disk mempunyai 2 jenis
skazi hard disk ini khas untuk server SUN sahaja yang pakai OS UNIX
IDE model lama pentium 3 ke bawah
SATA model baru pentium 4 ke intel core ke atas
hard disk sata lagi laju dari hard disk ide.sekarang hard disk mencecah sampai 2TB


soalan : terangkan tentang cdrom drive
jawapan: cd rom drive cdrom/cdrw/dvdrom/dvdrw/cdrw&dvd combo/blueray dvdrw&cdrw/

persoalan

mengetahui kerosakkan komputer yg biasa berlaku

kalau kita tgk siptom2 ni selalu berlaku:
siptom : Bila on komputer tiada paparan pada skrin
jawapan: ram kene buka dan pasang balik.
cek cable penyambungan moniter ke pc.
miungkin motherboard bermasalah.

siptom : pc boleh on tapi tak boleh boot windows
jawapan: file system windows corrupt.kene buat repair windows

siptom : bila on pc tiada paparan,padahal power supply ok,moniter ok pc.
jawapan: kalau tak da paparan bios masa on pc bios ada masalah.,,tak pun motherboard
problum.

siptom : on je pc tempature pc tinggi
jawapan: periksa kipas cpu,sama ada ada habuk,,cek tempature dalam sistem bios

siptom : lupa password bila on pc (bios)
jawapan: cabut bateri pada bios biar 5 minit pastu pasang balik
ubah jumper bios pada motherboard.

siptom : bunyi bip berulangkali bila pc di onkan.
on pc bunyi fan dalam cpu laju sangat signal lampu berkelip - kelip
jawapan: cabut ram dan pasang balik

siptom : bila on pc paparan pada moniter (LCD) mcm tembak-tembak dalam 20 minit baru
paparan ok
jawapan: moniter bermasalah..salah satu tanda moniter nak rosak kita akan nampak
tembakan cahaya pada skrin moniter (LCD) pada 3 tempat..x lama tu doh

siptom : lupa password logon windows
jawapan: create satu bootdisk tuk reset pasword

siptom : masa masuk windows pc terpadam atau cepat hang bila lepas format
jawapan : banyak siptom die mungkin:
tempature pc tinggi,
mungkin hard disk problum.

siptom : tiba - tiba paparan skrin biru masa buat kerja atau lepas install
software @ driver
jawapan: windows tidak support software tersebut
file windows corrupt.

siptom : cpu problum lepas upgrade ram
jawapan: motherboard x suport ram tersebut,atau kapasiti ram tak sama dgn ram yang
sedia ada.contoh:
DDR2 256 MB 667 MHZ
DDR2 256 MB 552 MHZ
motherboard support ram xx MB 552 MHZ,kalau tambah ram yg 667mhz motherboard mungkin tak boleh support ram tersebut

siptom ; pc x dapat detec hard disk (laptop hp)
jawapan: kene cari driver sata kat internet pastu install balik.tak pun buat satu cd
os letak driver sata kat dalamnya..guna software nlite

selamat berjaya sahabatku

tahniah dapat interview juruteknik komputer jawablah betul2 bila ditanya...huhuhuu
aku akan bag serba sedikit nota sebagai rujukan.

Wednesday, April 1, 2009

command mysql

Note that all text commands must be first on line and end with ';'
? (\?) Synonym for `help'.
clear (\c) Clear command.
connect (\r) Reconnect to the server. Optional arguments are db and host.
delimiter (\d) Set statement delimiter. NOTE: Takes the rest of the line as
new delimiter.
edit (\e) Edit command with $EDITOR.
ego (\G) Send command to mysql server, display result vertically.
exit (\q) Exit mysql. Same as quit.
go (\g) Send command to mysql server.
help (\h) Display this help.
nopager (\n) Disable pager, print to stdout.
notee (\t) Don't write into outfile.
pager (\P) Set PAGER [to_pager]. Print the query results via PAGER.
print (\p) Print current command.
prompt (\R) Change your mysql prompt.
quit (\q) Quit mysql.
rehash (\#) Rebuild completion hash.
source (\.) Execute an SQL script file. Takes a file name as an argument.
status (\s) Get status information from the server.
system (\!) Execute a system shell command.
tee (\T) Set outfile [to_outfile]. Append everything into given
outfile.
use (\u) Use another database. Takes database name as argument.
charset (\C) Switch to another charset. Might be needed for processing
binlog with multi-byte charsets.
warnings (\W) Show warnings after every statement.
nowarning (\w) Don't show warnings after every statement.


Each command has both a long and short form. The long form is not case sensitive; the short form is. The long form can be followed by an optional semicolon terminator, but the short form should not.

The use of short-form commands within multi-line /* ... */ comments is not supported.

help [arg], \h [arg], \? [arg], ? [arg]


Displays a help message listing the available mysql commands.

If you provide an argument to the help command, mysql uses it as a search string to access server-side help from the contents of the MySQL Reference Manual. For more information, see Section 4.5.1.3, “mysql Server-Side Help”.

charset charset_name, \C charset_name

The charset command changes the default character set and issues a SET NAMES statement. This enables the character set to remain synchronized on the client and server if mysql is run with auto-reconnect enabled (which is not recommended), because the specified character set is used for reconnects. This command was added in MySQL 5.0.19.

clear, \c

Clears the current input. Use this if you change your mind about executing the statement that you are entering.

connect [db_name host_name]], \r [db_name host_name]]

Reconnects to the server. The optional database name and hostname arguments may be given to specify the default database or the host where the server is running. If omitted, the current values are used.

delimiter str, \d str

The delimiter command changes the string that mysql interprets as the separator between SQL statements. The default is the semicolon character (“;”). You should avoid the use of the backslash (“\”) character within the delimiter because that is the escape character for MySQL.

When the delimiter recognized by mysql is set to something other than the default of “;”, instances of that character are sent to the server without interpretation. However, the server itself still interprets “;” as a statement delimiter and processes statements accordingly. This behavior on the server side comes into play for multiple-statement execution (see Section 24.7.9, “C API Handling of Multiple Statement Execution”), and for parsing the body of stored procedures and functions and triggers (see Section 12.1.8, “CREATE PROCEDURE and CREATE FUNCTION Syntax”).

edit, \e

Edits the current input statement. mysql checks the values of the EDITOR and VISUAL environment variables to determine which editor to use. The default editor is vi if neither variable is set.

The edit command works only in Unix.

ego, \G

Sends the current statement to the server to be executed and displays the result using vertical format.

exit, \q

Exits mysql.

go, \g

Sends the current statement to the server to be executed.

nopager, \n

Disables output paging. See the description for pager.

The nopager command works only in Unix.

notee, \t

Disables output copying to the tee file. See the description for tee.

nowarning, \w

Enables display of warnings after each statement. This command was added in MySQL 5.0.6.

pager [command], \P [command]

By using the --pager option when you invoke mysql, it is possible to browse or search query results in interactive mode with Unix programs such as less, more, or any other similar program. If you specify no value for the option, mysql checks the value of the PAGER environment variable and sets the pager to that.

Output paging can be enabled interactively with the pager command and disabled with nopager. The command takes an optional argument; if given, the paging program is set to that. With no argument, the pager is set to the pager that was set on the command line, or stdout if no pager was specified.

Output paging works only in Unix because it uses the popen() function, which does not exist on Windows. For Windows, the tee option can be used instead to save query output, although it is not as convenient as pager for browsing output in some situations.

print, \p

Prints the current input statement without executing it.

prompt [str], \R [str]

Reconfigures the mysql prompt to the given string. The special character sequences that can be used in the prompt are described later in this section.

If you specify the prompt command with no argument, mysql resets the prompt to the default of mysql>.

quit, \q

Exits mysql.

rehash, \#

Rebuilds the completion hash that enables database, table, and column name completion while you are entering statements. (See the description for the --auto-rehash option.)

source file_name, \. file_name

Reads the named file and executes the statements contained therein. On Windows, you can specify pathname separators as / or \\.

status, \s

The status command provides some information about the connection and the server you are using. If you are running in --safe-updates mode, status also prints the values for the mysql variables that affect your queries.

system command, \! command

Executes the given command using your default command interpreter.

The system command works only in Unix.

tee [file_name], \T [file_name]

By using the --tee option when you invoke mysql, you can log statements and their output. All the data displayed on the screen is appended into a given file. This can be very useful for debugging purposes also. mysql flushes results to the file after each statement, just before it prints its next prompt.

You can enable this feature interactively with the tee command. Without a parameter, the previous file is used. The tee file can be disabled with the notee command. Executing tee again re-enables logging.

use db_name, \u db_name

Uses db_name as the default database.

warnings, \W

Enables display of warnings after each statement (if there are any). This command was added in MySQL 5.0.6.

Here are a few tips about the pager command:

You can use it to write to a file and the results go only to the file:

mysql> pager cat > /tmp/log.txt
You can also pass any options for the program that you want to use as your pager:

mysql> pager less -n -i -S
In the preceding example, note the -S option. You may find it very useful for browsing wide query results. Sometimes a very wide result set is difficult to read on the screen. The -S option to less can make the result set much more readable because you can scroll it horizontally using the left-arrow and right-arrow keys. You can also use -S interactively within less to switch the horizontal-browse mode on and off. For more information, read the less manual page:

shell> man less
The -F and -X options may be used with less to cause it to exit if output fits on one screen, which is convenient when no scrolling is necessary:

mysql> pager less -n -i -S -F -X
You can specify very complex pager commands for handling query output:

mysql> pager cat | tee /dr1/tmp/res.txt \
| tee /dr2/tmp/res2.txt | less -n -i -S
In this example, the command would send query results to two files in two different directories on two different filesystems mounted on /dr1 and /dr2, yet still display the results onscreen via less.

You can also combine the tee and pager functions. Have a tee file enabled and pager set to less, and you are able to browse the results using the less program and still have everything appended into a file the same time. The difference between the Unix tee used with the pager command and the mysql built-in tee command is that the built-in tee works even if you do not have the Unix tee available. The built-in tee also logs everything that is printed on the screen, whereas the Unix tee used with pager does not log quite that much. Additionally, tee file logging can be turned on and off interactively from within mysql. This is useful when you want to log some queries to a file, but not others.



\c A counter that increments for each statement you issue
\D The full current date
\d The default database
\h The server host
\l The current delimiter (new in 5.0.25)
\m Minutes of the current time
\n A newline character
\O The current month in three-letter format (Jan, Feb, …)
\o The current month in numeric format
\P am/pm
\p The current TCP/IP port or socket file
\R The current time, in 24-hour military time (0-23)
\r The current time, standard 12-hour time (1-12)
\S Semicolon
\s Seconds of the current time
\t A tab character
\U Your full user_name@host_name account name
\u Your username
\v The server version
\w The current day of the week in three-letter format (Mon, Tue, …)
\Y The current year, four digits
\y The current year, two digits
\_ A space
\ A space (a space follows the backslash)
\' Single quote
\" Double quote
\\ A literal “\” backslash character
\x x, for any “x” not listed above

You can set the prompt in several ways:

Use an environment variable. You can set the MYSQL_PS1 environment variable to a prompt string. For example:

shell> export MYSQL_PS1="(\u@\h) [\d]> "
Use a command-line option. You can set the --prompt option on the command line to mysql. For example:

shell> mysql --prompt="(\u@\h) [\d]> "
(user@host) [database]>
Use an option file. You can set the prompt option in the [mysql] group of any MySQL option file, such as /etc/my.cnf or the .my.cnf file in your home directory. For example:

[mysql]
prompt=(\\u@\\h) [\\d]>\\_
In this example, note that the backslashes are doubled. If you set the prompt using the prompt option in an option file, it is advisable to double the backslashes when using the special prompt options. There is some overlap in the set of allowable prompt options and the set of special escape sequences that are recognized in option files. (These sequences are listed in Section 4.2.3.2, “Using Option Files”.) The overlap may cause you problems if you use single backslashes. For example, \s is interpreted as a space rather than as the current seconds value. The following example shows how to define a prompt within an option file to include the current time in HH:MM:SS> format:

[mysql]
prompt="\\r:\\m:\\s> "
Set the prompt interactively. You can change your prompt interactively by using the prompt (or \R) command. For example:

mysql> prompt (\u@\h) [\d]>\_
PROMPT set to '(\u@\h) [\d]>\_'
(user@host) [database]>
(user@host) [database]> prompt
Returning to default PROMPT of mysql>
mysql>