linux poison RSS
linux poison Email
1

Free Guide - Web Application Security; How to Minimize Prevalent Risk of Attacks

"Web Application Security; How to Minimize Prevalent Risk of Attacks"

Vulnerabilities in web applications are now the largest vector of enterprise security attacks.

Stories about exploits that compromise sensitive data frequently mention culprits such as "cross-site scripting," "SQL injection," and "buffer overflow." Vulnerabilities like these fall often outside the traditional expertise of network security managers.

To help you understand how to minimize these risks, Qualys provides this guide as a primer to web application security.

The guide covers:
 * Typical web application vulnerabilities
 * Comparison of options for web application vulnerability detection
 * QualysGuard Web Application Scanning solution

Download your free copy of "Web Application Security; How to Minimize Prevalent Risk of Attacks" - here


Read more
0

Manage your Flickr Photo from Ubuntu Desktop - Frogr

Frogr is a small application for the GNOME desktop that allows users to manage their accounts in the Flickr image hosting website. It supports all the basic Flickr features, including uploading pictures, adding descriptions, setting tags and managing sets and groups pools.

Frogr Features:
 * Allow to upload pictures to flickr, specifying details such as title, description, tags, visibility, content type, safety level and whether the to "show up on global search results", both individually or to several pictures at once.
 * Allow uploading pictures located in remote machines, through typically supported protocols (SAMBA, SSH, FTP...).
 * Allow sorting pictures by title and date taken, besides the default order ("as loaded").
 * Allow adding tags to pictures, opposite to just set them through the 'details' dialog.
 * Allow setting specific licenses and geolocation information for pictures right from the desktop.
 * Allow specifying sets and group pools for the pictures to be added to after the upload process.
 * Allow to create sets right from frogr, opposite to just adding pictures to already existing ones.
 * Allow specifying a list of pictures to be loaded from command line.
 * Import tags from picture's metainformation if present when loading.

Read more
0

Install Tor Browser Bundle under Ubuntu Linux

Tor protects you by bouncing your communications around a distributed network of relays run by volunteers all around the world: it prevents somebody watching your Internet connection from learning what sites you visit, and it prevents the sites you visit from learning your physical location. Tor works with many of your existing applications, including web browsers, instant messaging clients, remote login, and other applications based on the TCP protocol.

The Tor Browser Bundle lets you use Tor on Windows, Mac OS X, or Linux without needing to install any software. It can run off a USB flash drive, comes with a pre-configured web browser to protect your anonymity, and is self-contained.

Read more
0

Free eBook - Linux Email -- Free Sample Chapter

"Linux Email -- Free Sample Chapter"

Set up, maintain, and secure a small office email server.
Many businesses want to run their email servers on Linux for greater control and flexibility of corporate communications, but getting started can be complicated. The attractiveness of a free-to-use and robust email service running on Linux can be undermined by the apparent technical challenges involved. Some of the complexity arises from the fact that an email server consists of several components that must be installed and configured separately, then integrated together. This book gives you just what you need to know to set up and maintain an email server. Unlike other approaches that deal with one component at a time, this book delivers a step-by-step approach across all the server components, leaving you with a complete working email server for your small business network.

This free sample chapter, Chapter 4: Providing Webmail Access, shows how to set up webmail access using SquirrelMail. This will give users an easy, out-of-office access to their email. Be introduced to the SquirrelMail software package and examine the pros and cons of this and other webmail access solutions. After that, it will follow the installation and configuration of SquirrelMail step by step. Next, it will examine the installation of plugins and include a reference of useful plugins. Finally, it will include some tips on how to secure SquirrelMail.

Download your free sample chapter - here



Read more
1

Bash Script - Protect your server from DDos (Distributed Denial of Service) Attack

What is DDos attack:
On the Internet, a distributed denial-of-service (DDoS) attack is one in which a multitude of compromised systems attack a single target, thereby causing denial of service for users of the targeted system. The flood of incoming messages to the target system essentially forces it to shut down, thereby denying service to the system to legitimate users.

DDoS-Deflate is a very simple but effective bash script which monitors the numbers of connection made by a particular ip address using 'netstat' command and if the number of connection from a single ip address reaches a particular limit (150 default) it will block that ip address using simple iptables rules for defined time period.

DDoS-Deflate Installation:
Open the terminal and type following command:
wget http://www.inetbase.com/scripts/ddos/install.sh
chmod 0700 install.sh
./install.sh
After successful installation, you can find the DDoS-Deflate configuration file at: /usr/local/ddos/ddos.config
Read more
0

White Paper - Enforcing Enterprise-out Security for Cloud Servers

"Enforcing Enterprise-out Security for Cloud Servers"

Learn how to maintain a secure environment in the cloud.

Cloud-based computing models offer the promise of a highly scalable compute infrastructure without having to acquire, install and maintain any additional hardware. However, implementing this new compute model using even the most trusted service providers requires a security solution that empowers IT to maintain control over user and network access to those hosted virtual machines.

Security becomes even more important given the regulatory climate and audit pressures surrounding PCI, SOX, BASEL II and HIPAA. Centrify solves these difficult problems by providing an enterprise-out security enforcement approach that leverages existing Active Directory-based security policy enforcement and IPsec-based server and domain isolation. Together, these technologies enable rapid expansion of cloud compute capacity while still maintaining a secure environment.

Download your free white paper on "Enforcing Enterprise-out Security for Cloud Servers" - here



Read more
0

Perl Script - Manipulating Arrays of Arrays (Multidimensional Arrays)

Below is simple Perl scrip which demonstrate the usage of multi-dimension arrays (array of arrays)

Feel free to copy and use this code ..

Source: cat multi-dimensional_array.pl
#!/usr/bin/perl

# Multi-dimension array by reference.
$array = ["A", "B", ["1", "2", "3",  ["x", "y", "z"]]];

print "\$array->[0] == $array->[0] \n";
print "\$array->[1] == $array->[1] \n";

print "\$array->[2][1] == $array->[2][1] \n";
print "\$array->[2][2] == $array->[2][2] \n";

print "\$array->[2][3][0] == $array->[2][3][0] \n";
print "\$array->[2][3][1] == $array->[2][3][1] \n";
print "\$array->[2][3][2] == $array->[2][3][2] \n";

print " --------------------------------------- \n" ;

@array1 = (
  "A", "B",
  ["1", "2", "3",  ["x", "y", "z"]]
);

Read more
0

Perl Script: Creating pointers (References) to variable, Array and Hash

A reference is a scalar value that points to a memory location that holds some type of data. Everything in your Perl program is stored inside your computer's memory. Therefore, all of your variables, array, hash and functions are located at some memory location. References are used to hold the memory addresses.

Below is simple Perl script which demonstrate the usage of reference ...

Source: cat pointer.pl
#!/usr/bin/perl

# Creating pointer to a variable.
$var = 10;
$pointer = \$var;
print "Pointer address is: $pointer \n";
print "value store at $pointer is $$pointer \n";

print "--------------------------------\n";

# Creating pointer to an array.
@array = ("1", "2", "3", "4");
$array_pointer = \@array;
print "Address of the array in the memory: $array_pointer \n";

$len = scalar(@$array_pointer);
print "Length of the array: $len \n";

for ($i=0; $i<$len; $i++) {
  print "$$array_pointer[$i] \n";
}
Read more
0

Perl Script: Signal Handling

You can control how your program responds to signals it receives. To do this, modify the %SIG associative array. This array contains one element for each available signal, with the signal name serving as the subscript for the element.

Below is simple Perl script which demonstrate the way to handle the interrupt signal...

Source: cat signal.pl
#!/usr/bin/perl

$SIG{"INT"} = "catch_signal";
while (1){
        print "waiting for signal ... press ctl+c to catch the interrupt signal \n";
        sleep(1);
}

sub catch_signal {
        print "\n Kool, I am able to handle interrupt signal \n";
        exit();
}

Output: perl signal.pl
waiting for signal ... press ctl+c to catch the interrupt signal
waiting for signal ... press ctl+c to catch the interrupt signal
waiting for signal ... press ctl+c to catch the interrupt signal
waiting for signal ... press ctl+c to catch the interrupt signal
waiting for signal ... press ctl+c to catch the interrupt signal
^C
 Kool, I am able to handle interrupt signal


Read more
0

