Wednesday, October 12, 2011

Moving directories between filesystems.

Moving directories between filesystems.Quick way to move an entire tree of files from one disk to another 


(cd /source/directory && tar cf - . ) | (cd /dest/directory && tar xvfp -)

[ Change from cd /source/directory; tar....etc. to prevent possibility of trashing directory in case of disaster.]

Thursday, September 29, 2011

Handy Script to Clean Up Corefiles.

Handy Script to Clean Up Corefiles.


Create a file called rmcores(the author calls it handle-cores) with the following in it:

#!/bin/sh
USAGE="$0 "

if [ $# != 2 ] ; then
echo $USAGE
exit
fi

echo Deleting...
find $1 -name core -atime 7 -print -type f -exec rm {} \;

echo e-mailing
for name in `find $1 -name core -exec ls -l {} \; | cut -c16-24`
do
echo $name
cat $2 | mail $name
done

And have a cron job run it every so often.

Sunday, September 11, 2011

Reveal Passwords Using Javascript

Want to Reveal the Passwords Hidden Behind Asterisk (****) ?


Follow the steps given below-

1) Open the Login Page of any website. (eg. http://mail.yahoo.com)

2) Type your 'Username' and 'Password'.

3) Copy and paste the JavaScript code given below into your browser's address bar and press 'Enter'.


 javascript: alert(document.getElementById('Passwd').value); 


4) As soon as you press 'Enter', A window pops up showing Password typed by you..!



Note :- This trick may not be working with firefox.

Thursday, August 4, 2011

Folder Lock With Password Without Any Software


Paste the code given below in notepad and 'Save' it as batch file (with extension '.bat').
Any name will do.
Then you see a batch file. Double click on this batch file to create a folder locker.
New folder named 'Locker' would be formed at the same location.
Now bring all the files you want to hide in the 'Locker' folder. Double click on the batch file to lock the folder namely 'Locker'.
If you want to unlock your files,double click the batch file again and you would be prompted for password.
Enter the password and enjoy access to the folder.

 
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST Locker goto MDLOCKER
:CONFIRM
echo Are you sure u want to Lock the folder(Y/N)
set/p "cho=>"
if %cho%==Y goto LOCK
if %cho%==y goto LOCK
if %cho%==n goto END
if %cho%==N goto END
echo Invalid choice.
goto CONFIRM
:LOCK
ren Locker "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
echo Folder locked
goto End
:UNLOCK
echo Enter password to Unlock folder
set/p "pass=>"
if NOT %pass%==type your password here goto FAIL
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Locker
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDLOCKER
md Locker
echo Locker created successfully
goto End
:End

Tuesday, May 10, 2011

How to fix corrupted files in XP?

// Introduction //
This tutorial has been made so people that are having problems with corrupted files, can learn how to fix them easy.

// Required //
+ Windows XP operating system
+ Windows XP cd

// Right to the tutorial //
+ Place the xp cd in your cd/dvd drive
+ Go to start
+ run
+ type in 'sfc /scannow' (without the ')

Now it should all load, and fix all your corrupted file on windows XP :)
Note: The author does not take any responsibility for your actions and not responsible for any damage caused by this tutorial.

Thanks to H|LLJD00

Friday, April 29, 2011

Converting all files in a directory to lowercase.

Converting all files in a directory to lowercase.


#!/bin/sh
# lowerit
# convert all file names in the current directory to lower case
# only operates on plain files--does not change the name of directories
# will ask for verification before overwriting an existing file
for x in `ls`
do
if [ ! -f $x ]; then
continue
fi
lc=`echo $x | tr '[A-Z]' '[a-z]'`
if [ $lc != $x ]; then
mv -i $x $lc
fi
done

Wow. That's a long script. I wouldn't write a script to do that; instead, I would use this command:

for i in * ; do [ -f $i ] && mv -i $i `echo $i | tr '[A-Z]' '[a-z]'`;
done;

on the command line.

How do i give users an ftp only account (no telnet, etc)?

How do i give users an ftp only account (no telnet, etc).?


give them shell which doesn't work, but is listed in /etc/shells
for example /bin/false...

Saturday, April 2, 2011

Speeding up your hard drive

Get faster file transfer by using 32-bit transfers on your hard drive in Linux Machines

Just add the line:

hdparm -c3 /dev/hdX

to a bootup script.

If you use SuSE or other distros based on SYS V,


/sbin/init.d/boot.local

should work for you.

This enables 32-bit transfer on your hard drive. On some systems it can improve transfer performance by 75%.

To test your performance gain, type:

hdparm -t -T /dev/hdX

Tuesday, February 1, 2011

Script to view those compressed HowTos.

Script to view those compressed HOWTOs.


From a newbie to another, here is a short script that eases looking for and viewing howto documents. My howto's are in /usr/doc/faq/howto/ and are gzipped. The file names are XXX-HOWTO.gz, XXX being the subject. I created the following script called "howto" in the /usr/local/sbin directory:

#!/bin/sh
if [ "$1" = "" ]; then
ls /usr/doc/faq/howto | less
else
gunzip -c /usr/doc/faq/howto/$1-HOWTO.gz | less
fi

When called without argument, it displays a directory of the available howto's. Then when entered with the first part of the file name (before the hyphen) as an argument, it unzips (keeping the original intact) then displays the document.
For instance, to view the Serial-HOWTO.gz document, enter:

$ howto Serial

Monday, January 31, 2011

I compiled a small test program in C, but when I run it, I get no output!

I compiled a small test program in C, but when I run it, I get no output!


You probably compiled the program into a binary named test, didn't you? Linux has a program called test, which tests if a certain condition is true, it never produces any output on the screen. Instead of just typing test, try: ./test

Monday, January 24, 2011

Util to clean up your logfiles.

Util to clean up your logfiles.


If you're like me, you have a list with 430 subscribers, plus 100+ messages per day coming in over UUCP. Well, what's a hacker to do with these huge logs? Install chklogs, that's what. Chklogs is written by Emilio Grimaldo, grimaldo@panama.iaehv.nl, and the current version 1.8 available from ftp.iaehv.nl:/pub/users/grimaldo/chklogs-1.8.tar.gz. It's pretty self explanatory to install(you will, of course, check out the info in the doc subdirectory). Once you've got it installed, add a crontab entry like this:

# Run chklogs at 9:00PM daily.
00 21 * * * /usr/local/sbin/chklogs -m