Category Archives: Linux

awk print output to 1 line

awk ‘{printf(“%s “,$1) }’ <file name>

Posted in Linux | Leave a comment

Simple Home NAS solution

I have been thinking on having my home NAS and i did survey for a few market product like QSNAP or SYNOLOGY will cost me near to 1000USD , if i were to get a RAID-5 + hot swap features. I struggled for a while and decided to use the simplest + cheap solution for home NAS to host my photo + movie + mp3. Step 1 – Identify OS: 1. Freenas – FreeBSD based , i like FreeBSD because … Continue reading

Posted in Linux | Tagged , , , | Leave a comment

python script for simple write and delete test

Have been interested for python script and finally i got a chance to play with it. So the mission for today is to create the write and delete test for my environment. Local machine  —-COPY—>  Mounted filesystem in NAS Why i am doing so? to get a baseline for my write and delete operation.I will make use of “time” command to get total runtime for the script to complete the operation. So here goes the simple script(Feel free to provide … Continue reading

Posted in Linux | Tagged , | Leave a comment

LVM extend in live mode!

Q: I have a LVM(logical volume) in my Linux, i need to extend the size without offline the logical volume. A: You will need to ensure you have spaces in volume group. Assuming the VG name is : VolGroup00. [root@linux1 data]# vgdisplay — Volume group — VG Name               VolGroup00 System ID Format                lvm2 Metadata Areas        1 Metadata Sequence No  10 VG Access             read/write VG Status             resizable MAX LV                0 Cur LV                8 Open LV               8 Max PV                0 Cur PV                … Continue reading

Posted in Linux | Tagged , , , , | Leave a comment

Promote NIS Slave Server in Redhat/CentOS

Situation: You have NIS Master, you need a slave setup in your office. This tutorial is covering steps for Redhat/CentOS/Fedora 64 bits. It might differ from what you have seen online. 1. Install ypserv in your server yum install -y  ypserv.x86_64 2. Start the services service ypserv start service ypxfrd start 3. Verify the yp is ready #rpcinfo -u localhost ypserv program 100004 version 1 ready and waiting program 100004 version 2 ready and waiting 4. Copy the database fro … Continue reading

Posted in Linux | Tagged , , | Leave a comment

Use awk to calculate total size of files – part 1

Your boss came to you and asked for total size of files which has not been accessed for more than 30 days! Assume that you are just checking for 1 directory “/abc” . Here comes the simple command: find /abc -atime +30 -exec ls -lk ‘{}’ \;  | awk ‘{SUM += $5} END {print SUM} ‘ Explaination: find /abc -atime +30 -exec ls -lk ‘{}’ \ find command will find /abc and check for accestime which has not been access … Continue reading

Posted in Linux | Tagged , , | 1 Comment

-rwsr-xr-x Unix file permission

Everybody handling a Unix operating system would very well know what chmod 777 means. That the owner, group and the user of the file is given all permissions (Read, Write and Execute on a particular file). This could otherwise be written as “chmod ugo+rwx “. Meaning that you are giving User, Group and Owner of the file, the rights to Read, Write and Execute the file. Here comes the rws scenario. Best example that is available for this rws is … Continue reading

Posted in Linux | Leave a comment

Redhat KVM – Network bridge

Redhat just released RHEL 5.4 with KVM & Xen both supported in this release, so i have downloaded CentOS 5.4 and try to play around with KVM. My hardware: Dell M710 with 8 cores of  Nehalem , 72G of RAMs My OS: CentOS 5.4 with KVM & Xen installed My test guest: Windows 7 The sweet thing: virt-manager is able to support for KVM new machine creation. The future for Redhat virtualization , since Redhat acquired Qumranet(company behind KVM) The … Continue reading

Posted in Linux | Tagged , , , , | 4 Comments

Linux useful find command

Linux find command Continue reading

Posted in Linux | Tagged , | Leave a comment