Perl Script: Read the Environment Variables

The %ENV associative array lists the environment variables defined for a program and their values. The environment variables are the array subscripts, and the values of the variables are the values of the array elements.

Source: cat env_variable.pl
#!/usr/bin/perl

$term = $ENV{"TERM"};
print "Terminal you are using: $term \n";

$desktop = $ENV{"DESKTOP_SESSION"};
print "Desktop you are using: $desktop \n";

$lang = $ENV{"LANGUAGE"};
print "Lang you are using: $lang \n";

Output: perl env_variable.pl
Terminal you are using: xterm
Desktop you are using: kde-plasma
Lang you are using: en_US:


Read more
0

Free eBook - Website Security Threat Report

"Website Security Threat Report"

Updates from Symantec's Internet Security Threat Report.
The Internet Security Threat Report provides an overview and analysis of the year in global threat activity. The report is based on data from the Global Intelligence Network, which Symantec's analysts use to identify, analyze, and provide commentary on emerging trends in attacks, malicious code activity, phishing, and spam.

This shortened version of the report - the Website Security Threat Report - has been created to specifically focus on website security issues.

Download your free copy of Website Security Threat Report - here


Read more
0

Database tool for Developers and Database Administrators - DBeaver

DBeaver is free universal database tool for developers and database administrators.

 * It is freeware.
 * It is multiplatform.
 * It is based on opensource framework and allows writing of various extensions (plugins).
 * It supports any database having a JDBC driver.
 * It may handle any external datasource which may or may not have a JDBC driver.
 * There is a set of plugins for certain databases (MySQL and Oracle in version 1.x) and different database management utilities (e.g. ERD).

Supported databases:
MySQL, Oracle, PostgreSQL, IBM DB2, Microsoft SQL Server, Sybase, ODBC, Java DB (Derby), Firebird (Interbase), HSQLDB, SQLite, Mimer, H2, IBM Informix, SAP MAX DB, Cache, Ingres, Linter, Teradata, Any JDBC compliant data source

Read more
0

Open Source Host-based Intrusion Detection System - OSSEC

OSSEC is an Open Source Host-based Intrusion Detection System that performs log analysis, file integrity checking, policy monitoring, rootkit detection, real-time alerting and active response.

It runs on most operating systems, including Linux, MacOS, Solaris, HP-UX, AIX and Windows.

OSSEC Features:
OSSEC is a full platform to monitor and control your systems. It mixes together all the aspects of HIDS (host-based intrusion detection), log monitoring and SIM/SIEM together in a simple, powerful and open source solution.

 * Compliance Requirements
 * Multi platform
 * Real-time and Configurable Alerts
 * Integration with current infrastructure
 * Centralized management
 * Agent and agentless monitoring
 * File Integrity checking
 * Log Monitoring
 * Rootkit detection
 * Active response

Read more
1

Free eBook - Citrix NetScaler - A Foundation for Next-Generation Datacenter Security

"Citrix NetScaler - A Foundation for Next-Generation Datacenter Security"


Today's regulatory requirements and evolving network architectures can make data-center security feel like a moving target.

This technical paper is designed to help you build a flexible, powerful security solution that reduces costs by leveraging your existing load balancing and ADC infrastructure.

Application Security - with web app firewall security, Data Loss Protection (DLP) and app-layer Denial of Service (DoS) defenses

Network/Infrastructure Security - including high-performance SSL, DNS security and multiple network-level attack protections

Identity and Access Management - for flexible application access control based on strong user authentication, app authorization and detailed auditing

Management - seamless integration with leading third-party products to extend reporting, analytics, vulnerability assessment capabilities

Download your free copy of - Citrix NetScaler - A Foundation for Next-Generation Datacenter Security - here


Read more
0

Free eBook - HackerProof: Your Guide to PC Security

"HackerProof: Your Guide to PC Security"

This 53 page guide provides an objective, detailed, but easily understood walk through of PC security.

The terms "PC security" or "computer security" are vague in the extreme. They tell you very little, like most general terms. This is because PC security is an incredibly diverse field. On the one hand you have professional and academic researchers who carefully try to find and fix security issues across a broad range of devices. On the other hand, there is also a community of inventive computer nerds who are technically amateurs (in the literal sense of the word – they're unpaid and unsupported by any recognized institution or company) but are highly skilled and capable of providing useful input of their own.

PC security is linked to computer security as a whole, including issues like network security and Internet security. The vast majority of the threats that may attack your computer are able to survive only because of the Internet and, in some cases, the survival of a security threat is directly linked to a security flaw in some high-end piece of server hardware. However, the average PC user has no control over this.

By the end of this guide you will know exactly what PC security means and, more importantly, what you need to do to keep your PC secure. Also with this free guide you will also receive daily updates on new cool websites and programs in your email for free courtesy of MakeUseOf.

Download your free copy of "HackerProof: Your Guide to PC Security" - here


Read more
0

Perl Script: Input Line/record Separator examples

The input line/record separator ($/) is set to newline by default. Works like awk's RS variable, including treating blank lines as delimiters if set to the null string. You may set it to a multi-character string to match a multi-character delimiter, or can be set to the numeric value.

Below is simple perl script which demonstrate the usage of input record separator, feel free to copy and use this script.

Input File: cat testfile.txt
google:yahoo:microsoft:apple:oracle:hp:dell:toshiba:sun:redhat

Source: cat separator.pl
#!/usr/bin/perl

$FILE = "testfile.txt";
open (INFILE, $FILE) or die ("Not able to open the file");
$/ = ":";
while ($record = <INFILE>) {
        print "$record \n";
}

Read more
0

Convert your media files to all the popular formats - Format Junkie

Format Junkie is an Graphical User Interface user-friendly application with lots of options, which can convert your media files to all the popular formats! Unity integration has been bear in mind.

Specifically, it has the following features:

a) Audio: Conversion between the audio formats: mp3, mp2, wav, ogg, wma, flac, m4r, m4a and aac
b) Video: Conversion between the video formats: avi, ogv, vob, mp4, vob, flv, 3gp, mpg, mkv, wmv
c) Image: Conversion between the image formats: jpg, png, ico, bmp, svg, tif, pcx, pdf, tga, pnm
d) Iso|Cso Create an iso with selected files, convert iso to cso and vice versa.
e) Advanced Encode subtitles to an avi file.

Read more
0

Free eBook - Build and Deploy Application using Open-Source Products

"SOA and WS-BPEL: Free 316 Page eBook"

Build and deploy your own service-oriented application using open-source products PHP and ActiveBPEL engine, as described in this easy-to-follow tutorial eBook.

Web services, while representing independent units of application logic, of course, can be used as stand-alone applications fulfilling requests from different service requestors. However, the real power of web services lies in the fact that you can bind them within service compositions, applying the principles and concepts of Service-Oriented Architecture. Ideally, web services should be designed to be loosely coupled so that they can potentially be reused in various SOA solutions and used for a wide range of service requestors.

As the name implies, the main idea behind this eBook is to demonstrate how you can implement Service-Oriented Solutions using PHP and ActiveBPEL Designer—free software products allowing you to effectively distribute service processing between the web/PHP server and ActiveBPEL orchestration engine. When it comes to building data-centric services, the eBook explains how to use MySQL or Oracle Database XE, the most popular free databases.

This practical eBook explains in extensive detail how to build Web Services with PHP and then utilize them within WS-BPEL orchestrations deployed to the ActiveBPEL engine.

Download your free copy of "SOA and WS-BPEL" - here


Read more
0

Multi-platform EPUB ebook editor - Sigil

Sigil is a multi-platform EPUB ebook editor with the following features

 * Online Sigil User's Guide, and Wiki documentation
 * Free and open source software under GPLv3
 * Multi-platform: runs on Windows, Linux and Mac
 * Full UTF-16 support
 * Full EPUB 2 spec support
 * Multiple Views: Book View, Code View and Preview View
 * WYSIWYG editing in Book View
 * Complete control over directly editing EPUB syntax in Code View
 * Table of Contents generator with multi-level heading support
 * Metadata editor with full support for all possible metadata entries (more than 200) with full descriptions for each
 * User interface translated into many languages
 * Spell checking with default and user configurable dictionaries
 * Full Regular Expression (PCRE) support for Find & Replace
 * Supports import of EPUB and HTML files, images, and style sheets,
 * Documents can be validated for EPUB compliance with the integrated FlightCrew EPUB validator
 * Embedded HTML Tidy: all imported files have their formatting corrected, and your editing can be optionally cleaned

