Archives Posts
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
Archives Posts
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
Archives Posts
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
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’
Archives Posts
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 »
Archives Posts
November 1st, 2007 by elizar
This tip is a give away. Everyone knows this, but for those who doesn’t or forgot… here’s refresher…
Here’s a typical output of a file listing using `ls -l` on a directory:
[root@unix-box icons]# ls -l | more
total 636
-rw-r–r– 1 elizar root 246 Aug 26 2005 a.gif
-rw-r–r– 1 elizar root 242 Aug 26 2005 alert.black.gif
-rw-r–r– 1 elizar root 279 Aug 26 2005 alert.black.png
-rw-r–r– 1 elizar root 247 Aug 26 2005 alert.red.gif
-rw-r–r– 1 elizar root 298 Aug 26 2005 alert.red.png
-rw-r–r– 1 elizar root 2326 Aug 26 2005 apache_pb.gif
-rw-r–r– 1 elizar root 1385 Aug 26 2005 apache_pb.png
-rw-r–r– 1 elizar root 293 Aug 26 2005 a.png
When using the -l (dash ‘el’) option of ls, the output will display a more detailed listing of the files. Here you’ll see the file properties/permission (-rw-r–r–) the number of links, the owner of the file, the group of the user, file size, the date/time stamp and finally the file name. That’s 7 column.
Changing The Time Stamp Of A File
To change the time stamp of a file (the 6th column in the `ls -l` listing), we use the UNIX command touch.
From the Man Pag:
NAME
touch - change file timestamps
SYNOPSIS
touch [OPTION]… FILE…
touch [-acm] MMDDhhmm[YY] FILE… (obsolescent)
There are many options for the touch command, but the one I use fairly often is the -t option
-t STAMP; use [[CC]YY]MMDDhhmm[.ss]
Example:
[root@unix-box icons]# touch -t 200607161201 a.gif
[root@unix-box icons]# ls -l | more
total 636
-rw-r–r– 1 elizar root 246 Jul 16 2006 a.gif
-rw-r–r– 1 elizar root 242 Aug 26 2005 alert.black.gif
Other options that you may find useful are -a (change access time only) -m (modification time only) and others. Consult the man page for more details
Cheers!
Archives Posts
October 26th, 2007 by elizar
In a Linux system (and in Solaris 5.8, 5.9, 10, Solaris in general apparently), there are two (identical? opposite?) commands that are very easy enough to remember. How is that? Well, first the command names speak for itself or do exactly what it is called. What are those commands? Well, they are:
more and and less.
more
The more command is a filter for paging through text one screenful at a time. For example if your viewing one large text file, you could use more to view the content of the file one screenfull at a time.
# more /path/to/file/filename
more also has an interactive mode that uses the commands based on vi. So if you’re viewing a file using more, it will pause on the first screenfull and just in case you would want to ’search’ for a particular string you could use the slash (’/') or the question mark (’?') just like you would if you’re using vi.
less
The command less, is just like more but unlike more which only goes one way, less allows backward movement in the file as well as forward movement.
Also, since more is a lot primitive than less, less also has tons of command line options. See it’s man pages for details.
Archives Posts
October 8th, 2007 by elizar
Just want to document it here. A colleague request to kill multiple PID owned by different users. They don’t have any special privilege to kill process other than their own.
Here’s a simple for…loop script that will look for and kill each PID it found.
#!/bin/sh -x
ps -ef | grep nobody | awk ‘{print $2}’ > /tmp/PID
filePID=”/tmp/PID”
for PID in `cat $filePID`
do
kill -9 $PID
done
#
Line 1, tells which shell will execute the script
Line 2, gets all the PID to be killed and store them on a file.
Line 3, assigns a variable for the file
Line 4 to 7 is the for…do loop which basically gets each line on the file, store the value on $PID and then kill whatever value is in it on line 6.
Yucky script. Post a better one.
Thanks.
Archives Posts
October 2nd, 2007 by elizar
Well if you are, you better check the most popular Ubuntu blog on the blogosphere!
Here’s the Top 5 on the list:
- Ubuntu Geek
- Ubuntu Blog
- Mark Shuttleworth
- The Fridge
- All About Linux
Archives Posts
September 19th, 2007 by elizar
There are many shells available for the UNIX operating system. Among them are sh (bourne), csh (C), tsch (korn) and bash (bourne again) Shells.
With all these shells, sometimes we can mix all the syntax when assigning values to a variables. Here’s is another review so you wont forget:
C Shell (csh) or Korn (tcsh):
hostname# setenv LD_LIBRARY_PATH /usr/local/lib
hostname# setenv MYVAR /usr/mydir
$PATH before and after:
hostname# echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin
hostname# setenv PATH ${PATH}:/usr/local/local/bin
hostname# echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/local/bin
For Bash (bash), Bourne (sh) or Korn (tcsh):
EDITOR=vi
export EDITOR
Study the syntax and let’s discuss…