Posts

Showing posts from October, 2007

Linux - grep with color highlighting

Quoted from http://www.cyberciti.biz
> grep --color='auto' -i error /var/log/messages

Set for shell default usage
> vi ~/.bash_profile
# add the following lines
export GREP_COLOR='1;37;41'
alias grep='grep --color=auto'

Linux - command to check driver/module

> cat /proc/modules
> lsmod
> modinfo [mod_name_from_lsmod]

Linux - Combine ISOs into DVD

# download ISO files under /tmp
ls /tmp
rhel-5-server-supplementary-x86_64-disc1.iso
rhel-5-server-x86_64-disc1.iso
rhel-5-server-x86_64-disc2.iso
rhel-5-server-x86_64-disc3.iso
rhel-5-server-x86_64-disc4.iso
rhel-5-server-x86_64-disc5.iso
rhel-5-server-x86_64-disc6.iso

# write script to combine ISO files
# This script is writen by Chris Kloiber.

#!/bin/bash

# by Chris Kloiber

# A quick hack that will create a bootable DVD iso of a Red Hat Linux
# Distribution. Feed it either a directory containing the downloaded
# iso files of a distribution, or point it at a directory containing
# the "RedHat", "isolinux", and "images" directories.

# This version only works with "isolinux" based Red Hat Linux versions.

# Lots of disk space required to work, 3X the distribution size at least.

# GPL version 2 applies. No warranties, yadda, yadda. Have fun.


if [ $# -lt 2 ]; …

Linux - Network Auditing NMAP (1)

Nmap ("Network Mapper") is a free and open source (license) utility for network exploration or security auditing.
Many systems and network administrators also find it useful for tasks such as network inventory, managing service upgrade schedules, and monitoring host or service uptime.
Nmap uses raw IP packets in novel ways to determine what hosts are available on the network, what services (application name and version) those hosts are offering, what operating systems (and OS versions) they are running, what type of packet filters/firewalls are in use, and dozens of other characteristics. It was designed to rapidly scan large networks, but works fine against single hosts. Nmap runs on all major computer operating systems, and both console and graphical versions are available


[root@lsvr02 ~]# nmap 127.0.0.1

Starting Nmap 4.11 ( http://www.insecure.org/nmap/ ) at 2007-10-25 09:47 HKT
Interesting ports on lsvr02 (127.0.0.1):
Not shown: 1668 closed ports
PORT STATE SERVICE
21/tcp …

Linux - compile .src.rpm

The difference between .rpm and .src.rpm is that .src.rpm includes the source codes and it is required to compile to install.

rpm -i [software-package].src.rpm
cd /usr/src/redhat/SPECS
rpmbuild -bp [software-package].specs
cd /usr/src/redhat/BUILD/[software-package]
./configure
make && make install

OR

rpmbuild --target i386 --rebuild [software-package].src.rpm
/usr/src/redhat/RPMS/i586/xl2tpd-1.1.11-2.i386.rpm