Read more
0

Free eBook - Think Like a Hacker for Better Security

Receive Your Complimentary White Paper NOW!

"Takes One to Know One: Think Like a Hacker for Better Security Awareness"

52% of businesses experienced more malware infections as a result of employees on social media.
Security awareness is mostly about common sense, and thinking like the hackers to understand what security weaknesses they look for. But like other security precautions, it's easy to let down your guard.

Security awareness education can arm your staff with the skills to practice safe Internet usage - to reduce malware and other cyber threats.

Get you free copy of "Think Like a Hacker for Better Security" - here


Read more
0

eBook - Getting Started with Ubuntu 12.10

"Getting Started with Ubuntu 12.10"


This 143 Page guide will cover the basics of Ubuntu 12.10 (such as installation and working with the desktop) as well as guide you through some of the most popular applications.

Getting Started with Ubuntu 12.10 is not intended to be a comprehensive Ubuntu instruction manual. It is more like a quick start guide that will get you doing the things you need to do with your computer quickly and easily, without getting bogged down with all the technical details. Ubuntu 12.10 incorporates many new features including a new kernel supporting newer graphic cards, updates to the Update Manager, and full-disk encryption, to name just a few.

Download you free copy of "Getting Started with Ubuntu 12.10" - here


Read more
0

Mount, encrypt and manage disk image files and physical disk drives - eMount

eMount is a free system administrator tool for Linux that can mount, encrypt and manage disk image files and physical disk drives. It relies on cryptsetup, which implements the LUKS disk encryption specification.

eMount Features:
 * Create plain and encrypted disk images using one of the following file systems: ext2, ext3, ext4, FAT-16, FAT-32, HFS, HFS+, NTFS, ReiserFS and XFS.
 * Create encrypted volumes from physical disk drives.
 * Mount system partitions and virtual disks from the GUI or command line. The source can be plain or encrypted. List of supported file systems is O/S dependent. ISO images are widely supported.
 * Enlarge disk images (ext2, ext3, ext4, ReiserFS and XFS).
 * Copy to clone devices and disk images.
 * Supports all ciphers and hash algorithms provided by the operating system.

Read more
0

Perl Script: Insert, Replace or Delet the range of elements from an Array - splice

The Perl splice function is an array manipulation function and is used to remove, replace or add elements.
splice (@ARRAY, OFFSET, LENGTH, LIST)
where:
ARRAY - is the array to manipulate
OFFSET - is the starting array element to be removed
LENGTH - is the number of elements to be removed
LIST - is a list of elements to replace the removed elements with

The splice function returns:
in scalar context, the last element removed or undef if no elements are removed
in list context, the list of elements removed from the array

Below is simple perl script which demonstrate the use of this splice function, feel free to use and copy this code
Read more
0

Multitrack Non-Linear Video Editor - Flowblade

Flowblade Movie Editor is a multitrack non-linear video editor for Linux released under GPL 3 license.

Flowblade is designed to provide a fast, precise and as-simple-as-possible editing experience.

Flowblade employs film style editing paradigm in which clips are usually automatically placed tightly after the previous clip - or between two existing clips - when they are inserted on the timeline. Edits are fine tuned by trimming in and out points of clips, or by cutting and deleting parts of clips. Film style editing is faster for creating programs with mostly straight cuts and audio splits, but may be slower when programs contain complex composites unless correct work flow is followed.

Flowblade provides powerful tools to mix and filter video and audio.

Flowblade Features
Film style insert/trim editing paradigm
 * 2 move modes
 * 2 trim modes
 * 4 methods to insert/overwrite/append a clip on the timeline
 * Drag'n'Drop clips on the timeline
 * Clip and Compositor parenting with other clips
 * 5 video tracks and 4 audio tracks
Read more
0

Free and OpenSource Mobile Media Converter application

The Mobile Media Converter is a free audio and video converter for converting between popular desktop audio and video formats like MP3, Windows Media Audio (wma), Ogg Vorbis Audio (ogg), Wave Audio (wav), MPEG video, AVI, Windows Media Video (wmv), Flash Video (flv), QuickTime Video (mov) and commonly used mobile devices/phones formats like AMR audio (amr) and 3GP video. iPod/iPhone and PSP compatible MP4 video are supported. Moreover, you can remove and add new formats or devices through the internet.

An integrated YouTube downloader is available for direct downloading and converting to any of these formats. You can trim your clips for ringtone creation or any other purpose and crop your videos for removing up/down black bars or other unwanted parts of the image. Additionally, embedded subtitles can be encoded onto the video for watching movies or shows with subtitles on devices that does not supports them. Finally, a built-in DVD ripper is available to transform your own DVDs to any of the supported formats.

Read more
2

OpenSource Distribution for Art Creative People - Ubuntu Studio

Ubuntu Studio is Linux-based operating system designed as a free, open, and powerful platform for creative people to create their art.

Ubuntu Studio is also Free and Open Source Software (FOSS). Ubuntu Studio free to download and use. You can get the source code, study it and modify it. You can redistribute Ubuntu Studio and can even redistribute your modified version.

As an officially recognized derivative of Ubuntu, Ubuntu Studio is supported by Canonical Ltd. and an amazing and continually increasing community.

Ubuntu Studio is released every six months, but a long term release (LTS) version is released only every 2 years.
Read more
0

Perl Script: How to execute bash (or other) scripts from within the Perl script

system() executes the command specified. It doesn't capture the output of the command.

system() accepts as argument either a scalar or an array. If the argument is a scalar, system() uses a shell to execute the command ("/bin/sh -c command"); if the argument is an array it executes the command directly, considering the first element of the array as the command name and the remaining array elements as arguments to the command to be executed.

For that reason, it's highly recommended for efficiency and safety reasons (specially if you're running a cgi script) that you use an array to pass arguments to system().

Below is simple perl script which explains the concept of system() function call.
Read more
0

Perl Script: How to seek through the file

Perl provides two functions which enable you to skip forward or backward in a file so that you can skip or re-read data.

seek - moves backward or forward
tell - returns the distance in bytes, between the beginning of the file and the current position of the file

The syntax for the seek function is:
seek (file, distance, from)

As you can see, seek requires three arguments:

file: which is the file variable representing the file in which to skip
distance: which is an integer representing the number of bytes (characters) to skip
from:which is either 0, 1, or 2

-- 0 :  the number of bytes to skip from beginning of the file.
-- 1 :  the number of bytes to skip from current location of the file.
-- 2 :  the number of bytes to skip from end of the file.

Below is simple Perl script which demonstrate the usage of seek and tell.
Read more
2

Cheat Sheet - Unix/Linux Command Reference

"Unix/Linux Command Reference"

In this cheat sheet you will find a bunch of the most common Linux commands that you're likely to use on a regular basis.

On most systems you can lookup detailed information about any command by typing man command_name. You will need to be root user in order to use some of these commands. Be extremely careful as root if you're not 100% sure about what you're doing. You can make your system unusable. Even if you have a dual boot setup you may not be able to access any of your installed operating systems. Also with this free cheat sheet you will receive daily updates on new cool websites and programs in your email for free, courtesy of MakeUseOf.

Download you free copy of "Cheat Sheet - Unix/Linux Command Reference" - here


Read more
0

Perl Script: Creating key-value pair (hash table) using Associative arrays


Associative arrays are a very useful and commonly used feature of Perl.

Associative arrays basically store tables of information where the lookup is the right hand key (usually a string) to an associated scalar value. Again scalar values can be mixed ``types''.

Below simple script demonstrate the usage of associative array and shows all the possible operation that can be done on this associative array.

Source: cat associative_array.pl
#!/usr/bin/perl

# Creating Associative Arrays
%array = ("a", 1, "b", 2, "c", 3, "d", 4);

# Add more elements to the array
$array{"e"} = 5;

# Get all the keys.
@keys = sort keys(%array);
print "Keys present in the arrays are: @keys \n";

# Get all the values.
@values = sort values(%array);
print "Values present in the arrays are: @values \n";

