Pages

Saturday, August 7, 2010

Linux Commands

I am posting some Linux commands which might be use full for others

Create RAID on Linux

mdadm --create /dev/md0 –level=5 –raid-devices=3 /dev/sdb /dev/sdc /dev/sdd

show raid details

mdadm –- detail /dev/md0

Stop raid

mdadm –-stop /dev/md0

Remove raid

mdadm –-remove /dev/md0


Installing RPM

rpm –ivh blahblah.rpm


Upgrading rpm

rpm –uvh blahblah.rpm


Removing RPM

rpm –ev blahblah.rpm


Creating rpms


compile driver
rename blahblah_(uname –a)
tar –cvzf blahblah_prebuild.tgz blahblah_(uname –a)
rpmbuild –bb ‘target=i386’ abc.spec

To extract rpm

rpm2cpio any.rpm cpio -idv

To load usb modules

modprobe usb-storage
modprobe oxci_hcd
modprobe ehc_hcd


Search contents of the file in current folder recursively

find . xargs grep –n
  
Turning on hibernation in windows from command prompt

powercfg –h on


Compiling Linux source

make mrproper
make clean

make menuconfig

make all && make modules && make modules_install && make install

How to Applying patch

patch p1 < abc.patch

cd back up

cpio –icuvd < /dev/st0

To find current partition

df

Generate ctags

ctags –R .

To see the version of a module

modinfo –F version

Enabling scsi logs

sysctl -w dev.scsi.logging_level=0xffffffff


To see change log of a Linux source rpm

rpm -q --changelog -p kernel......rpm less


Creating tar

tar –cvzf abc.tar *

Uncompress tar

tar –xvzf abc.*

Checking Kernel Version

uname –a

64 bit or 32 bit

uname -m

To see os version

cat /etc/SuSE-release in sles

cat /etc/redhat-release in RHEL