RSS

Category Archives: Ubuntu

A Begginer’s guide to shell scripting

Shell scripts are one of the easiest programming languages to learn. They are a Linux administrators best friend and you can use them to automate tasks like a server backup or even just to email you the IP address of your Raspberry Pi server on boot.

In this post we will see how to write a simple shell script and then proceed to some intermediate shell scripting examples.

Before we start, I recommend you install “VIM”, a file editor, via yum .

Let’s get started with a simple script to tell us the disk usage in the current directory

techarena51.com

Advertisements
 
Leave a comment

Posted by on June 11, 2014 in Centos, Fedora, Linux, Shell Scripting, Ubuntu

 

Tags:

Wired Network Device not managed Ubuntu 11.04

This is a common problem in Ubuntu 11.04, I tried to connect via a wired cable and was stunned to find that there was no auto Etho 🙂

After Googling for a while, I came across the solution below, hope it helps you guys

Solution is as follows
Step 1. Open the Network manager conf file

sudo gedit /etc/NetworkManager/NetworkManager.conf  

Step 2
Change the below line to true

managed=false

Step 3
Reboot your System

Visit blogadda.com to discover Indian blogs

 
1 Comment

Posted by on October 25, 2011 in Linux, Ubuntu

 

Tags: , , , , ,

How to connect MTNL 3G or any usb data card on Linux

Ok So I Bought a MTNL 3G dongle and was struggling to connect to the 3g network.

Tried everything usb mode switch, installed the software that came along with the client, network manager but no luck.

Finally thanks to manager I got the solution. If you have installed the software that comes with the dongle remove it.

Thats it then try to connect and its works successfully.

The software blocks the port which needs to be connected on and hence I was stuck.

Looking forward to enjoying my unlimited connection.

If the above still does not work then you need to type the code below

 

lsusb

After connecting the datacard type the command above you will get an output as below

Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 003: ID 0a5c:2145 Broadcom Corp. Bluetooth with Enhanced Data Rate II
Bus 004 Device 002: ID 08ff:2810 AuthenTec, Inc. AES2810
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 004: ID 230d:0003
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Here the number after ID is your Vendor id and your product id respectively. If you are not sure which is yours then remove your datacard run lsusb copy the output and then compare it with the output you got with datacard.

After you have got that, you will need to install usb_modeswitch as follows


sudo apt-get install usb-modeswitch

Once done type the following command


sudo usb_modeswitch -v 230d -p 0003 -u 3

Where -v and -p we got from lsubs earlier.

and thats it you can either connect it from Network manager or with wvdial


sudo wvdialconf
sudo wvdial

You need to edit /etc/wvdialconf with your apn, username and password.

Click here for MTNL 3g tariffs

 
2 Comments

Posted by on September 28, 2011 in Linux, Ubuntu

 

Tags:

PHP search using PostgreSQL

A simple search form to search  the db and display the contents via PHP and PostgreSQL

Name the below as index.html

 

<h2>Search</h2>
<form name=”search” method=”post” action=”search.php”>
Seach for: <input type=”text” name=”find” /> in
<Select NAME=”field”>
<Option VALUE=”emailaddress”>emailaddress</option>
<Option VALUE=”domainname”>domainname</option>
</Select>
<input type=”hidden” name=”searching” value=”yes” />
<input type=”submit” name=”search” value=”Search” />
</form>

Name the below as search.php

 

 

<?

$searching = $_POST[‘searching’];
$find = $_POST[‘find’];
$field = $_POST[‘field’];

//This is only displayed if they have submitted the form

if ($searching ==”yes”)
{
echo “<h2>Results</h2><p>”;

//If they did not enter a search term we give them an error
if ($find == “”)
{
echo “<p>You forgot to enter a search term”;
exit;
}

// We preform a bit of filtering
//$find = strtoupper($find);
$find = strip_tags($find);
$find = trim ($find);

// attempt a connection
// $dbh = pg_connect(“host=hostname port=5432 dbname=dbname  user= username password=password”);
//if (!$dbh) {
//  die(“Error in connection: ” . pg_last_error());
// }
include_once(“connection/connection.php”);

// execute query
$sql = “SELECT * from table where $field = ‘$find’ limit 30 “;

$result = pg_query($dbh, $sql);
if (!$result) {
die(“Error in SQL query: ” . pg_last_error());
}

echo “<table border=’1′>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Email address</th>
</tr>”;

while ($row = pg_fetch_array($result)) {

echo “<tr>”;
echo “<td> ” . $row[0] . “</td>”;
echo ” <td>” . $row[1] . “</td>”;
echo “<td> ” . $row[2] . “</td>”;
echo “</tr>”;

}
echo “</table>”;

$rows = pg_num_rows($result);

if ($rows == 0)
{
echo “Sorry, but we can not find an entry to match your query<br><br>”;
}

//And we remind them what they searched for
echo “<b>Searched For:</b> ” .$find;

echo “<b>Number of rows :</b> ” .$rows;

// free memory
pg_free_result($result);

pg_close($dbh);
}
?>

 

 
Leave a comment

