Skip to main content

Posts

Linux: Create New User Account

Creating a user account is a two step process. 1. Create a user account. prompt> useradd user-name 2. set a password for the new account. prompt>passwd user-name This will create a user with a home directory /home/ user-name and default shell set to bash.

Setting Clock

The clock can be set manually and using NTP service. 1. Manually: [root@server /root]# date 012621362007 Fri Jan 26 21:36:26 PST 2007 [root@server /root]# hwclock --utc --systohc [root@server /root]# 2. Using NTP service: Add the time server to /etc/ntp.conf and to /etc/ntp/step-tickers: /etc/ntp.conf: server 192.168.0.1 server 192.168.0.2 /etc/ntp/step-tickers 192.168.0.1 192.168.0.2 Then make sure that ntp will start at boot time: chkconfig --level 2345 ntpd on chkconfig --list ntpd And start the service: service ntpd start

Postgres Commands

To create a database; createdb [db-name] To get a psql prompt; psql [db-name] To export table data; pg_dump --data-only --table=table-name db-name > file-name Following commands can be executed at psql prompt. list all databases in postgres; \l list all tables in a database; \d execute a sql script; \i [sql-script]

Search and Replace String

A string consisting of one or more words can be replaced as follows. >cat file the black cat was chased by the brown dog >sed -e 's/black/white/g' file the white cat was chased by the brown dog A pattern can also be used for search string. For example following will replace entire string starting with 2007 until = symbol in a text. sed -e 's/^2007.*=/replacestring/' file

Installing PostgreSQL on Linux

Recently I had to install postgresql on a linux machine. I ended up referring to more than one article on the web. So here's an attempt to capture all in one document. 1. Download latest postgresql-XXX.tar.gz (where XXX is a release number) distribution of postgres database. At the time of writing this document 8.2 is the latest release. 2. Due to built-in security reasons, postgres cannot run as a root user. Therefore, become a superuser and create a postgres group. Then add a user postgres to the group as follows; sudo su - root (become a superuser) groupadd postgres (create a postgres group) useradd postgres –g postgres (create a postgres user) 3. Extract the tar file into /usr/local directory. This should create a postgresql-XXX subdirectory in /usr/local. cd /usr/local gunzip -c /path-to-file/postgresql-XXX.tar.gz | tar xvf - 4. create a /usr/local/pgsql directory where postgres database will be installed. mkdir /usr/local/pgsql 5. Assign ownership of di...

Climbing Mount Shasta

We climbed Mount Shasta on May 30th, 2004 over memorial day long weekend. This was our second attempt. We had to turn back from Lake Helen camping area at 10,400 ft during our first attempt. This time we were better prepared both, mentally and physically. We found the book Climbing Mount Shasta very useful and also the Mount Shasta Avalanche Center website. Located 40 miles south of the California-Oregon border, Mount Shasta is the second highest (14,161 feet, 4,317 m) mountain in the Cascade Range. It offers 17 different climbing routes with difficulty levels ranging from beginner to advanced. We took Avalanche Gulch - South Side route which is a very popular and also recommended route for beginners. We left bay area on Friday morning to reach Mount Shasta Valley by late afternoon. We picked up rental gear from The Fifth Season shop in Shasta valley. We rented snow shoes, crampons, ice-axe, helmet, sleeping bag and hiking poles. We carried our own tent, backpack and cooking ...