About

Information is always Worth to save ...

Wednesday, December 9, 2009

Setup xwin on Windows for Linux Desktop


Configure the SSH terminal like shown on the image.
Now you should have Cygwin installed on your
Windows Machine.
Now Run the below command,

Xwin -clipboard -multiwindow

and on SSH Terminal you can run firefox or any application which will be shown on Windows Machine.

Post a Message to all users - Ubuntu

Using Wall
##########
echo 'Add the Message here' > test.txt
wall < test.txt
Now its been broad casted to all the users who are using the Server

Tuesday, November 3, 2009

Create a list of installed packages

I found out how to do this recently and thought it might be helpful to some people. To output this information to a file in your home directory you would use,
Code:
dpkg --get-selections > installed-softwareAnd if you wanted to use the list to reinstall this software on a fresh ubuntu setup,
Code:dpkg --set-selections < installed-softwarefollowed by
Code:dselect

Thursday, October 15, 2009

scsi-idle script

#!/usr/bin/perl -w
$statfile = "/proc/diskstats";
die "$0: Cannot read $statfile\n" unless -r $statfile;

$| = 1;
($disk, $interval) = (@ARGV);
$disk =~ s,/dev/,,;
print "$0: disk: $disk, interval: $interval\n";

$halted_data = $last_seen = '';
while (1) {
open(STATUS, $statfile);
($_) = grep(/^\s+\d+\s+\d+\s+$disk\s/o, );
close STATUS;

if ($last_seen eq $_ && $halted_data ne $_) {
print "Spinning down: $disk\n";
# system "./scsi-stop /dev/$disk stop";
system "sg_start -stop /dev/$disk";
$halted_data = $_;
}
$last_seen = $_;
sleep $interval;
}

Tuesday, March 31, 2009

Generating a patch

If you need to generate a patch file for a set of file(s) residing in a directory structure or just for one file, then you can use "diff" command. You can find a very nice article in Linux Magazine named "What's the diff?". Basically, this command finds out the difference between two files.

If you want to generate a patch for a directory structure:
diff -rau "old_dir" "modified_dir" > "patch_file"

r: recursive
a: treat all files as text.
u: Output NUM (default 3) lines of unified context.
In case of two file, ignoring -r would be enough.