Showing posts from 2013

Simple Python WebServer: Share/View your Linux Filesystem files over Http Server

A quick tip for Linux lovers.

Python allows you to start a quick http server by a single command.

Suppose you want to share files and directory of current working directory over http. No need to set up a complete web server for that. Python  can do this magic in a Single command.

 [root@clone-1 /]# python -m SimpleHTTPServer

Serving HTTP on port 8000 ...
localhost.localdomain - - [02/Dec/2013 10:15:18] "GET / HTTP/1.1" 200 -
localhost.localdomain - - [02/Dec/2013 10:15:22] "GET /boot/ HTTP/1.1" 200 -
localhost.localdomain - - [02/Dec/2013 10:15:24] "GET /boot/symvers-2.6.18-164.el5.gz HTTP/1.1" 200 -
localhost.localdomain - - [02/Dec/2013 10:15:32] "GET /home/ HTTP/1.1" 200 -
localhost.localdomain - - [02/Dec/2013 10:15:34] "GET /home/yogi/ HTTP/1.1" 200 - - - [02/Dec/2013 10:20:12] "GET / HTTP/1.1" 200 - - - [02/Dec/2013 10:20:12] code 404, message File not found - - [02/Dec/2013 …

Using MTS MBlaze on Mint Linux 14 / Ubuntu 12.04

Yes, Indeed ubuntu and Mint Linux both provides inbuilt support for MTS MBlaze , But sometime network GUI may not recognize your MTS dongle. You can configure "wvdial" to get online.

Install wvdial using
sudo apt-get install wvdial

Yes, you are right you should install it in advance ;).

You will also need usb-modeswitch and usb-modeswitch-data.this might come preinstalled with your distribution, You can check this under Synaptics Package Manager.

Then you need to modify /etc/wvdial.conf configuration file. This might not present on your system by default, But no worries You can generate it by using wvdialconf command

