h1

Tips and tricks

August 11, 2006

———————————————————————–

Q:- Find out top 10 directories eating up your disk space:
A:- du -csh * –max-depth=0 | sort -rn | head -10
———————————————————————–

Q:- Find Harddisk Capacity on the box.
A:- fdisk -l | grep -iE ‘mb|gb|tb’
———————————————————————–

Q:- Find out performance of your hard disk with following command:
A:- hdparm -t -T /dev/hda
———————————————————————–

Q:- You can block all login access with following command:
A:- touch /etc/nologin
———————————————————————–

Q:- It is good idea to encrypt backup made with tar command:
A:- tar -zcvf – *| openssl des3 -salt -k PASSWORD | dd of=mybackup.tbz
tar zcvf – /home |openssl des3 -salt -k PASSWORD | dd of=/dev/st0
To extract encrypted tar file use command:
dd if= mybackup.tbz |openssl des3 -d -k PASSWORD| tar zvxf –
dd if=/dev/st0|openssl des3 -d -k PASSWORD | tar xzf ————————————————————————

Q:- Delete a file securely, first overwriting it to hide its contents.
A:- $ shred -n 200 -z -u personalinfo.tar.gz
A:- srm filename
A:- wipe filename
—————————————
Q:- Delete file by inode:
A:- $ find . -inum 782263 -exec rm -i {} \;
————————————————————————

Q:- Forcefully unmount CD/DVD Rom or any other mounted partitions with
fuser command:
Ans:- fuser -km /dev/cdrom
fuser -km /mnt/cdrom\n
fuser -km /data2
————————————————————————

Q: List open files under user nobody

A:- lsof -u nobody
————————————————————————-

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: