Posts Tagged linux
More than 100% CPU in top in Linux/Mac
If you are power linux/mac user you should have noticed at least once that top shows more than 100% CPU for a process. I also have seen this multiple times but always wondered how it can be. Here is an example of how my top looked when I started my java and was doing some number crunching.
Recently I did a bit of research and got to the bottom of this. So here is the reason for it. A process is said to be using 100% CPU if it uses a processor to the limit that processor goes ie it completely uses that CPU without giving any idle/free time for that CPU. Now consider the situation that we have a multi core CPU. What if the process has more than one thread ? Well if so there is a chance that the threads can be split between two cores. So if 100% is one CPU running at maximum power, then what is one CPU at maximum power and other using 10% of its computing power? Its 100% + 10% = 110%. That’s how the magical more than 100% CPU value comes in.
Continue reading “More than 100% CPU in top in Linux/Mac” »
Automatic Command Archive
Posted by Srijith R in linux, shell scripting on August 17, 2010
The default command storing size of ubuntu is 500 commands. It stores the commands in home folder in the file “.bash_history” .
The problem is 500 commands is too short of a size.
One method is to increase the command size to a large value by changing the $HISTFILESIZE variable using the following command
Continue reading “Automatic Command Archive” »
How to Save file in vi not opened with sudo
Posted by Srijith R in linux, shell scripting, vi on August 17, 2010
It has happened to me a lot of times that i edit a file in vi. I insert and edit a lot and finally when I try to save it I find that I dont have permission for it. If only I had opened it with sudo. I found a solution for this issue. It was actually a simple command and here it is
Continue reading “How to Save file in vi not opened with sudo” »
Auto Away Notifier for Pidgin in Perl
Whenever I am away from laptop my chat buddies leave me lots message and finally lots of “You there???”. So I thought of making a script that would inform my buddies that I am away when someone sends me a message.
This method works with Pigin API.
I have used /proc/acpi/button/lid/C267/state file to find if the lib of the laptop is closed or not. This file may vary in your laptop. So try to find the find the file in your computer that stores the status of the lid. It should be a file in /proc/acpi/button/lid/ folder and replace the file accordingly in your computer.
The Content of /proc/acpi/button/lid/C267/state is state: open and state: closed when the lid was closed.
Continue reading “Auto Away Notifier for Pidgin in Perl” »
BSNL Dataone Auto Downloader
Posted by Srijith R in acpi, dataone, linux, shell scripting on August 16, 2010
Bsnl(India) provides an account that has 2am to 8am unlimited download. It was not easy to wake up at 2am and switch on the computer and sleep again. So I tried to find a method to switch on the computer automatically at 2am and download and shutdown at 8am. Although the I thought the idea was foolish, I found out that there actually is a method for doing it. “ACPI Alarm” was introduced in 1999 or so (Even my old PC had it).
Continue reading “BSNL Dataone Auto Downloader” »
Script for Auto Copying of Cds/Dvds
Posted by Srijith R in linux, shell scripting on August 15, 2010
Here is a script that i created for automatically copying all the files in cd to a folder and ejecting and waiting for the next cd.
So here is how it works.
You need to change the folder names and paths accordingly. And the shell script as
Continue reading “Script for Auto Copying of Cds/Dvds” »
Copy in Linux with Ui
Posted by Srijith R in linux, shell scripting on August 14, 2010
The program here is an UI for cp command. I have used cp in the background but over that I am just monitoring the files copied and speed of copying.
It’s not a perfected program. It’s quick one but works fine.
Execution:
Create a file named copy and insert the following code and give execute permission
Continue reading “Copy in Linux with Ui” »
Microsoft Servers in Linux
Well this is funny Microsoft has it’s ” download.microsoft.com” servers running in linux. Good going guys. You people know what’s the best suited ones. But do you know a product of yours called Windows Server edition?
Continue reading “Microsoft Servers in Linux” »
Recent Comments