Yogi-Lenovo ~ # wvdialconf
Editing `/etc/wvdial.conf'.

Scanning your serial ports for a modem.

Modem Port Scan<*1>: S0   S1   S2   S3   S4   S5   S6   S7  
Modem Port Scan<*1>: S8   S9   S10  S11  S12  S13  S14  S15 
Modem Port Scan<*1>: S16  S17  S18  S19  S20  S21  S22  S23 
Modem Port Scan<*1>: S24  S25  S26  S27  S28  S29  S30  S31 

Linux Bash : Remove only numbers or patterns from a long list using SED and more

Q: I want to remove only numbers/specific patterns from a long list ?

You can use "sed" for the above task. Below is the command.
#cat filename | sed 's|[0-9]||g'Or if you want to KEEP ONLY numbers.

# cat filename | sed 's|[^0-9]||g'
Or anything you wish to skip in whole text. for eg "-" and "." in below example

#cat filename | sed 's|[-.-]||g'
A more BASH specific way can be ,if you do not wish to use sed:

while read line;do \ echo ${line//[0-9]/}; \ done< filename
Well only grep can also perform same stuff:

#cat test | grep -o '[^0-9-]*'

Hope you this little tricks helpful.

Related articlesUse multiple CPU Cores with your Linux commands -- awk, sed, bzip2, grep, wc, etc.In bash how to replace string variable, and set it into sed command

Check RPM installed recently on RedHat/CentOS

Q: How do I check that which rpm's have installed recently on my RedHat/CentOS machine ?

RPM provide various ways to manage, update, installation, uninstall of packages.
To check what rpm's installed recently we can use following command.

[root@linuxskool]# rpm -qa --last
perl-rrdtool-1.4.7-1.el5.rf                   Thu 11 Jul 2013 05:16:36 PM IST
rrdtool-1.4.7-1.el5.rf                          Thu 11 Jul 2013 05:16:35 PM IST
ruby-1.8.5-29.el5_9                            Thu 11 Jul 2013 05:16:34 PM IST
libdbi-0.8.1-2.1                                   Thu 11 Jul 2013 05:16:34 PM IST

ruby-libs-1.8.5-29.el5_9                      Thu 11 Jul 2013 05:16:33 PM IST

or more clearly

[root@linuxskool]# rpm -qa --last | less

Hope you find this quick tip useful.

Ubuntu 13.10 (Saucy Salamander)

Canonical Ubuntu 13.10 Now AvailablePosted By: Yogesh Upadhyay
The latest Ubuntu is now available to download. Canonical said on Thursday that Ubuntu 13.10 for desktop and smartphone is nowavailable. This release includes a wide range of mobile core apps created by the Ubuntu developer community, including a browser, calendar, clock, weather, and calculator. The company also said that it's working with partners to bring Ubuntusmartphone devices to market in 2014. "This is a milestone in Ubuntu's history; the exact same Ubuntu OS runs on ARM phones and modern HP Moonshot ARM servers, and provides exactly the same capability as x86 platforms," said Rick Spencer, who leads Ubuntu's consumer-facing engineering. "Ubuntu 13.10 is a full server-grade OS that offers a mobile experience and is lean enough to support mobile devices, kicking off a new era in mobile security and computing convergence." The release of Ubuntu 13.10 also brings the full SDK for developi…

Awesome AWK

Awk  Introduction and Printing Operations Awk is a programming language which allows easy manipulation of structured data and the generation of formatted reports. Awk stands for the names of its authors “Aho, Weinberger, and Kernighan” The Awk is mostly used for pattern scanning and processing. It searches one or more files to see if they contain lines that matches with the specified patterns and then perform associated actions. Some of the key features of Awk are: Awk views a text file as records and fields.Like common programming language, Awk has variables, conditionals and loopsAwk has arithmetic and string operators.Awk can generate formatted reports Awk reads from a file or from its standard input, and outputs to its standard output. Awk does not get along with non-text files.
Syntax: awk '/search pattern1/ {Actions} /search pattern2/ {Actions}' file In the above awk syntax: search pattern is a regular expression.Actions – statement(s) to be performed.several pattern…

How to check Perl Module version in Linux

Q: How to check installed perl module version on linux ?

On terminal type following command, replace <module_name> with your perl module.

    #perl -M<module_name> -e "print \"$1: \$<module_name>::VERSION\n\""

Further you can create a simple bash script which accepts module name as input in first positional parameter.


if [ x$1 == "x" ]
        echo "Usage: $0 <Module>"
        perl -M$1 -e "print \"$1: \$$1::VERSION\n\""

Save it, lets say as "" or "perlv", provide executable permission and kept it under "/usr/bin" or wherever you wish, then you can use it as handy command.

[root@linuxskool root]# perlv JSON::Any
                         JSON::Any: 1.16

How Akamai routes traffic

One of the big selling points of using Akamai is their ability to route traffic around internet bottlenecks.  The public internet routes traffic using plain oldBorder Gateway Protocol(BGP), which is designed to find a path from point A to point B based on how networks are interconnected.  However, it is not concerned with throughput speeds for those networks, so if there is congestion at a particular node, BGP will continue to send traffic through it, effectively slowing everybody down. In contrast, Akamai is constantly measuring throughput on various network segments, and they are able to identify alternate paths.  For example, when there is a cable break in Asia, BGP protocols will tend to overload certain nodes as they start using alternate paths for data.  Akamai is able to detect that those nodes are overloaded and choose other alternative paths for better performance. All of Akamai’s edge servers around the world are able to communicate with each other using this proprietary rou…

Grsecurity: Configure RHEL5/6 Kernel for Grsecurity


Grsecurity is a set of patches for the Linux kernel with an emphasis on enhancing security. It allows the system administrator to, among other things, define a least privilege policy for the system, in which every process and user have only the lowest privileges needed to function.Security is a prime concern for an Linux Administrator, specially for Internet facing systems or websites where a vulnerability can make intruder’s day. Grsecurity is a set of patches which can be useful to mitigate kernel security loopholes and provide a more reliable and secure system. Developed by Brad Spengle licensed under GNU General Public License available only for Linux kernel. Grsecurity is a Free Software. PAX: A major component of GrSecurity is bundeled with PaX, the patch flags data memory, for example , as non-executable and program memory as non-writable. The aim is to prevent memory from being overwritten, which can help to prevent many types of security vulnerabilities. PaX is a Patch