March 13, 2010

Attach words horizontally using shell scripting

Linux General,

To paste contents of two files horizontally, paste command can be used. Create a file called cmd with the following content: # cat cmd /usr/sbin/useradd /usr/sbin/useradd /usr/sbin/useradd Create another file called newusers # cat newusers tom dick harry Now run the following command # paste -d ” ” cmds newusers > add.sh The -d ”…

Read more
March 13, 2010

Find empty files in Linux

Linux General,

find command provides two options to detect empty files $ find . -size 0c or $ find . -empty To find and delete all the empty files under the current directory at one go $ find . empty -exec rm -f {} \; To find and delete all empty directories under the current directory $…

Read more
March 13, 2010

Capture top command output in a file

Linux General,

Capture top command output in a file The output of top command can be captured as follows top -b -n1 > /tmp/top1.txt This will run top command once and write the output to a file, then exit. To run top 3 times with an interval of 5 seconds, run the following command top -b -n3…

Read more
January 29, 2010

Difference between grep and egrep

Linux General,

Difference between grep and egrep egrep is extended grep which includes additional regular expression metacharacters like ?, +, () and | Eg: egrep “(People|sense)” values.txt This command searches for patterns People and sense in file values.txt

Read more
January 1, 2010

Create directory & set permission using a single Linux command

Linux General,Linux/Windows Support,

Generaly, we create directory using “mkdir” command and then change it’s permissions using “chmod” command. Create directory & set permission using a single Linux command Actually, we can set the permissions for the directory at the time of it’s creation itself, with the following command: $ mkdir zyz -v -m 644 mkdir: created directory `zyz'…

Read more
January 1, 2010

Linux Package Management Tips

Linux General,Linux/Windows Support,

Try these Linux package management tips. Linux Package Management Tips 1) To check if a package is available in repositories and if so available, to check the version and size of the package, as superuser run the following commands in respective distro: Fedora, CentOS: yum list <package_name> Ubuntu/Debian: aptitude search <package_name> OpenSuse: zypper search <package_name>…

Read more
January 1, 2010

Find programs hogging bandwidth using iftop command in Linux

Linux General,Linux/Windows Support,

Find programs hogging bandwidth using iftop command in Linux Using iftop command we shall be able to determine what program is hogging bandwidth. iftop -bNBP is the commonly used option where -n don’t do hostname lookups -N don’t convert port numbers to services -B Display bandwidth in bytes -P show ports as well as hosts…

Read more
December 26, 2009

Linux modules and libraries

Linux General,

Dynamically linked libraries are linked and loaded at run time, either by “ld.so” or “ld-linux.so”, depending on how it was compiled: in a.out or ELF format. Every program whenever they need a library, look through a known list of places to find the needed library. One place they look is “/etc/ld.so.cache”, which contains an ordered…

Read more
December 26, 2009

RPM – RedHat Package Manager

Linux General,

What does a RPM Package contain? RPMs (*.rpm) typically include 1) the compiled programs and/or libraries needed for the package, 2) documentation 3) install, verify, and uninstall scripts 4) cryptographic signatures for each file in the package. This makes it easy to verify the integrity of the package. 5) It also includes a list of…

Read more
September 16, 2009

Linux Security Tools

Linux General,

In this page i will try to provide some of the must have tools for linux OS. Some of these tools can also be used for FreeBsd: ROOT KIT HUNTERS: Installation how to *  CHKROOTKIT * RKHUNTER * ROOTCHECK @RootCheck: You can download the rootcheck latest version from the following URL: http://www.ossec.net/rootcheck/files/ Installation how to:…

Read more