# Get the value by referring to the key.
print "Enter the value between: ";
$getvalue = <STDIN>;
chop($getvalue);
print "value present for the $getvalue: $array{$getvalue} \n";

# Loop though the array
foreach $key (sort(keys(%array))) {
        print "$key : $array{$key} \n";
}

# Delete the key-value pair
delete($array{"a"});

# Copy associative array to normal array.
@array1 = %array;
print "Now the normal array contains: @array1 \n";

Read more
0

Perl Script: Predefine Perl subroutine (BEGIN, END and AUTOLOAD)


Perl defines three special subroutines that are executed at specific times.

 * The BEGIN subroutine, which is called when your program starts.
 * The END subroutine, which is called when your program terminates.
 * The AUTOLOAD subroutine, which is called when your program can't find a subroutine to executed.

Below is simple perl script which demonstrate the usage of these predefine perl subroutines.

Source: cat predefine_fun.pl
#!/usr/bin/perl

# This will get executed first when your program is started.
BEGIN {
        print "Starting the loop ... \n";
        print " ------------------------- \n";
}

# This will get executed when your program terminates.
END {
        print " ------------------------- \n";
        print "End of this perl script \n";
        print "Perl is awesome :) \n";
}

# This is called whenever the Perl try to call a subroutine that does not exist.
AUTOLOAD {
        print "Oosp, we are not able to find the required function : $AUTOLOAD \n";
        print "This is bad \n"
}

for ($i = 0; $i < 5 ;$i++ ) {
        print "$i \n";
}

&doesnotexists;


Read more
0

Perl Script: Passing Array by Reference to Function

If the array being passed to a function is large, it might take some time (and considerable space) to create a copy of the array when the function is called by passing the array and may have some impact on the performance of your application.

To overcome this problem Perl also allow you to pass the reference of this array to an function, with this approach the local copy of this array is not created but instead the operation is done on the main array and hence it saves the time and space for your application.
 
The following is an example of a similar subroutine that refers to an array by reference:

Source: cat array_aliasing.pl
#!/usr/bin/perl

@array = (1, 2, 3, 4, 5);
&array_ref (*array);
print "The new value of same array is: @array \n";

sub array_ref {
        local (*printarray) = @_;
        for ($i = 0; $i <= $#printarray ; $i++) {
                @printarray[$i] = int (rand(100) + 5);
        }
}

print "-------------------------------- \n";

@array2 = (1, 2, 3, 4, 5);
&array_ref2 (@array2);
print "Oops, the value of array2 is not changed: @array2 \n";

sub array_ref2 {
        local @sub_array = @_;
        for ($i = 0; $i <= $#sub_array ; $i++) {
                @sub_array[$i] = int (rand(100) + 5);
        }
}

Read more
1

Free eBook - Ubuntu: An Absolute Beginners Guide

"Ubuntu: An Absolute Beginners Guide"

Ubuntu is a free, open-source computer operating system with 20 million users worldwide.

This 30 page guide was written for beginners and will tell you everything you need to know about the Ubuntu experience. You will learn how to install and setup Ubuntu on your computer, find technical support in your community, understand the Ubuntu philosophy, navigate the Unity desktop interface and use Ubuntu compatible software programs. Also with this free guide you will receive daily updates on new cool websites and programs in your email for free courtesy of MakeUseOf.

Download you free copy of "Ubuntu: An Absolute Beginners Guide" - here


Read more
0

Perl Script: File test operators

Below is simple perl script which demonstrate the usage if file test operator ..
Feel free to use and copy this script:

Source: cat file_status.pl
#!/usr/bin/perl

$FILE = "server.txt";

if ( -b $FILE ){
        print "$FILE is block device \n";
}
if ( -c $FILE ){
        print "$FILE is char device \n";
}
if ( -d $FILE ){
        print "$FILE is dirctory \n";
}
if ( -e $FILE ){
        print "$FILE exists \n";
}
if ( -f $FILE ){
        print "$FILE is ordinary file \n";
}
if ( -l $FILE ){
        print "$FILE is symbolic link \n";
}
if ( -o $FILE ){
        print "$FILE is owned by current user. \n";
}

Read more
0

Perl Script: Array examples and Operations

Below perl script demonstrate the usage of array and show all sort of operation that can be done on the array.

Feel free to copy and use this script:

Source: cat array.pl
#!/usr/bin/perl

@array = ("a", "b", "c", "d");

# Get the lengthe of array
$LEN = @array;
print "Length of the array is:  $LEN \n";

# Print the array elements"
print "@array \n";
print "-------------------------\n";

# Iterate through the array
for ($i=0; $i<=$#array; $i++) {
        print "$array[$i]\n";
}
print "-------------------------\n";

# Add a new element to the end of the array
push(@array, "e");
print "@array \n";
print "-------------------------\n";

# Add an element to the beginning of an array
unshift(@array, "z");
print "@array \n";
print "-------------------------\n";

# Remove the last element of an array.
pop(@array);
print "@array \n";
print "-------------------------\n";

# Remove the first element of an array.
shift(@array);
print "Back to original array .... \n";
print "@array \n";
print "-------------------------\n";

# Copying from One Array Variable to Another
@copy_array = (@array);
print "Element in the new array are: @copy_array \n";
print "-------------------------\n";

# Sort the array element
@list = ("x" , "q", "p" , @array, 1, 3, 5, 9);
@sort_list = sort(@list);
print "Here is the sorted array: @sort_list \n";
print "-------------------------\n";

Read more
1

Bash Script: How to sort an array

Here is simple & dirty trick to sort any types of element in an array ...
Feel free to copy and use this script.

Source: cat sort_array.sh
#!/bin/bash

array=(a x t g u o p w d f z l)
declare -a sortarray

touch tmp
for i in ${array[@]}; do
        echo $i >> tmp
        `sort tmp -o tmp`
done

while read line; do
        sortarray=(${sortarray[@]} $line)
done < tmp
rm tmp

echo "Here is the new sorted array ...."
echo ${sortarray[@]}

Output: ./sort_array.sh
Here is the new sorted array ....
a d f g l o p t u w x z



Read more
1

Ebook - Self-Service Linux: Mastering the Art of Problem Determination

"Self-Service Linux®: Mastering the Art of Problem Determination - Free 456 Page eBook" -- The indispensable start-to-finish troubleshooting guide for every Linux professional.

Now, there's a systematic, practical guide to Linux troubleshooting for every power user, administrator, and developer. In Self-Service Linux®, two of IBM's leading Linux experts introduce a four-step methodology for identifying and resolving every type of Linux-related system or application problem: errors, crashes, hangs, performance slowdowns, unexpected behavior, and unexpected outputs. You'll learn exactly how to use Linux's key troubleshooting tools to solve problems on your own--and how to make effective use of the Linux community's knowledge.

If you use Linux professionally, this book can dramatically increase your efficiency, productivity, and marketability. If you're involved with deploying or managing Linux in the enterprise, it can help you significantly reduce operation costs, enhance availability, and improve ROI.

Series Editor Bruce Perens' is an open source evangelist, developer, and consultant whose software is a major component of most commercial embedded Linux offerings. He founded or co-founded Linux Standard Base, Open Source Initiative, and Software in the Public Interest. As Debian GNU/Linux Project Leader, he was instrumental in getting the system on two U.S. space shuttle flights.

Download your free copy of Mastering the Art of Problem Determination - here


Read more
0

Perl Script: Convert any given string To-Lower or To-Upper case

Below is simple perl script which converts any given string to Upper or to-Lower case ...
Here, we have used the perl Escape Sequence ( \U \L \E)

\U -- Convert all following letters to Uppercase
\L -- Convert all following letters to Lowercase
\E -- Ends the effect of \L, \U or \Q

Feel free to copy and use this code ...

Source: cat case-conversion.pl
#!/usr/bin/perl

print "Enter the string: ";
$var = <STDIN>;

print "To uppercase: \U${var}\E \n";
print "To lowercase: \L${var}\E \n";

Output: perl case-conversion.pl
Enter the string: LinuxPoison
To uppercase: LINUXPOISON
To lowercase: linuxpoison


Read more
0

An indispensable ebook for every Linux administrator

"Linux® Quick Fix Notebook- Free 696 Page eBook"

Instant access to precise, step-by-step solutions for every essential Linux administration task from basic configuration and troubleshooting to advanced security and optimization.

