2007年6月21日星期四

Some weeks ago, I have showed two small tips to tweak your Ubuntu Linux. The first one is to disable IPv6 and the second one is to reduce swapping. Today, I have another tip to make your gnome menus run faster.

1. Create a file named .gtkrc-2.0 in your home directory

cdtouch .gtkrc-2.0echo "gtk-menu-popup-delay = 0"| tee -a .gtkrc-2.0

2. Logout and login again

I have tested with a value gtk-menu-popop-delay = 2000 before to try gtk-menu-popop-delay = 0 to see what is different in effect.read more

Adopt 10 good habits that improve your UNIX command line efficiency and break away from bad usage patterns in the process. This article takes you step-by-step through several good, but too often neglected, techniques for command-line operations. Learn about common errors and how to overcome them.

2007年6月16日星期六

This tutorial will walk you through the steps on how to install a DLL file in to Windows. This tutorial covers all Windows operating systems.The first post about windows, I didn't mean to but the article is really useful 'cause I met the problem so many times when I use xp!

All modern operating systems are able to run many programs at the same time. For example, a typical Linux server might include a Web server, an email server, and probably a database service. Each of these programs runs as a separate process. What do you do if one of your services stops working? Here are some handy command-line tools for managing processes.

Each process uses time on a system's CPU, as well as other system resources such as memory and disk space. If a program goes wrong, it can start to use too much CPU time or memory and so deny other programs the resources they need to run.

Knowing how to manage rogue processes is an essential part of Linux system management. To help, turn to command-line tools such as ps, top, service, kill, and killall.

ps

ps shows the current processes running on the machine. ps has many options, but one of the most useful invocations is ps aux, which shows every process on the system.

A normal Linux server may have 100 processes running after boot up, so the output from the ps command can be quite long. Here are the first few lines from my CentOS 5 test machine:

USER is the name of the user that owns the processes.Each process has a unique process ID (or PID for short).%CPU shows the CPU utilization of the process. It is the CPU time used divided by the time the process has been running expressed as a percentage.%MEM is the amount of the physical memory the process is using.VSZ show the virtual memory size of the process in kilobytes.RSS is similar to VSZ, but rather than virtual memory size, RSS shows how much non-swapped, physical memory the process is using in kilobytes.TTY is the controlling terminal.STAT is the status of the process, where S means the process is sleeping and can be woken at any time, N means the process has a low priority, and < means the process has a high priority. Other letters to watch for are l which means the process is multi-threaded and R which means the processes is running.START shows when the process was started.TIME is the accumulated CPU time. This includes time spent running the processes and time spent in the kernel on behalf of that process.

For a complete explanation see the ps man page.

Finding a specific process in such a long list can be a problem. To help, you can use the grep command to look for matches in the text. For example, to look for the sendmail process, use the command:

When you run it, the grep command itself will be shown (in this case PID 3807) as it matches the string we are looking for, namely sendmail. But of course it isn't part of the sendmail service.

top

While ps shows only a snapshot of the system process, the top program provides a dynamic real-time view of a system. It displays a system summary (with CPU usage, memory usage, and other statistics) as well as a list of running processes that changes dynamically as the system is in use. It lists the processes using the most CPU first.

The bottom part of the output is similar to the output from the ps command. In the top part, the Swap: line is useful for checking how much swap space is being used. For more information see the top man page.

service

The easiest way to start and stop services such as sendmail or the Apache Web server from the command line is to use the service command. Each service provide a script for easily starting and stopping the service.

To discover the status of a service, type service sendmail status. This should output something similar to:

sendmail (pid 4660 4652) is running...

If you want to shutdown a running sendmail, you can type service sendmail stop. To start it again, use service sendmail start. To stop and restart sendmail, use service sendmail restart.

If you can't stop a running or rogue service using the service command then you may need to resort to the kill and killall commands.

kill and killall

The kill command attempts to shut down a running process. In Linux, a process is stopped when the operating system sends it a signal telling it to shut down. The default signal for kill is TERM (signal 15), meaning software terminate. If it receives the signal, the process should shut down in an orderly way. If the process has become rogue, chances are that it won't respond to being told politely to shut down. In that case you have to send the KILL signal (signal 9 for short). So to kill off a running process (e.g. process 1234) we would use kill -9 1234.

The killall command kills running processes by name rather than by PID. This bring two immediate advantages. First, to kill a process we don't need to look for the PID using the ps command. Second, if there are multiple processes with the same name (as is the case with the Apache Web server) then all the processes will be killed in one fell swoop. As with kill, killall takes a signal parameter, and -9 is used to terminate the processes. So to kill off all the Apache processes you would use killall -9 httpd.

Restarting an unresponsive Web server

Let's look at an example of how to use these commands to solve a real-life problem. If you find that your Web server has stopped responding and needs to be restarted, first try the service command. The start/stop script for your Web server should be able to get it running again. For Apache on CentOS 5 we would type:

service httpd restart

If that fails, next try the killall command to eliminate the old instance of the Web server:

killall -9 httpd

Run ps to check that all the Apache services died:

ps aux | grep httpd

If there are any strays, kill them off individually with the kill command. Finally, restart the Web server with:

service httpd start

A friend of mine recently had problem with the fetchmail process. Fetchmail is a program that fetches mail from external mail servers and pulls them down onto the local server. One morning he discovered that his system was running slowly. A quick use of the top command revealed that the fetchmail process was using 99% of the system memory. He noted the fetchmail process's PID, then killed the process and restarted it using the service command. The memory was freed and the system sprang back to life.

Conclusion

You should monitor your system to ensure that none of your processes have gone haywire. One simple method is to permanently run a terminal window with the top command. A quick glance every so often will assure you that all is OK. If something does start to go bad, Linux provides useful tools to stop and restart processes. Only rarely will a full system reboot be needed.

With Nautilus Scripts you can convert audio files, convert and install packages, automatically convert CDs to .iso files, compile C/C++ programs for Linux/Windows, and much more. The installation is a snap -- just extract the contents of the download to $HOME/.gnome2/nautilus-scripts/ and you'll be all set. Your expanded right-click menu will automatically be created.

Nautilus Scripts is a free download and requires Gnome and Nautilus. In order to use some of the advanced features of Nautilus Scripts you'll also want to install the following packages: mingw32, wine, alien, and build-essential.

Great HOWTO explaining how to install the eyeOS 1.0 Web Operating System into a Linux system (It's for Debian, I tested it under Ubuntu). Just 4 steps and you can be working on eyeOS from any computer on the net. eyeOS is a web Operating System with a ports system like apt-get and 19 base applications to work on the browser, Open Source.

2007年6月14日星期四

The XLNTsolution weblog has a whole stash of system tweaks they recommend to speed up Ubuntu Feisty Fawn.Some of the tips include disabling IPv6, enabling parallel boot processes, reducing the load of the swap, and re-aliasing the localhost -- and that just scratches the surface. Some of the tweaks are pretty advanced!

2007年6月11日星期一

Lots of people have a love/hate relationship with their touch pad on their laptops. It’s great for speeding around your screen and doing lots of cool things with nary a mouse in site. It’s horrible when you accidentaly double-click that Quake 3 icon while your boss is strolling into the room.

Here’s a quick and easy guide to disabling tap-clicking and scrolling on your touchpad. With this little hack you’ll still have a mouse replacement, but will avoid Quake 3 inspired embarrassment.

First, you’ll need to edit your xorg.conf file. This is the file that controls your display, and oddly all of your input devices as well like your keyboard, mouse and…. touchpad. Open up a CLI (Applications-> Accessories-> Terminal) and let’s get down to business.

gksu gedit /etc/X11/xorg.conf

Now you’ve got your xorg.conf file open in an editor, let’s add one line too it. Look for this section in your xorg.conf file:

Yours may have all of this stuff or it may have very little of it. The key points you want to look for are the Section and EndSection bits. Everything has to go between these two, and what we’re going to add is not exception.

See the Options above? We’re going to add an option. So cut and paste the following in there just above the EndSection portion:

Option “TouchpadOff” 2

Now save your file and exit Gedit. The next time you restart your laptop (or restart your X session) you’re touchpad will be click-less.

But perhaps this way is so complicated and sometimes it doesn't work! Then you should try this way:

2007年6月4日星期一

Feisty has a terrible boot time on laptops compared to server (roughly 3x as long) even though it is a faster computer. You can speedup your boot time from over a minute to roughly 30 seconds by doing the following