An MS Environment to a FOSS Advocate

I just moved to a new workplace and as expected, there’s what we call ‘culture shock.’

Although in my case, it’s more of application shock. I am a FOSS advocate. I use FOSS in any machine that I get my hands on. I always search for FOSS counterparts of commercialized softwares. I encourage other people to use FOSS too.

Then it began with telling me to use MS Outlook as my mail client. It went on when they gave me a short list of applications that are usually used. Whoa!

I’m trying to get the hang of it while keeping my advocacy alive. I might be a little non-compliant to their tools just like with virtual machines, I still want VBox for it instead of their licensed VMWare; Notepad++ instead of another licensed UltraEdit; Greenshot instead of Snagit; among others.

However, servers are *nix machines. Ooooohh… love love love. hehehe

Tip of the Day: find string in a file via commandline

Sometimes we want to know if certain words or strings are in a file.

Fear not, here’s a simple way to do it:

root@localhost ~]# fgrep <keyword> <filename>

Let’s say I’m searching for the string ‘copy’ inside a shell script called check:

root@localhost ~]# fgrep copy check

I’ll get the entire line:

“Copy not finished”;

Book of the Month: VI Tips Essential vi/vim Editor Skills

VItipsHere’s a good read for those who are new to vi/vim editor.
As for me, I really like vim for a very simple reason there’s no need to use mouse :p.

How to: mount Logical Volume Drive as External Device to Linux File System

First of all, we have to check if this hard disk is recognized by the system:

root@localhost ~]# fdisk -l

Let’s say your drive is assigned /dev/sdc. Then we scan for logical volumes so you’ll see something like this:

Disk /dev/sdc: 20.0 GB, 20020396032 bytes
255 heads, 63 sectors/track, 2434 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *           1          13      104391   83  Linux
/dev/sdc2              14        1670    13309852+   f  W95 Ext’d (LBA)
/dev/sdc3            1671        2434     6136830   8e  Linux LVM
/dev/sdc5              14          75      497983+  82  Linux swap / Solaris
/dev/sdc6              76        1670    12811806   83  Linux

Next we scan for physical volumes:

root@localhost ~]# pvscan

You’ll get:

PV /dev/sdc3   VG VolGroup00   lvm2 [5.84 GB / 32.00 MB free]
Total: 1 [5.84 GB] / in use: 1 [5.84 GB] / in no VG: 0 [0   ]

Then scan for logical volumes:

root@localhost ~]# lvscan

You’ll get:

inactive            ‘/dev/VolGroup00/LogVol00′ [5.31 GB] inherit
inactive          ‘/dev/VolGroup00/LogVol01′ [512.00 MB] inherit

Logical volume that we want to access must be active, therefore we type in:

root@localhost ~]# /usr/sbin/lvchange -a y /dev/VolGroup00/LogVol00

Then mount to file system:

root@localhost ~]# mount -t ext3 /dev/VolGroup00/LogVol00 /mnt/

When done, unmount and revert to inactive mode:

root@localhost ~]# /usr/sbin/lvchange -a n /dev/VolGroup00/LogVol00

How to: show hidden all files including hidden ones in Linux command line

I did this in openSUSE.

It’s as simple as:

root@localhost ~]# ls -a

better yet, use alias if you want to include attributes:

root@localhost ~]# ll

far better with attributes:

root@localhost ~]# l

How cool is that? I didn’t create an alias for it. I accidentally hit hard return after pressing ‘l’. Nice huh.