If you're responsible for delivering results with Linux, Linux® Quick Fix Notebook brings together all the step-by-step instructions, precise configuration commands, and real-world guidance you need. This distilled, focused, task-centered guide was written for sysadmins, netadmins, consultants, power users...everyone whose livelihood depends on making Linux work, and keeping it working.

This book's handy Q&A format gives you instant access to specific answers, without ever forcing you to wade through theory or jargon. Peter Harrison addresses virtually every aspect of Linux administration, from software installation to security, user management to Internet services--even advanced topics such as software RAID and centralized LDAP authentication. Harrison's proven command-line examples work quickly and efficiently, no matter what Linux distribution you're using. Here's just some of what you'll learn how to do:

 * Build Linux file/print servers and networks from scratch
 * Troubleshoot Linux and interpret system error messages
 * Control every step of the boot process
 * Create, manage, secure, and track user accounts
 * Install, configure, and test Linux-based wireless networks
 * Protect your network with Linux iptables firewalls
 * Set up Web, email, DNS, DHCP, and FTP servers

And much more...

By Peter Harrison. Published by Prentice Hall. Part of the Bruce Perens' Open Source Series.

Download your free copy of "Linux® Quick Fix Notebook" - here


Read more
3

Bash Script: Script to check internet connection

Below is simple bash script to test the Internet connection using wget utility.
Feel free to copy and use this script

Source: cat internet_connection.sh
#!/bin/bash

HOST=$1
WGET="/usr/bin/wget"

$WGET -q --tries=10 --timeout=5 $HOST
RESULT=$?

if [[ $RESULT -eq 0 ]]; then
        echo "Connection made successfully to $HOST"
else
        echo "Fail to make connection to $HOST"
fi

Output:
./internet_connection.sh http://yahoo.com
Connection made successfully to http://yahoo.com

./internet_connection.sh http://yahosssss.com
Fail to make connection to http://yahosssss.com


Read more
0

Bash Script: Commenting out the block of code using here document

Many times it required to comment out the huge block of code for debugging purpose and it is very annoying to put the "#" tag before each and every line of this code

Below shell script shows how to comment out the block of code using here document (: <<'COMMENT')

Source: cat comment_block.sh
#!/bin/bash

echo "statement before comment."
: <<'COMMENT'
echo "This is inside the comment block and will not get printed"
a=0
b=20
echo $((b/a))
echo "No error"
COMMENT

echo "This is after the comment block."
exit

Output: ./comment_block.sh
statement before comment.
This is after the comment block.


Read more
2

Bash Script: Transfer files through FTP from within script

Below shell script demonstrate the usage of FTP operation from within the bash script, feel free to copy and use this script:

Source: cat autoftp.sh
#!/bin/bash

