September 11th, 2010 | Tags: , , , ,

Logout dialog
gnome-session-save –logout-dialog

Logout without showing the dialog
gnome-session-save –logout

Shutdown dialog
gnome-session-save –shutdown-dialog

August 21st, 2010 | Tags:

eject -t

Or

eject -t /dev/hdb

Or

eject -t /dev/sr0

August 18th, 2010 | Tags: , , , ,

badblocks -sv /dev/sda
-s shows the progress of the scan
-v Verbose mode

August 18th, 2010 | Tags: , ,

firefox -ProfileManager -no-remote

Firefox profile manager

Firefox profile manager

August 13th, 2010 | Tags: , , , , , ,

apt-get autoclean

will remove packages in the package cache (/var/cache/apt/archives)  which are no longer available in the repository.

apt-get autoclean -s

simulation mode: display the files which will get erased from the cache

July 30th, 2010 | Tags: , , , ,

Extract
gunzip < /boot/initrd.img | cpio -i –make-directories

Repack
find ./ | cpio -H newc -o > initrd.cpio
gzip initrd.cpio
mv initrd.cpio.gz initrd.img

July 30th, 2010 | Tags: , , , , , , ,

After searching for quite some time I got the solution to start/stop gdm & xorg in Fedora 13.

To stop gdm and Xorg

initctl stop prefdm

killall Xorg

To start Xorg and gdm

initctl start prefdm

June 12th, 2010 | Tags: , , , ,

To clear and build squid3 cache on Debian and Ubuntu.

/etc/init.d/squid3 stop; rm -Rf /var/spool/squid3/*; squid3 -z; /etc/init.d/squid3 start

July 18th, 2009 | Tags: , , , , , , ,

If you want to know the total number of lines of files in a directory, execute the following line of script in your terminal. You can also save this command in a file and execute.

lines=0; for i in `find . -name “*.php”`; do line=`cat $i | wc -l`; let lines=$lines+$line; done; echo $lines

lines=0; for i in `find /var/www/wordpress -name “*.php”`; do line=`cat $i | wc -l`; let lines=$lines+$line; done; echo $lines

OR

find . -name “*.php” -print0 | xargs -0 wc -l | tail -n1

July 18th, 2009 | Tags: ,

To know the count of files of a particular type in a directory

find . -name “*.png” | wc -l

find /usr/share/images/ “*.jpg” | wc -l