Latest Entries »

Awk magic

Awk one of the most powerful command for text preprocessing that makes work easy.Awk can be used almost everywhere in system monitoring scripts, where efficiency is key.This is the most important command.This is the command that all core linux users should be know.

Let have few example to show power of Awk:
starting with simple commands

Lets us take the input as the /etc/passwd file

daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh

Task: To trip out only the user names from the password file(first field)
awk -F: ‘{print $1}’ /etc/passwd

-F should be followed by the delimiter here the Delimiter is ‘:’ and $1 is the first field which is required.
The output is:
daemon
bin
sys
sync
games
man

Usually,system admins won’t be using totem kind of player,since they don’t have GUI interface.
For them try the command madplay

Install the madplay Package

#apt-get install madplay

play the Music

#madplay my_rock_song.mp3

Njoy the Music ..

1.NEED To add an entry in apt source list
#add-apt-repository “deb http://archive.canonical.com/ lucid partner”

2. INSTALL THE FOLLOWING PACKAGES
#apt-get install sun-java6-bin sun-java6-jre sun-java6-jdk

3. TIME FOR TESTING
#java -version

EXPECTED OUTPUT
java version “1.6.0_03”
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Server VM (build 1.6.0_03-b05, mixed mode)

4.MAKING A SIMPLE PROGRAM

# vi HelloWorld.java

APPEND THE CODE
public class HelloWorld {
public static void main(String[] args) {
System.out.println(“Hello, World!”);
}
}

compile and run it

# javac HelloWorld.java
# java HelloWorld

output
Hello, World!

After standard installation there wont be mkfs.vat,mkfs.msdos to format the pendrive

 Inoder to format the pendrive first unmount it and the try the command
 mkfs -T vfat /dev/sdb1  if u want to format the pendrive in fat32 
 and finally mount it.so simple :-)

{code type=php}code here{/code}

well,its quite simple to install you tube videos using a light weight tool named  clip grab

follow the steps:

add-apt-repository ppa:clipgrab-team/ppa

sudo apt-get update

sudo apt-get install clipgrab

This will download a package clipgrab,search the video and grab it.

Finally i Manage to view you tube in freshly installed ubuntu 11.04 by installing two packages

#apt-get intall flashplugin-nonfree

#apt-get install flashplugin-installer

njoy your videos 🙂

After a bit goggling i got the simple procedure to build a Ubuntu repository.some people  reading this might think why should u construct this,the biggest advantages is to save the bandwidth and time .

simple steps to construct the Ubuntu package repository

packages are kept in the default directory /var/cache/apt/archives

step 1: Navigate to the location (/var/cache/apt/archives) and execute following command

# cd /var/cache/apt/archives
# dpkg-scanpackages . /dev/null | gzip -9c > /var/cache/apt/archives/Packages.gz

P in Packages.gz is uppercase be care ful while executing it
Result: This will create a Packages.gz (compressed file) in the same location ,if u want to examine the file just extract it and it return a txt file containing the packages information and all.
Thus ends step 1

step 2:creating a source url
remove all the entries and in source.lst and add the following entry in that
deb file:///var/cache/apt archives/

Execute the command

#apt-get update

to update the repository