Finding files on Linux

Finding files on unix and linux Find is an extremely useful command for finding files. It searches based a specified condition at a specified directory and descends into all subdirectories of the specified directory. You must always specify a directory and a condition. Files offers lots of very powerful options which allow you to precisely define your search criteria. Following are the most useful ones:

Removing quotes - a step by step example of manipulating array data

This article shows some techniques of manipulating data in an array. To keep it simple, let's start by looking how we can remove quotes from a variable. To remove a character, we can replace it with nothing using str_replace() function.

$a = "'pineapple'";
$b = '"guava"';
print "$a $b\n";
$a = str_replace("'","",$a);
$b = str_replace('"','',$b);
print "$a $b\n";

This results in:

'pineapple' "guava"
pineapple guava

Consider this code

Compressing and Archiving

tar command

The tar command is used to collate collections of files into one larger file.

Creating archives Suppose we have directory xdir containing many files, we use the following command to archive them into one file.

tar -cvf x.tar xdir

This command would archive the directory xdir and its contents into a file called x.tar. The extension '.tar' is used by convention to indicate tar files.

To create an archive and apply gzip to compress the archive,

Installing Perl/CGI on Microsoft Windows

My Configurations

My system is configured as follows:

Web root = c:/www Apache version = 2.2.6 Apache installation directory = c:/Apache2.2/

Download ActivePerl

Download windows MSI version from http://www.activestate.com/store/activeperl/download

Install ActivePerl

Double click on the downloaded file to install it. By default it installs at c:/Perl.

Test Installation

To test whether the installation was successfull, we need to create and run a hello world file.

Couldn't spawn child process

When using Apache and Perl on Windows, it is common to get Couldn't spawn child process error. The solution is very simple. Verify that you have using the correct directive at the top of your file.

!#/usr/bin/perl 

should be changed to

#!c:/Perl/bin/perl.exe 

I am assuming that your perl.exe file is located at c:/Perl/bin/perl.exe. If it is at another address, use that address.

scp - secure copy

SCP allows file to be copied to, from, or between different hosts using ssh for data transfer.

Copy files from remote computer to a local computer:

$ scp username@www.xzy.com:~/somefile.txt /home/local/directory

Copy files from local computer to remote computer:

$ scp /home/local/directory/somefile.txt username@www.xzy.com:~/

Copy a directory 'dir' from local computer to remote computer

$ scp -r /home/local/dir username@www.xzy.com:~/

SCP uses Triple-DES by default. To change cipher, use the following command:

Introduction to Unix

UNIX is a very powerful operating system which has been around for more than 30 years. Initially, it was primarily been used by industry and academia. However, since Linux, anyone can have a UNIX system installed on their computer. Having UNIX on your computer is like having an industry strength product. Much of the Internet still runs on UNIX.

Since UNIX has been in the academia for decades, much of its software is available for free. In addition, there is no shortage of blogs full of helpful comments.

Pages