if [ $# -ne 1 ]; then
        echo "Please provide the file path for ftp operation."
        exit
fi

USERNAME=linuxpoison
PASSWORD=password
FILENAME="$1"
FTP_SERVER=ftp.foo.com
echo "Starting the ftp operation ...."

ftp -n $FTP_SERVER <<Done-ftp
user $USERNAME $PASSWORD
binary
put "$FILENAME"
bye
Done-ftp

echo "Done with the transfer of file: $FILENAME"
exit

Output: ./autoftp.sh log.tar.gz
Starting the ftp operation ....
Done with the transfer of file: log.tar.gz


Read more
0

Free White Paper - The Trend from UNIX to Linux in SAP Data Centers

"The Trend from UNIX to Linux in SAP® Data Centers"

Linux has arrived in large SAP data centers, and the SAP customer base shows significant momentum in migrating from UNIX to Linux. To explain this development, the following white paper will provide information about which customers are migrating from UNIX to Linux, in terms of size and industrial sector, and why they are migrating.

The paper will provide statistical information on the market shares of originating UNIX flavors, and information on the distribution of source and target databases. It will present a model that compares the cost of UNIX implementations with that of Linux implementations, and it will demonstrate that Linux is ready for business-critical SAP implementations. It will also show that significant savings can be realized by migrating SAP system landscapes from UNIX to Linux.

Download your free copy of White paper (The Trend from UNIX to Linux in SAP® Data Centers) - here

Read more
3

Bash Script: Convert File from DOS to UNIX format

Common problem! If you need to exchange text files between DOS/Windows and Linux, be aware of the "end of line" problem. Under DOS, each line of text ends with CR/LF (Carriage return/Line feed), with LF under Linux. If you edit a DOS text file under Linux, each line will likely end with a strange--looking `M' character;

Below is simple shell script which converts the files in DOS format to Unix format
Feel free to copy and use this code

Source: cat dos_unix.sh
#!/bin/bash

if [ $# -ne 1 ]; then
        echo "Please provide the path of a valid DOS file"
        exit
fi

if [ ! -f "$1" ]; then
        echo "Cannot access file: $1"
        echo "Don't play, provide the vaild file."
        exit
fi

DOSFILE=$1
UNIXFILE=output.unix
CR='\015'

tr -d $CR < $DOSFILE > $UNIXFILE

echo "Done with the conversion"
echo "New output file is: $UNIXFILE"
exit

Read more
0

Bash Script: Get the Information about the caller of the function (backtrace)

Caller Returns  the  context  of  any active subroutine call (a shell function or a script executed with the . or source builtins). caller displays the line number and source filename of the current subroutine call.  If a non-negative integer is supplied as expr,  caller displays  the line number, subroutine name, and source file corresponding to that position in the current execution call stack.  This extra information may be used, for example, to print a stack trace. 

Below is simple bash script which demonstrate the usage of caller ...
feel free to copy and use this code

Source: cat caller.sh
#!/bin/bash

foo() {
        caller 0
        echo "In function: foo"
}

echo "Outside of the function"

goo() {
        echo "In function: goo"
        foo
}

goo

Output: ./caller.sh
Outside of the function
In function: goo
13 goo ./caller.sh
In function: foo

Read more
1

Bash Script: Write debugging information to /var/log/messages

logger is a shell command interface to the syslog system log module, it appends a user-generated message to the system log (/var/log/messages). You do not have to be root to invoke logger.

Below is the simple bash script to log the debugging information to /var/log/message
Feel free to copy and use the below code

Source: cat logger.sh
#!/bin/bash

echo -n "Enter your username: "
read username

logger -i "Username $username started the script"

echo -n "Enter your Password: "
read password

# This is just an sample for comparing the password
if [ "$password" = "linuxpoison" ]; then
        echo "welcome $username"
        logger -i "Authentication successful for $username."
else
        echo "your Username or password does not match"
        logger -i "Authentication failed for $username."
fi

Read more
0

Bash Script: Set the timeout for reading the user input

If TMOUT set to a value greater than zero, TMOUT is treated as the default timeout for the read builtin.  The select command terminates if  input does  not arrive after TMOUT seconds when input is coming from a terminal. 

In an interactive shell, the value is interpreted as the number of seconds to wait for input after issuing the primary prompt.  Bash terminates after waiting for that number of seconds if input does  not arrive.

Below is the bash script which explains the above concept ...
Feel free to copy and use this script

Source: cat timeout.sh
#!/bin/bash

TMOUT=5
echo -n "Enter you username: "
read username

if [[ -z $username ]]; then
        # No username provide
        username="Not Set"
        echo "Timeout, Run this script again and set your valid username..."
fi


Output: ./timeout.sh
Enter you username: Timeout, Run this script again and set your valid username...
Read more
1

Bash Script: Running part of the script in restricted mode

If Bash is started with the name rbash, or the --restricted or -r option is supplied at invocation, the shell becomes restricted. A restricted shell is used to set up an environment more controlled than the standard shell. A restricted shell behaves identically to bash with the exception that the following are disallowed or not performed:

 * Changing directories with the cd built-in.
 * Setting or unsetting the values of the SHELL, PATH, ENV, or BASH_ENV variables.
 * Specifying command names containing slashes.
 * Specifying a filename containing a slash as an argument to the . built-in command.
 * Specifying a filename containing a slash as an argument to the -p option to the hash built-in command.
 * Importing function definitions from the shell environment at startup.
 * Parsing the value of SHELLOPTS from the shell environment at startup.
 * Redirecting output using the ‘>’, ‘>|’, ‘<>’, ‘>&’, ‘&>’, and ‘>>’ redirection operators.
 * Using the exec built-in to replace the shell with another command.
 * Adding or deleting built-in commands with the -f and -d options to the enable built-in.
 * Using the enable built-in command to enable disabled shell built-ins.
 * Specifying the -p option to the command built-in.
Read more
0

Free eBook - The GNU/Linux Advanced Administration

"The GNU/Linux Advanced Administration"


The GNU/Linux systems have reached an important level of maturity, allowing to integrate them in almost any kind of work environment, from a desktop PC to the sever facilities of a big company.

In this ebook "The GNU/Linux Operating System", the main contents are related with system administration. You will learn how to install and configure several computer services, and how to optimize and synchronize the resources using GNU/Linux.

The topics covered in this 500+ page eBook include Linux network, server and data administration, Linux kernel, security, clustering, configuration, tuning, optimization, migration and coexistence with non-Linux systems. A must read for any serious Linux system admin.

Download your free copy of "The GNU/Linux Advanced Administration" - here


Read more
1

Free eBook - HA Solutions for Windows, SQL, and Exchange Servers

"HA Solutions for Windows, SQL, and Exchange Servers".

How to protect your company's critical applications by minimizing risk to disasters with high availability solutions.

When total data loss is possible, the absence of a disaster recovery program can put a business at risk. Although disasters are inevitable and, to a degree, unavoidable, being prepared for them is completely within your control.

Increasingly, IT has become the focal point of many companies' disaster planning. Creating a program to preserve business continuity and recover from disaster is one of the central value propositions that an IT department can contribute to an organization.

Download you free HA Solutions for Windows, SQL, and Exchange Servers eBook - here


Read more
2

Perl Script: How to find if variable is defined or not?

Below is a simple perl script which explains how to find if any given variable is defined or not.

Feel free to copy and use this code.

Source
: cat undefined.pl
#!/usr/bin/perl

use strict;
use warnings;

my $Undefined;
my $Defined = "linuxpoison";

print "The value of Undefined is ", defined $Undefined, "\n";
print "The value of Defined is ", defined $Defined, "\n";

print "------------------------------\n";

$Undefined = $Defined;
$Defined = undef;

print "The value of Undefined is ", defined $Undefined, "\n";
print "The value of Defined is ", defined $Defined, "\n";

Output: perl undefined.pl
The value of Undefined is
The value of Defined is 1
------------------------------
The value of Undefined is 1
The value of Defined is


Read more
0

Free eBook - GNU/Linux Basic

"GNU/Linux Basic"


This guide will introduce you to the world of GNU/Linux.
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux.

Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.

This guide is not intentionally based on any particular distribution, but in most examples and activities the book will be very specific so it will go into detail using Debian GNU/Linux (version 4.0 -Etch-).

Download your free eBook of "GNU/Linux Basic" from here


Read more
0

Bash Script: How to read password without dispalying on the terminal

Below is the simple script which reads the user's password without displaying on the terminal.

Feel free to copy and use this code.

Source: cat passwd.sh
#!/bin/bash

# Here the input passwd string will get display on the terminal
echo -n "Enter your passwd: "
read passwd
echo
echo "Ok, your passwd is: $passwd"
echo

# Now, lets turn off the display of the input field.

stty -echo
echo -n "Again, please enter your passwd: "
read passwd
echo
echo "Ok, your passwd is: $passwd"
echo
stty echo

Output: ./passwd.sh
Enter your passwd: linuxpoison

Ok, your passwd is: linuxpoison

Again, please enter your passwd:
Ok, your passwd is: linuxpoison.blog@gmail.com

As you can see above in the scrip, with the use of stty we can enable or disable the screen echo.


Read more
0

Free eBook - A Newbie's Getting Started Guide to Linux

Learn the basics of the Linux operating systems. Get to know what it is all about, and familiarize yourself with the practical side. Basically, if you're a complete Linux newbie and looking for a quick and easy guide to get you started this is it.

You've probably heard about Linux, the free, open-source operating system that's been pushing up against Microsoft. It's way cheaper, faster, safer, and has a far bigger active community than Windows, so why aren't you on it?

Like many things, venturing off into a completely unknown world can seem rather scary, and also be pretty difficult in the beginning. It's while adapting to the unknown, that one needs a guiding, and caring hand.

This guide will tell you all you need to know in 20 illustrated pages, helping you to take your first steps. Let your curiosity take you hostage and start discovering Linux today, with this manual as your guide! Don't let Makeuseof.com keep you any longer, and download the Newbie's Initiation to Linux. With this free guide you will also receive daily updates on new cool websites and programs in your email for free courtesy of MakeUseOf.

Download free eBook of "A Newbie's Getting Started Guide to Linux" - here


Read more
0

Bash Script: Calculate the total time taken by script execution

There is a bash predefined parameter SECONDS

Each  time  this  parameter  is referenced, the number of seconds since shell invocation is returned.  If a value is assigned to SECONDS, the value returned upon subsequent references is the number of seconds since the assignment plus the value assigned.  If SECONDS is unset, it loses its special properties, even if it is subsequently reset.

Below is simple bash script which demonstrate the usage of SECOND parameter

Source: cat time_taken.sh
#!/bin/bash

for i in {1..10}; do
        sleep 1
        echo $i
done

echo "Total time taken by this script: $SECONDS"

Output: ./time_taken.sh
1
2
3
4
5
6
7
8
9
10
Total time taken by this script: 10


Read more
1

Bash Script: Execute loop in background withing a script

Below is simple bash script which shows the way to make any loop execute in background, with this approach one can make the script to perform multiple things at the same time .... somewhat similar to multi threading.

In the example below, the '&' at the end of the first loop which makes this loop to go into background and at the same time second loop also gets started which makes both the loop to operate simultaneously.

Source: cat background-loop.sh
#!/bin/bash

for i in 1 2 3 4 5 6 7 8 9 10; do
  echo -n $i
done &

for i in a b c d e f g h i j k; do
  echo -n $i
done
echo

Output: ./background-loop.sh
abcdef1gh23ij4k5

Practical example: you can use above approach to copy some set of files to some other server or storage (backup) and at the same time you can perform the ftp job to copy other set of files to ftp server.



Read more
0

Bash Script: How read file line by line (best and worst way)

There are many-many way to read file in bash script, look at the first section where I used while loop along with pipe (|) (cat $FILE | while read line; do ... ) and also incremented the value of (i) inside the loop and at the end I am getting the wrong value of i, the main reason is that the usage of pipe (|) will create a new sub-shell to read the file and any operation you do withing this while loop (example - i++) will get lost when this sub-shell finishes the operation.

In second and the worst method, One of the most common errors when reading a file line by line is by using a for loop (for fileline in $(cat $FILE);do ..), which prints the every word in a file on separate line, because, for loop uses the default value of IFS (space).

In third perfect method, The while loop (while read line;do .... done < $FILE) is the most appropriate and easiest way to read a file line by line, see the example below.

Input: $ cat sample.txt
This is sample file
This is normal text file

Source: $ cat readfile.sh
#!/bin/bash

i=1;
FILE=sample.txt

# Wrong way to read the file.
# This may cause problem, check the value of 'i' at the end of the loop
echo "###############################"
cat $FILE | while read line; do
        echo "Line # $i: $line"
        ((i++))
done
echo "Total number of lines in file: $i"

# The worst way to read file.
echo "###############################"
for fileline in $(cat $FILE);do
        echo $fileline
done

# This is correct way to read file.
echo "################################"
k=1
while read line;do
        echo "Line # $k: $line"
        ((k++))
done < $FILE
echo "Total number of lines in file: $k"

Read more
0

Bash Script: Using IFS to split the strings into tokens

IFS (Internal Field Separator) is one of Bash's internal variables. It determines how Bash recognizes fields, or word boundaries, when it interprets character strings.

$IFS defaults to whitespace (space, tab, and newline), but can be changed, below example show you how to change the IFS value to split the strings into tokens based on any delimiter, in our case we are using ':' to split the string into tokens.

Source: cat ifs.sh
#!/bin/bash

var="google:yahoo:microsoft:apple:oracle:hp:dell:toshiba:sun:redhat"
echo "Original value of IFS is: $IFS"

# Saving the original value of IFS
OLD_IFS=$IFS
IFS=:
echo "New value of IFS is: $IFS"
echo "================="

for word in $var;do
        echo -e $word
done <<< $var

echo "================"

# Restore the value of IFS back to the script.
IFS=$OLD_IFS
echo "Back to original value of IFS: $IFS"

Read more
1

Free eBook - Securing & Optimizing Linux: The Hacking Solution

"Securing & Optimizing Linux: The Hacking Solution (v.3.0)"

A comprehensive collection of Linux security products and explanations in the most simple and structured manner on how to safely and easily configure and run many popular Linux-based applications and services.


This 800+ page eBook is intended for a technical audience and system administrators who manage Linux servers, but it also includes material for home users and others. It discusses how to install and setup a Linux server with all the necessary security and optimization for a high performance Linux specific machine. It can also be applied with some minor changes to other Linux variants without difficulty.

Download free eBook - Securing & Optimizing Linux: The Hacking Solution (v.3.0) - here


Read more
0

Bash Script: String manipulation (Find & Cut)

${parameter#word}
${parameter##word}

Remove matching prefix pattern. If the pattern matches the beginning of the value of parameter, then  the  result  of  the  expansion  is the expanded  value  of  parameter  with  the shortest matching pattern (the ``#'' case) or the longest matching pattern (the ``##'' case) deleted. 

${parameter%word}
${parameter%%word}

Remove matching suffix pattern.  If the pattern matches a trailing portion of the expanded value of parameter, then the result of the expansion is the expanded value of parameter with the shortest matching pattern (the ``%'' case) or the longest matching pattern (the ``%%'' case) deleted. 

Below bash script explains the concepts of find and cut the string within the string, feel free to copy and use this script.

Source: cat string_cut.sh
#!/bin/bash

var="Linuxpoison.Linuxpoison.Linuxpoison"
echo
echo -e "Value of var is: $var"
echo "--------------------------------------------"
echo 'Find all *nux from the start of the string and cut ${var##*nux} :'
echo ${var##*nux}

echo "-------------------------------------------"
echo 'Find the first *nux from the start of the string and cut ${var#*nux} :'
echo ${var#*nux}

echo "-------------------------------------------"
echo 'Find all .* from the back of the string and cut ${var%%.*} :'
echo ${var%%.*}

echo "------------------------------------------"
echo 'Find first .* from the back of the string and cut ${var%.*} :'
echo ${var%.*}

Read more
1

Free eBook - Linux from Scratch

Linux from Scratch describes the process of creating your own Linux system from scratch from an already installed Linux distribution, using nothing but the source code of software that you need.

This 318 page eBook provides readers with the background and instruction to design and build custom Linux systems. This eBook highlights the Linux from Scratch project and the benefits of using this system.

Users can dictate all aspects of their system, including directory layout, script setup, and security. The resulting system will be compiled completely from the source code, and the user will be able to specify where, why, and how programs are installed.

This eBook allows readers to fully customize Linux systems to their own needs and allows users more control over their system.

Download Free Linux from Scratch PDF Guide - here


Read more
0

Network Traffic and Bandwidth Monitor - NTM (Network Traffic Monitor)

NTM (Network Traffic Monitor) is a monitor of the network and internet traffic for Linux. NTM is useful for the people that have a internet plan with a limit, and moreover the exceed traffic is expensive.

NTM (Network Traffic Monitor) features:
 * Choice of the interface to monitoring.
 * Period to monitoring: Day, Week, Month, Year or Custom Days. With auto-update.
 * Threshold: Auto-disconnection if a limit is reached (by Network Manager).
 * Traffic Monitoring: Inbound, outbound and total traffic; Show the traffic speed.
 * Time Monitoring: Total time of connections in the period.
 * Time Slot Monitoring: Number of sessions used.
 * Reports: Show of average values and daily traffic of a configurable period.
 * Online checking with Network-manager or by "Ping Mode".
 * The traffic is attributed to the day when the session began.
 * Not need root privilege.
 * Not invasive, use a system try icon.

NTM is write in python and is a open source software, the license is the GNU GPL v2.

Read more
1

Simple & Powerful GTK based Download Manager - UGet

Uget (formerly urlgfe) is a Free and Open Source download manager written in GTK+ , it has many of features like ...

 * Free (as in freedom , also free of charge ) and Open Source.
 * Simple , easy-to-use and lightweight.
 * Support resume download , so if your connection lost you don’t need to start from first.
 * Classify downloads , and every category has independent configuration and queue.
 * Queue download.
 * Integrate with Firefox through Flashgot plugin.
 * Monitoring clipboard.
 * Import downloads from HTML file.
 * Batch download , you can download many files has same arrange , like file_1 file_2 …. file_20 ,  you don’t need to add all links , just one link and changeable character.
 * Can be used from command line.
Read more
0

Free Cross-Platform Linux MultiMedia Studio (LMMS)

Linux MultiMedia Studio (LMMS) is a free cross-platform alternative to commercial programs like FL Studio®, which allow you to produce music with your computer. This includes the creation of melodies and beats, the synthesis and mixing of sounds, and arranging of samples. You can have fun with your MIDI-keyboard and much more; all in a user-friendly and modern interface.

Linux MultiMedia Studio Features
 * Song-Editor for composing songs
 * A Beat+Baseline-Editor for creating beats and baselines
 * An easy-to-use Piano-Roll for editing patterns and melodies
 * An FX mixer with 64 FX channels and arbitrary number of effects allow unlimited mixing possibilities
 * Many powerful instrument and effect-plugins out of the box
 * Full user-defined track-based automation and computer-controlled automation sources
 * Compatible with many standards such as SoundFont2, VST(i), LADSPA, GUS Patches, and MIDI
 * Import of MIDI and FLP (Fruityloops® Project) files
Read more
0

Open source E-book Library Management Application - Calibre

Calibre is an free and open source eBook library manager. It can view, convert and catalog eBooks in most of the major eBook formats. It can also talk to many eBook reader devices. It can go out to the Internet and fetch metadata for your books. It can download newspapers and convert them into eBooks for convenient reading. It is cross platform, running on Linux, Windows and OS X.
 
Calibre has a cornucopia of features divided into the following main categories:
 * Library Management
 * E-book conversion
 * Syncing to e-book reader devices
 * Downloading news from the web and converting it into e-book form
 * Comprehensive e-book viewer
 * Content server for online access to your book collection

Read more
0

Bash Script: Create & Use Associative Array like Hash tables

Before using Associative Array features make sure you have bash version 4 and above, use command "bash --version" to know your bash version.

Below shell script demonstrate  the usage of associative arrays, feel free to copy and use this code.

Associative arrays are created using declare -A name

Source: cat associative_array.sh
#!/bin/bash

# use -A option declares associative array
declare -A array

# Here, you can have some other process to fill up your associative array.
array[192.168.1.1]="host1"
array[192.168.1.2]="host2"
array[192.168.1.3]="host3"
array[192.168.1.4]="host4"
array[192.168.1.5]="host5"

echo -n "Enter the ip address to know the hostname: "
read ipaddress

# Now you can use the associative array as hash table, (key,value) pairs.
echo "Hostname associated with the $ipaddress is: ${array[$ipaddress]}"

# You can also perform all the basic array operation.
# Iterate over Associative Arrays

#for hostname in "${array[@]}"; do
#       echo $hostname
#done


Output: ./associative_array.sh 
Enter the ip address to know the hostname: 192.168.1.4
Hostname associated with the 192.168.1.4 is: host4


Read more
2

Cross-platform and easy to use Audio Editor - ocenaudio

Ocenaudio is a cross-platform, easy to use, fast and functional audio editor. It is the ideal software for people who need to edit and analyze audio files without complications. ocenaudio also has powerful features that will please more advanced users.

This software is based on Ocen Framework, a powerful library developed to simplify and standardize the development of audio manipulation and analysis applications across multiple platforms.

Features for Ocenaudio:
 * VST plugins support
 * Preview effects in Real-time
 * Drag & Drop support
 * Various effect options (silence, reverse, invert, delay, etc.)
 * Multi-selection support
 * Large file editing support
 * Fully-featured spectrogram

Read more
0

Single application to convert Audio, Video, Image and Document files to other formats

FF Multi Converter is a simple graphical application which enables you to convert audio, video, image and document files between all popular formats, using and combining other programs.

It uses ffmpeg for audio/video files, unoconv for document files and PythonMagick library for image file conversions. Common conversion options for each file type are provided. Audio/video ffmpeg-presets management and recursive conversion options are available too.

FF Multi Converter Features
 * Conversions for several file formats.
 * Very easy to use interface.
 * Access to common conversion options.
 * Audio/video ffmpeg-presets management.
 * Options for saving and naming files.
 * Recursive conversions.

Read more
0

Bash Script: Difference betweem single ( ' ) and double quotes ( " )

The Bash manual has this to say:

Single Quotes
Enclosing characters in single quotes (‘'’) preserves the literal value of each character within the quotes. A single quote may not occur between single quotes, even when preceded by a backslash.

Double Quotes
Enclosing characters in double quotes (‘"’) preserves the literal value of all characters within the quotes, with the exception of ‘$’, ‘`’, ‘\’, and, when history expansion is enabled, ‘!’. The characters ‘$’ and ‘`’ retain their special meaning within double quotes (see Shell Expansions). The backslash retains its special meaning only when followed by one of the following characters: ‘$’, ‘`’, ‘"’, ‘\’, or newline. Within double quotes, backslashes that are followed by one of these characters are removed. Backslashes preceding characters without a special meaning are left unmodified. A double quote may be quoted within double quotes by preceding it with a backslash. If enabled, history expansion will be performed unless an ‘!’ appearing in double quotes is escaped using a backslash. The backslash preceding the ‘!’ is not removed.

The special parameters ‘*’ and ‘@’ have special meaning when in double quotes (see Shell Parameter Expansion).

Read more
0

Bash script: Using shift statement to loop through command line arguments

A shift statement is typically used when the number of arguments to a command is not known in advance and it takes a number (N), in  which the positional parameters are shifted to the left by this number, N.

Say you have a command that takes 10 arguments, and N is 4, then $4 becomes $1, $5 becomes $2 and so on. $10 becomes $7 and the original $1, $2 and $3 are thrown away.

Below is the simple example showing the usage of 'shift' statements:

Source:  cat shift2.sh
#!/bin/bash

echo "Total number of arg passed: $#"
echo "arg values are: $@"
echo "-----------------------------------------"

while [[ $# > 0 ]] ; do
        echo "\$1 = $1"
        shift
done

echo

Output: ./shift2.sh a b c d e f
Total number of arg passed: 6
arg values are: a b c d e f
-----------------------------------------
$1 = a
$1 = b
$1 = c
$1 = d
$1 = e
$1 = f




Read more
0

Bash Script: Using Globbing (glob) in bash script


Glob characters
* - means 'match any number of characters'. '/' is not matched
? - means 'match any single character'
[abc] - match any of the characters listed. This syntax also supports ranges, like [0-9]

Below is a simple script which explains the problem and also provide the solution using globbing:

Source:
cat glob.sh
#!/bin/bash

echo "Creating 2 files with space: this is first file.glob and another file with name.glob "
`touch "this is first file.glob"`
`touch "another file with name.glob"`

echo "---------------------------------"
echo "Using for loop to search and delete file ... failed :( "
for file in `ls *.glob`; do
        echo $file
        `rm $file`
done

echo "-------------------------------"
echo
echo "Using the another for loop to search for the same set of files ... but failed :("
for filename in "$(ls *.glob)"; do
        echo $filename
        `rm $filename`
done

# This is the example of using glob in the script
# This time BASH does know that it's dealing with filenames
echo "-------------------------------"
echo "Finnaly able to delete the file using glob method. :)"
for filename in *.glob; do
        echo "$filename"
        `rm "$filename"`
done


Read more
1

Bash Script: Convert String Toupper and Tolower

Here is a simple bash script which converts the given string to upper or to lower case.
feel free to copy and use this script:


Source:
cat toupper_tolower.sh
#!/bin/bash

echo -n "Enter the String: "
read String

echo -n "Only First characters to uppercase: "
echo ${String^}

echo -n "All characters to uppercase: "
echo ${String^^}

echo -n "Only First characters to Lowercase: "
echo ${String,}

echo -n "All characters to lowercase: "
echo ${String,,}


Output:
./toupper_tolower.sh
Enter the String: linuXPoisoN
Only First characters to uppercase: LinuXPoisoN
All characters to uppercase: LINUXPOISON
Only First characters to Lowercase: linuXPoisoN
All characters to lowercase: linuxpoison


Read more
0

Cross-platform files Sharing application - NitroShare

NitroShare makes it easy to transfer files from one machine to another on the same network. Most of the time, no configuration is necessary - all of the machines on your network running NitroShare should immediately find each other and you can instantly begin sharing files.

NitroShare introduces the concept of "share boxes", which are small widgets that are placed on your desktop. Each share box represents another machine on your local network that you can instantly share files with by dropping them on it. (You can also create a share box that will ask you which machine you want to send the files to.)

NitroShare features:
 * Dynamic file compress during transfer to decrease transfer time and bandwidth
 * DRC check sum generation to ensure file integrity during transfer
 * Full compatibility with clients running on other operating systems
 * A helpful configuration wizard to guide you through setting up the application on your machines
 * The application was developed using the Qt framework and therefore runs on any platform supported by Qt, including Windows, Mac, and Linux.

Read more
2

Free Video Transcoding Software for Linux and Windows OS - viDrop

viDrop is free video transcoding software for GNU/Linux and Windows operating systems. With its help you can easily convert your favourite movies or videos into format, playable on your Smarthone, Tablet, MID, Portable Media Player etc.

viDrop Features:
 * Extensive codec and file format support
 * Convert DVDs in any format you like, so you can watch movies on your portable device
 * Embed subtitles into the video – useful when your device does not support subtitles
 * Supports user defined presets with predefined settings, so you can save your favorite settings for later use
 * Apply different video filters – resize/crop, sharpen, blur, deinterlace (useful when converting DVDs)
 * Based on the well known mplayer/mencoder engine
 * Free license (GNU GPL3)
 * Multi-platform support – GNU/Linux and Windows versions
 * Created entirely with the aid of free software programs – Python, GTK, GIMP, GEdit

Read more
1

Simple Download Manager for Ubuntu Linux - Steadyflow

Steadyflow is a download manager which aims for minimalism, ease of use, and a clean, malleable codebase. It should be easy to control, whether from the GUI, commandline, or D-Bus.

Features of SteadyFlow Download Manager:
 * Add and remove downloads.
 * Multiple downloads at same time.
 * Pause and Resume downloads.
 * Simple Interface.
 * Integration into system tray
 * Notification for download completes

Read more
0

How-To Install Java JRE and JDK on Ubuntu Linux

Java technology's versatility, efficiency, platform portability, and security make it the ideal technology for network computing. From laptops to datacenters, game consoles to scientific supercomputers, cell phones to the Internet, Java is everywhere!

 * 1.1 billion desktops run Java
 * 930 million Java Runtime Environment downloads each year
 * 3 billion mobile phones run Java
 * 100% of all Blu-ray players run Java
 * 1.4 billion Java Cards are manufactured each year
 * Java powers set-top boxes, printers, Web cams, games, car navigation systems, lottery terminals, medical devices, parking payment stations, and more.

To see places of Java in Action in your daily life, explore java.com.

Read more
0

Google Drive for your Ubuntu Desktop - GWoffice

Google Web Office - GWoffice - brings your Google drive to your desktop. It offers you a nice interface to its editing abilities and also gives you basic syncing for off-line use.

GWoffice features:
 * HUD support for any keyboard bound command
 * theming according to the current Gtk+ theme
 * shortcuts for quickly creating documents
 * drop to upload (and edit, if you enable it..)

Read more
1

Install Latest version of Opera browser under Ubuntu

Opera 12 comes with more than just these features. Numerous other tweaks, tricks and tucks make this Opera version the best yet:

 * Plug-ins run in their own process, so if they crash, Opera keeps singing.

 * Giddy-up: Opera 12 receives a significant speed boost — faster page loading, faster start up and faster HTML5 rendering — over its predecessor. 64-bit support on Windows and Mac gives better performance on more advanced machines.

 * Right-to-left text support and five new languages: Arabic, Persian, Hebrew, Urdu and Kazakh. Opera 12 now comes in 60 total languages.

Read more
Related Posts with Thumbnails