Posted by on September 6, 2011 in Centos, Fedora, Hosting, Internet, Linux, Red hat, Ubuntu

 

Tags:

Dual boot ubuntu 10.10 and fedora 14

So it’s been a long time since I have added a post but I decided to take time off and add one on this interesting topic.

I already had Ubuntu installed on my toshiba satellite laptop and now I decided to install fedora 14.

Once I installed Fedora it did not detect ubuntu and after a lot of Googling I found that I had to first recover ubuntu grub2 and then do
an update-grub to get the option of installing both.

I booted the system via live usb and installed the grub via the below command into the MBR

grub-install /dev/sda


Reboot

Then I ran ‘update-grub’ and did a reboot again but it did not detect fedora 14 and booted straight into ubuntu.
Again after a lot of googling I realized that since fedora was installed on the extended partition it was not detected.

So Now what? Well the solution was simple but it tool me a long time to find out.
All you need to do is install startup manager

sudo apt-get install startupmanager

run by typing

sudo startupmanager

and thats it it wil create the grub file along with the option to boot fedora

 
Leave a comment

Posted by on January 8, 2011 in Fedora, Linux, Ubuntu

 

Tags: , ,

Tcpdump to capture passwords

To skip straight to capture password click here

TCPdump is a very powerful command line interface packet sniffer. –

1. Install tcpdump
Ubuntu

sudo apt-get install tcpdump 

Fedora/Centos/Red hat

sudo yum install tcpdump

2. TCPDUMP USE
To display the Standard TCPdump output:

tcpdump

tcpdump: verbose output suppressed, use -v or -vv for full protocol decode

Network interfaces available for the capture:

 tcpdump -D

1.eth1
2.any (Pseudo-device that captures on all interfaces)
3.lo

– Capture the traffic of a particular interface:

 tcpdump -i eth0

– To capture the UDP traffic:

tcpdump udp

– To capture the TCP port 80 traffic:

 tcpdump port http

– To capture the traffic from a filter stored in a file:

 tcpdump -F file_name

To create a file where the filter is configured (here the TCP 80 port)

vim file_name

port 80

– To send the capture output in a file instead of directly on the screen:

tcpdump -w capture.log

– To read a capture file:

tcpdump -r capture.log

– To display the packets having “wordpress.com” as their source or destination address:

tcpdump host wordpress.com

– To display the FTP packets coming from 192.168.1.100 to 192.168.1.2:

tcpdump src 192.168.1.100 and dst 192.168.1.2 and port ftp

-And Finally to capture the password click here
Packets capture during a FTP connection. The FTP password can be easily intercepted because it is sent in clear text to the server.
We see in this capture the FTP username (amateur) and password (hosting).
You can use this incase you forget your ftp password and have stored it in your ftp client

Please note that this should not be used for any illegal and this blog will not be responsible for any actions that lead to illegal use

 
4 Comments

Posted by on November 8, 2010 in Centos, Fedora, Linux, Red hat, tools, Ubuntu

 

Tags: , , , , ,

Rapidshare Download Manager for Linux and Windows

JDownloader a.k.a JD

One of the best download managers, JD can be used to download from rapidshare, megaupload, filesserve, hotfile and numerous other sites.

JD

JD2

Jdownloader install on Ubuntu 10.04

sudo add-apt-repository ppa:jd-team/jdownloader

sudo apt-get update

sudo apt-get install jdowloader

You may face an issue where JD randomly closes when dowloads are active. In that case you need to update java as below

sudo apt-get install sun-java6-jre

sudo update-alternatives --config java
and select sun java

For windows it can be downloaded from the site jdownloader.com

 
Leave a comment

Posted by on August 13, 2010 in Internet, Linux, tools, Ubuntu, Windows

 

Tags:

 
%d bloggers like this: