Now I am going introduce you to a set of commands that may come handy


find -perm 777 -type d -exec chmod 755 {} \;   #Command to change all the folders under present directory with 777 to 755

find -perm 755 -type f -exec chmod 644 {} \;   #Command to change all the folders under present directory with 755 to 644

find -type d -maxdepth 3 -exec cp file {} \;   #Copy file to 3 levels of directories below the present directory

find . -name "*.trn" -ctime +3 -exec rm -f {} \;  #Forcible remove files with .trn extension and 3 days old.

find . -cmin -5   #Find all files created or updated in the last five minutes:

(Great for finding effects of make install)


ls -lSh        #List files by their size

ls -ltr        #List files by date

ls -F          #Appends a symbol after files and directories


rsync -e ssh -az /currentdirectory IP:/remotedirectory  #Sync remote directory with our current directory.

rsync --bwlimit=1000 fromfile tofile                    #Locally copy with rate limit


gpg -c file                                             #Encrypt file

gpg file.gpg                                            #Decrypt file


du -h --max-depth 1             #Show disk space used by all the files and directories.

du -s * | sort -k1,1rn | head   #Show top disk users in current directory.

df -h                           #Show free disk space

df -i                           #Show free inodes

Add system swap space for virtual memory paging

Swap space may be a swap partition, a swap file or a combination of the two. One should size swap space to be at least twice the size of the computer’s RAM. (but less than 2GB)

dd if=/dev/zero of=/swapfile bs=1024 count=265032 - #Create file filled with zeros of size 256Mb

mkswap /swapfile                                    #Create swap file

swapon /swapfile                                    #Begin use of given swap file.

Assign a priority with the “-p” flag.

swapon -s                                           #List swap files

scat /proc/swaps                                    #Same as above

This example refers to a swap file. One may also use a swap partition.
Make entry to /etc/fstab to permanently use swap file or partition.

/swapfile               swap                    swap    defaults        0 0

Note: To remove the use of swap space, use the command swapoff. If using a swap partition, the partition must be unmounted.

Debugging Tools

strace -c ls >/dev/null                 #Summarise/profile system calls made by command

strace -f -e open ls>/dev/null         #List system calls made by

ltrace -f -e getenv ls >/dev/null       #List library calls made by command

lsof -p $$                              #List paths that process id has open

lsof -p PID                             #List paths PID has open

lsof ~                                  #List processes that have specified path open

last reboot                             #Indicates last reboot time

renice +15 PID #To give lower priority for a PID -19 is highest and +20 is lowest

To check number of IP’s connecting to port 80

netstat -tanpu |grep :80 |awk {'print $5'} |cut -d: -f1 |sort -n |uniq -c

tcpdump not port 22                     #To show network traffic except on port 22

Perl Administration

Installation of perl module can be done from tar file.

tar xzf yourmodule.tar.gz               #Untar Module

perl Makefile.PL                        #Build with PERL makefile:


make install                            #Install

You can also do this from cpan shell

perl -MCPAN -e shell                    #First time through it will ask questions Answer "no" to the first question for


cpan> install URI

cpan> i /PerlMagick/                    #Inquire about module. (Search by keyword)

Distribution    J/JC/JCRISTY/PerlMagick-5.36.tar.gz

Module          Image::Magick   (J/JC/JCRISTY/PerlMagick-5.36.tar.gz)

cpan> install Image::Magick

cpan>force install Image::Magick       #Install a module forcefully.

YUM :RPM Updater

YUM (Yellowdog Updater, Modified) is a client command line application for updating an RPM based system from an internet repository (YUM “yum-arch” server) accessible by URL (http://xxx, ftp://yyy or even file://zzz local or NFS)

yum -y install package-name            #To install a package along with its dependencies

yum remove package-name                 #To remove package

yum list                                #To list available packages version and state

yum list extras                         #To list packages not available in repositories but listed in config file

yum list obsoletes                      #To list packages which are obsoleted by repositories

yum clean all                           #To list packages which are obsoleted by packages in yum repository

yum update                              #Update all packages on your system

yum update package-name                 #Update a package

yum update package-name-prefix\*        #Update all with same prefix

You can add new repos in /etc/yum.repos.d with files named file.repo For the option “gpgcheck=1″ to work, use the “rpm –import GPG-KEY

rpm --import /usr/share/rhn/RPM-GPG-KEY

rpm --import /usr/share/rhn/RPM-GPG-KEY-fedora

File: /etc/yum.repos.d/fedora.repo with following entry


name=Fedora Core $releasever - $basearch - Base





Additional Commands

tzselect                                #To change time zone of the machine

command 2>&1 | tee outputfile.txt       #Output of a command is send to a text file

wget --mirror    #To mirror a site

wget -c #To continue downloading partially downloaded file

Many more tricky commands to be updated soon :)

VN:F [1.9.6_1107]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.6_1107]
Rating: 0 (from 0 votes)
Share and Enjoy:
  • Digg
  • Sphinn
  • Facebook
  • Mixx
  • Google Bookmarks
  • Live
  • StumbleUpon
  • Twitter
  • Yahoo! Buzz
  • Reddit
  • Technorati