Thursday, December 17, 2009
Domain woes - resolved
The step by step procedure on how to go about it is given in Google itself. https://www.google.com/adsense/support/bin/answer.py?answer=76049
P:S - my domain is http://autumn.co.in and the www is kept parked as of now and http://sarathainside.blogspot.com will automatically redirect to http://blog.autumn.co.in
Friday, April 17, 2009
Linux.com is Relaunching
The Linux Foundation is taking over Linux.com. We couldn't be more excited to work with you on building a community resource for Linux users worldwide.
For the community, by the community, Linux.com will be the central source for Linux information, software, documentation and answers across the server, desktop/netbook, mobile, and embedded areas.
Much like Linux itself, Linux.com will rely on the community to create and drive the content and conversation. While the Linux Foundation will provide the collaborative forum, we hope you - the real experts on Linux - will provide the content. Starting now, we'd like to hear your suggestions on what you'd like to see in the new Linux.com. We've created an IdeaForge for you to post, vote and discuss these ideas.
wonder what they will come up with .
Saturday, January 26, 2008
Reset MYSQL/PHPMYADMIN Password in Linux
$ /etc/init.d/mysql stop |
$ ps waux |
2102 32523 ... /bin/sh /usr/local/mysql/bin/safe_mysqld ... 2102 32557 ... /usr/local/mysql/libexec/mysqld --basedir= ... |
kill -9 32523 |
$ /usr/bin/mysqld_safe --skip-grant-tables |
$ /usr/bin/mysql |
use mysql; |
UPDATE user SET Password=PASSWORD('YOUR_PASSWORD_HERE') WHERE Host='localhost' AND User='root'; |

$ /etc/init.d/mysql restart |
Wednesday, December 12, 2007
VI - Some useful commands
- a enter insert mode, the characters typed in will be inserted after the current cursor position.
- h move the cursor to the left one character position.
- i enter insert mode, the characters typed in will be inserted before the current cursor position.
- j move the cursor down one line.
- k move the cursor up one line.
- l move the cursor to the right one character position.
- r replace one character under the cursor. Specify count to replace a number of characters
- u undo the last change to the file. Typing u again will re-do the change.
- x delete character under the cursor.
- yy yank until , putting the result into a buffer. "yy" yanks the current line. a count yanks that many lines. The buffer can be specified with the " command. If no buffer is specified, then the general buffer is used.
- p paste
- o Enter insert mode in a new line below the current cursor position.
- % Move the cursor to the matching parenthesis or brace.
- / Search the file downwards for the string specified after the /
- ? Search the file upwards for the string specified after the ?.
- ~ Switch the case of the character under the cursor.
- R Replace characters on the screen with a set of characters entered, ending with the Escape key.
- S Change an entire line.
My browser crashed atleast three times while writing this blog! That's VI
Thursday, December 6, 2007
All about Linux swap space
When your computer needs to run programs that are bigger than your available physical memory, most modern operating systems use a technique called swapping, in which chunks of memory are temporarily stored on the hard disk while other data is moved into physical memory space. Here are some techniques that may help you better manage swapping on Linux systems and get the best performance from the Linux swapping subsystem.
Linux divides its physical RAM (random access memory) into chucks of memory called pages. Swapping is the process whereby a page of memory is copied to the preconfigured space on the hard disk, called swap space, to free up that page of memory. The combined sizes of the physical memory and the swap space is the amount of virtual memory available.
Swapping is necessary for two important reasons. First, when the system requires more memory than is physically available, the kernel swaps out less used pages and gives memory to the current application (process) that needs the memory immediately. Second, a significant number of the pages used by an application during its startup phase may only be used for initialization and then never used again. The system can swap out those pages and free the memory for other applications or even for the disk cache.
However, swapping does have a downside. Compared to memory, disks are very slow. Memory speeds can be measured in nanoseconds, while disks are measured in milliseconds, so accessing the disk can be tens of thousands times slower than accessing physical memory. The more swapping that occurs, the slower your system will be. Sometimes excessive swapping or thrashing occurs where a page is swapped out and then very soon swapped in and then swapped out again and so on. In such situations the system is struggling to find free memory and keep applications running at the same time. In this case only adding more RAM will help.
Linux has two forms of swap space: the swap partition and the swap file. The swap partition is an independent section of the hard disk used solely for swapping; no other files can reside there. The swap file is a special file in the filesystem that resides amongst your system and data files.
To see what swap space you have, use the command swapon -s
. The output will look something like this:
Filename Type Size Used Priority
/dev/sda5 partition 859436 0 -1
Each line lists a separate swap space being used by the system. Here, the 'Type' field indicates that this swap space is a partition rather than a file, and from 'Filename' we see that it is on the disk sda5. The 'Size' is listed in kilobytes, and the 'Used' field tells us how many kilobytes of swap space has been used (in this case none). 'Priority' tells Linux which swap space to use first. One great thing about the Linux swapping subsystem is that if you mount two (or more) swap spaces (preferably on two different devices) with the same priority, Linux will interleave its swapping activity between them, which can greatly increase swapping performance.
To add an extra swap partition to your system, you first need to prepare it. Step one is to ensure that the partition is marked as a swap partition and step two is to make the swap filesystem. To check that the partition is marked for swap, run as root:
fdisk -l /dev/hdb
Replace /dev/hdb with the device of the hard disk on your system with the swap partition on it. You should see output that looks like this:
Device Boot Start End Blocks Id System
/dev/hdb1 2328 2434 859446 82 Linux swap / Solaris
If the partition isn't marked as swap you will need to alter it by running fdisk and using the 't' menu option. Be careful when working with partitions -- you don't want to delete important partitions by mistake or change the id of your system partition to swap by mistake. All data on a swap partition will be lost, so double-check every change you make. Also note that Solaris uses the same ID as Linux swap space for its partitions, so be careful not to kill your Solaris partitions by mistake.
Once a partition is marked as swap, you need to prepare it using the mkswap (make swap) command as root:
mkswap /dev/hdb1
If you see no errors, your swap space is ready to use. To activate it immediately, type:
swapon /dev/hdb1
You can verify that it is being used by running swapon -s
. To mount the swap space automatically at boot time, you must add an entry to the /etc/fstab file, which contains a list of filesystems and swap spaces that need to be mounted at boot up. The format of each line is:
Since swap space is a special type of filesystem, many of these parameters aren't applicable. For swap space, add:
/dev/hdb1 none swap sw 0 0
where /dev/hdb1 is the swap partition. It doesn't have a specific mount point, hence none. It is of type swap with options of sw, and the last two parameters aren't used so they are entered as 0.
To check that your swap space is being automatically mounted without having to reboot, you can run the swapoff -a
command (which turns off all swap spaces) and then swapon -a
(which mounts all swap spaces listed in the /etc/fstab file) and then check it with swapon -s
.
Swap file
As well as the swap partition, Linux also supports a swap file that you can create, prepare, and mount in a fashion similar to that of a swap partition. The advantage of swap files is that you don't need to find an empty partition or repartition a disk to add additional swap space.
To create a swap file, use the dd command to create an empty file. To create a 1GB file, type:
dd if=/dev/zero of=/swapfile bs=1024 count=1048576
/swapfile is the name of the swap file, and the count of 1048576 is the size in kilobytes (i.e. 1GB).
Prepare the swap file using mkswap
just as you would a partition, but this time use the name of the swap file:
mkswap /swapfile
And similarly, mount it using the swapon command: swapon /swapfile
.
The /etc/fstab entry for a swap file would look like this:
/swapfile none swap sw 0 0
How big should my swap space be?
It is possible to run a Linux system without a swap space, and the system will run well if you have a large amount of memory -- but if you run out of physical memory then the system will crash, as it has nothing else it can do, so it is advisable to have a swap space, especially since disk space is relatively cheap.
The key question is how much? Older versions of Unix-type operating systems (such as Sun OS and Ultrix) demanded a swap space of two to three times that of physical memory. Modern implementations (such as Linux) don't require that much, but they can use it if you configure it. A rule of thumb is as follows: 1) for a desktop system, use a swap space of double system memory, as it will allow you to run a large number of applications (many of which may will be idle and easily swapped), making more RAM available for the active applications; 2) for a server, have a smaller amount of swap available (say half of physical memory) so that you have some flexibility for swapping when needed, but monitor the amount of swap space used and upgrade your RAM if necessary; 3) for older desktop machines (with say only 128MB), use as much swap space as you can spare, even up to 1GB.
The Linux 2.6 kernel added a new kernel parameter called swappiness to let administrators tweak the way Linux swaps. It is a number from 0 to 100. In essence, higher values lead to more pages being swapped, and lower values lead to more applications being kept in memory, even if they are idle. Kernel maintainer Andrew Morton has said that he runs his desktop machines with a swappiness of 100, stating that "My point is that decreasing the tendency of the kernel to swap stuff out is wrong. You really don't want hundreds of megabytes of BloatyApp's untouched memory floating about in the machine. Get it out on the disk, use the memory for something useful."
One downside to Morton's idea is that if memory is swapped out too quickly then application response time drops, because when the application's window is clicked the system has to swap the application back into memory, which will make it feel slow.
The default value for swappiness is 60. You can alter it temporarily (until you next reboot) by typing as root:
echo 50 > /proc/sys/vm/swappinessIf you want to alter it permanently then you need to change the vm.swappiness parameter in the /etc/sysctl.conf file
Conclusion
Managing swap space is an essential aspect of system administration. With good planning and proper use swapping can provide many benefits. Don't be afraid to experiment, and always monitor your system to ensure you are getting the results you need.
Sunday, March 18, 2007
The 15 Essential UNIX commands
The 15 Essential UNIX commands
- man - show manual for a command, example: ‘
man ls’
hit ‘q’
to exit the man page. - cd - change directory, example:
cd /etc/
- ls - list directory, similar to
dir
on windows. example:ls /etc
, ‘use’ls -l /etc
to see more detail - cp - copy a file or directory, example:
cp source dest
if you want to copy a directory use the-R
option for recursive:cp -R /source /dest
- mv - move a file, example:
mv source dest
- rm - remove a file, example:
rm somefile
to remove a directory you may need the -R option, you can also use the -f option which tells it not to confirm each file:rm -Rf /dir
- cat - concatenate, or output a file
cat /var/log/messages
- more - outputs one page of a file and pauses. example: ‘
more /var/log/messages’
press ‘q
‘to exit before getting to the bottom. You can also pipe to more| more
from other commands, for example ‘ls -l /etc | more
‘ - scp - secure copy, copies a file over SSH to another server. example: ‘
scp /local/file user@host.com:/path/to/save/file’
- tar - tape archiver, tar takes a bunch of files, and munges them into one
.tar
file, the files are often compressed with the gzip algorithm, and use the.tar.gz
extension. to create a tartar -cf archive.tar /directory
, then to extract the archive to the current directory runtar -xf archive.tar
to use gzip, just add az
to the options, to create a tar.gz:tar -czf archive.tar.gz /dir
to extract ittar -xzf archive.tar.gz
- grep - pattern matcher, grep takes a regular expression, or to match a simple string you can use fast grep,
fgrep failure /var/log/messages
, I'm usually just looking for a simple pattern so I tend to use fgrep more than regular grep. - find - lists files and directories recursively on a single line, I usually pipe grep into the mix when I use find, eg:
find / | fgrep log
- tail - prints the last few lines of a file, this is handy for checking log files
tail /var/log/messages
if you need see more lines, use the-n
option,tail -n 50 /var/log/messages
you can also use the-f
option, which will continuously show you the end of the file as things are added to it (very handy for watching logs)tail -f /var/log/messages
- head - same as tail, but shows the first few lines the file
- vi - text editor, there are several text editors such as emacs, and nano, but vi is usually installed on any server so its a good one to learn. To edit a file type
vi file
to edit a line pressEsc i
then to save changes and exit useEsc wq
, or to quit without saving useEsc q!
. There are a million other commands, but that will enable you to edit files at a basic level.
Monday, February 12, 2007
New Linux Kernel Will Increase Intellectual Superiority
Santa Clara, CA - A recent survey of Linux users found that the two main factors in their migration to Linux was its stability and that it made them feel intellectually superior. Developers promise that along with USB support there will be increased intellectual superiority in the upcoming 2.4 kernel release AKA the "Hubris" kernels.
"Many users complained that in our previous release that we sacrificed some intellectual superiority in the name of 'ease of use'. We aren't going to make that mistake in this release," said kernel programmer Johan Klens.
"Programmers have worked very hard in the latest kernel release trying to make even simple tasks more difficult," continued Mr. Klens, "This release is going to include the "ocsh" - the obfuscated C shell, sure to be a favorite of intellectual superiors. In addition to inputting commands as obfuscated C code, users can also input commands in binary directly to the registers. It took me 10 minutes to code the directions to 'cat' using ocsh, but it was worth it!"
"I was impressed by the stability of Linux," said Thomas Azizi "and since I'm a loser in pretty much every other facet of my life, gloating about my OS choice makes me feel great."
"Let's face it. Linux isn't for dummies," said Linux advocate Dieter Braun, "There may have been a Linux for Dummies book, but I doubt it sold a single copy. I'm sure Windows for Dummies was a best seller."
Tuesday, February 6, 2007
Tryst with ubuntu 6.06
the cd has some problem with it , its getting stuck . Work around - partition using the applicaion in the live cd called 'gpart'.
installed the system after a week long exercise.
There's nothing inside ,No music players ... not even a 'gcc'. everything must be downloaded.
Need to install java - how?
Applications->system->synaptic manager.
Sorry nothing there remotely connected to java. I downloaded and installed everything that began with java... , no use . (i was looking for javac - java compiler).
Wasted some 30 Mbs.
Began searching for "ubuntu 6.06 - install java" most of them were .deb files. absolutely no use ,full kachara , kept on searching - found this out but it cost me a 100Mbs worth download but voila java is home.
install java my way --->
On Debian/Ubuntu Linux for example all you need to do is make sure that your apt-get is pointed at the right place. In your /etc/apt/sources.list add in the following (and make sure you are okay with adding in stuff that is not in the default environment).
( you need to login as root for editing this file since otherwise its read only , and no the 'su' aint working ,so dont bother with that.How do you login as root? I HAVE NO IDEA. but booting in ubuntu recovery mode logs you in as root. But is that acceptable? and what about security? )
deb http://us.archive.ubuntu.com/ubuntu dapper main restricted
deb http://us.archive.ubuntu.com/ubuntu dapper universe multiverse
After this have apt updates its repository
sudo apt-get update (sudo is working fine though)
And finally, just tell it to install java :)
sudo apt-get install sun-java5-jdk
After this the rest of the process will display a dialog that will require you to accept the license agreement. When you do, the rest of the setup will happen on its own.
When you're on the command prompt type
javac -version
or
java -version
You should be good to go! Finally we have an easy way to install Java on the various Linux variants without having to fight with fakeroot and the other foolishness. Took Sun a criminally long time to do this, but I (not me - i have reasons to think otherwise) certainly thank them for it.
About Me
- sarath-a
- i am sarath a.This blog enlists motivational or inspirational works. GO For Maximum mischief.