SysAdmin Blog, TechTips and Reviews

An (ex) System Administrator's Blog



Archives Posts

How Do you Find and Replace Expressions in VI Editor

February 29th, 2012 by elizar

One and for all, let’s do this again.. how do you do the find and replace function of the Vi editor? I keep on coming back to Google for the syntax but at least I know that there is an ‘s’ in the beginning of the command and a ‘g’ at the end (for Global search). :)

Anyway, a little background before i copy paste the information here. I first taught myself how to use Vi during my ‘first’ job as a systems engineer in NEC TNCSi. Actually, my UNix foundation was all from NEC. Not that they train me how to be a unix admin, but I learned and taught myself how to do it. I read books that were lying around there and build samba servers, qmail and email servers and stuff until I got the ropes, the ins and outs of the UNix environment (Actually, I was using Linux – Redhat).

How Do You Find and Replace Text in Vi?

To perform a global search and replace in vi, use the search and replace command in command mode:

:%s/search_string/replacement_string/g

The % is a shortcut that tells vi to search all lines of the file for search_string and change it to replacement_string. The global ( g ) flag at the end of the command tells vi to continue searching for other occurrences of search_string . To confirm each replacement, add the confirm ( c ) flag after the global flag.

For this latest usage, i need to change the shell for all the users who are using /bin/ksh to a safeword sid shell.

remember to use the ‘slash’ character if you are filtering actually backslash.. You do not want to misinterpret the ‘/’ character by vi.

so, that’s

:%s/\/bin\/ksh/\/bin\/sid/g

Filed under Commands, Linux, Solaris, Unix having No Comments »

Archives Posts

Gnome 3.4 Beta 1 – What’s Up?

February 27th, 2012 by elizar

I could not remember the first time I ever used the first ever desktop environment in the Linux OS.

Back in the pre- Fedora dys when Redhat was still freely available, two well known desktop available to linus was the K Desktop and Gnome.

I am in love with Gnome then and I beilive ot is still the one i prefer today, even though I an no longer active in the Linux community.. Solaris grab all my attention.

Now, Gnome 3.4 Beta 1 is almost out…

The GNOME 3.4 Beta 1 release is ready for testing and it brings updates to main components, such as GNOME Contacts, GNOME Control Center, GNOME Desktop, GNOME Disk Utility, GNOME Panel, GNOME Screensaver, GNOME Session, GNOME Settings Daemon, GNOME Shell, GNOME System Monitor, GNOME Themes Standard, Mousetweaks, and GNOME User Docs.
Moreover, the following apps were updated: NetworkManager (including network-manager-applet), Baobab, Empathy, Evince, Yelp, Nautilus, and Eye of GNOME.

The GNOME 3.4 Beta 1 release is ready for testing and it brings updates to main components, such as GNOME Contacts, GNOME Control Center, GNOME Desktop, GNOME Disk Utility, GNOME Panel, GNOME Screensaver, GNOME Session, GNOME Settings Daemon, GNOME Shell, GNOME System Monitor, GNOME Themes Standard, Mousetweaks, and GNOME User Docs.

Moreover, the following apps were updated: NetworkManager (including network-manager-applet), Baobab, Empathy, Evince, Yelp, Nautilus, and Eye of GNOME.

Last but not least, here are the core libraries that were updated in GNOME 3.4 Beta 1: at-spi2-atk, at-spi2-core, clutter, clutter-gst, cogl, folks, glib, glibmm, gmime, gstreamer, gtk+, gtksourceview, libcroco, libgee, libgnomekbd, libsoup, mutter, and pygobject.

The GNOME 3.4 development cycle will continue with a second Beta release on March 7th and the GNOME 3.4 Release Candidate version on March 21st.

The final release of GNOME 3.4 will be available on March 28th, 2012, followed by the first point release on April 18th, GNOME 3.4.1.

Filed under Linux having No Comments »

Archives Posts

getfacl and setfacl – Unix Access Control (acl) Tool

March 17th, 2010 by elizar

Today’s topic is all about Access List… For Unix and Unix-like system, the usual command to set the file permission is the ‘chmod’ command. However there are instances that we need more flexibility in giving access and control for files and folders. Get it? Access and Control? In this situation, there is a file utility built in Unix called ‘getfacl‘ and ‘setfacl‘.


getfacl
is a file utility for viewing the access control list information associated with a file or directory.

For a memory aid, you can think of ‘getfacl’ as “Get File ACL“.. ACL being Access Control List.

Access control lists are extended attributes added to most major file systems in the 2.6 kernel to improve ability to control the access of files. They allow permissions to be set for individual groups and users and not just the owning user, owning group, and all other users.

setfacl is a command that allows you to set the Access Control List information for a file or directory.

Access control lists are extended attributes added to most major file systems in the 2.6 kernel to improve ability to control the access of files. They allow permissions to be set for individual groups and users and not just the owning user, owning group, and all other users.

You can read man pages for both getfacl and setfacl for more information.

getfacl and setfacl example….

Here’s an example of using the basic funtion of getfacl and setfacl

# getfacl

#setfacl

setfacl -m default:user::rwx,default:group::r-x,default:other:r-x,default:mask:rwx /u06/OneSource/datapump_dbdump

setfacl -m default:user:rcodapp1:r-x,default:group:r-x,default:other:—,default:mas:rwx /u06/OneSouce/datapump_dbdump

Archives Posts

Top equivalent for AIX – Topas, Only Better

June 24th, 2009 by elizar

Top equivalent for AIX – Topas, Only Better… That’s what I searched when I got a ticket from one of the AIX boxes here complaining about CPU being 99% used up.

Of course, you can use vmstat with interval, but for those sysadmin folks who are use to using Top, its still more comfortable using (and seeing) the top output.

