Category: Linux/Unix Tips and Tricks

Mapping SCSI Disks

Identify scsi disk Paths – Mapping Devices [root@rhel6 ~]# for i in sdb sdc sdd sde; do printf “%s %s\n” “$i” ; “$(scsi_id –page=0x83 –whitelisted –device=/dev/$i)”;

Seeing Linux Hardware

lsdev lsdev, lsusb, lspci cat /proc/devices cat /proc/scsci/scsi ls -lah /proc/kcore cat /proc/kcore ‘cat /proc/interrupts’ for which device is using which interrupt, also try ‘fdisk -l /dev/?d?’ for hard drive info, the ls /dev’  

Creating a YUM Repo

  Install the create repo package # yum install createrepo Make a directory for your repo mkdir -p /local/mrepo/RedHat5_X64_09_2014 Copy your rpms in to the new directory  cp -p *.rpm /local/mrepo/RedHat5_X64_09_2014 Run the createrepo command to make the repo.  createrepo /local/mrepo/RedHat5_X64_09_2014…

Finding deleted logs

Often people will delete log files that are still open.   Sometimes it is necessary to look at the logs that have been deleted.   It takes a little investigation, but can done. The first thing to do is to…

Adding swap file to Linux

If there are no free partitions on a disk, you can create a swap file.   Here is how you add a 12GB file. # Check what you have for swap.   We have one 4GB  swap partition. server# swapon -s Filename                               …

Identifing Linux disks

Identify scsi disk paths – Mapping Devices for disk in ‘/dev/sd*[a-z]’; do printf “%s %s\n” “$(basename $disk)” “$(scsi_id -p 0x83 -gs /block/$(basename $disk))” done

better df formating

df -P will provide 1 line per mount-point df -h -P will give human readable sizes (MB, GB, …) df -hP|column -t Will allign the output in columns