Topas is the equivalent of Top for AIX.. it’s better than Top as a matter of fact according to some AIX gurus (and Solaris)

If you persists in using top, You’ll have to build it yourself from the sources at http://www.unixtop.org/ plus probably this fix: 

        http://sourceforge.net/tracker/index.php?func=detail&aid=934590&group_id=72892&atid=536044

Good luck!

 

Archives Posts

Searching For Fee Car Classifieds Script

April 30th, 2009 by elizar

Cars are no longer a luxury nowadays (except if you want to own a Ferrari or something). Cars are now a necessity in today’s standard of living. And let’s face it, with the price of brand new cars and the forever raising price of gasoline, not every one can buy a new set of wheels.

Thanks to websites that offer to sell (and buy) second hand, used cars many people can have places to search for and are no longer limited to the restrictions of locations.

I bought my first car (my only car for that matter) from a dealer that posted their inventory online. So, thanks to this second hand used car website, I was able to find myself and buy my very own car.

Read the rest of this entry »

Archives Posts

Setting up an FTP server on Debian

April 5th, 2008 by elizar

First things first, check to see what available ftp server are there for Debian

atp-cache search ftp-server

This will suppose to to list all available ftp server . As you can see there are a few available server you can choose. Popular one is proftp.

To install the service do:

apt-get install proftp

This will start installing .. you know, displaying all those letters and words and stuff..

webserver:~# apt-get install proftpd
Reading package lists… Done
Building dependency tree… Done
The following extra packages will be installed:
libmysqlclient15off libpq4 mysql-common perl perl-modules ucf
Suggested packages:
libterm-readline-gnu-perl libterm-readline-perl-perl proftpd-doc
Recommended packages:
perl-doc debconf-utils
The following NEW packages will be installed:
libmysqlclient15off libpq4 mysql-common perl perl-modules proftpd ucf
0 upgraded, 7 newly installed, 0 to remove and 0 not upgraded.
Need to get 9623kB of archives.
After unpacking 39.1MB of additional disk space will be used.
Do you want to continue [Y/n]? Y

Run proftpd from inetd or standalone?

inetd
standalone

Initially selected standalone here.

And you’re done!

To start up the FTP service:

/etc/init.d/proftpd start

Filed under Installation, Linux having No Comments »

Archives Posts

vi Search and Replace… The Basics, Dummy’s Reference

March 13th, 2008 by elizar

Yep, this is a dummy’s reference… I keep on forgetting the syntax so I might as well put it here for my own reference… 😀

vi is the one, if not the most popular text editor available for a System Administrator on a UNIX and UNIX-like machines.

It has two modes, command and editor mode.

Here are some syntax in using the Search and Replace in ‘vi’.

Search:

The most basic and most easily remembered command for searching is vi is slash or ‘/’ followed by the character being searched. That’s for forward searching. For backward, vi use ‘?’ followed by the string being searched.

To go to the next occurrance of the string being searched, vi use ‘n’ command. Doesn’t matter if your searching forward (from up, down) or backward, from down to top.

Example:

(you have to be in command mode… press ESC first)

/search_string

?search_string

Search and Replace

For search and replace, use the syntax

:%s/original/replaced/g

Make sense?
Any command that begins with a “:” is called a line mode command and performs its duty on the line the cursor is currently on.

The above syntax serves my purpose now… If I want to replace text in certain ranges.. syntax can be found here

Filed under Linux, Solaris, Tips, Unix having 2 Comments »

Archives Posts

Trouble Installing Ubuntu on a NEO Laptop

March 9th, 2008 by elizar

I bought my very first laptop last week which comes pre-installed with Windows Vista Home Basic.

My original plan was to erase the whole thing and put Ubuntu on it. Tried it couple of days ago but didn’t work out.

After the boot up from the CD (requested a copy of Ubuntu 7.10) it displayed the little cross hair, then nothing…

I thought it’s probably the Vista… So I put in XP.. coz I tried installing Ubuntu over XP before, but the same thing happened!

So I wonder if this is a hardware issue on my laptop? It’s a NEO Empriva 540SVBe.

Will do a search later.

Archives Posts

mysql: Multiple Table Query, Output into File

February 23rd, 2008 by elizar

Got a request from the boss today to extract all users plus their contact numbers from the Paging server

Server is a Red Hat Enterprise Linux AS release 4, running LAMP.

The data needed are located in several tables, so we need to query all relevant tables in the databse:

mysql> SELECT users.username, users.emailaddress, user_services.current_service FROM users, user_services WHERE users.username=user_services.username

The statement above queries two tables – users and user_services, as show from the expressin ‘FROM users, user_services’. The record in users table that information is required are in the username and emailaddress record. On user_services, it’s current_services. The WHERE sets the limit condition.

To send that output to a file, we use the INTO OUTFILE ‘</path/to/file>’.

So, that’s

mysql> SELECT users.username, users.emailaddress, user_services.current_service FROM users, user_services WHERE users.username=user_services.username INTO OUTFILE ‘/tmp/tempfile.txt’

Filed under Linux, mysql, Tips having 1 Comment »

Archives Posts

AsteriskNOW – Asterisk Out Of The Box

January 16th, 2008 by elizar

I recently found a nice read about a Linux Project or Distro that includes Asterisk. It contains all the Asterisk stuff one will ever need. The project is called AsteriskNOW.

You can donwload the package at asteriskNOW.com. You can choose to download and ISO image or a VMWare image on the donwload page.

The is so easy to use and install that AsteriskNOW claims that you can install it 30 minutes!

Read the rest of this entry »

Filed under Linux, VoIP having No Comments »

« Previous Entries

I was here...