Putty and Plink command line options


Putty can be used as remote ssh client tool.

However today I learn few tricks on it.

It can be used as command line tool to execute script on remote server.

command prompt > putty.exe -t -ssh -l user -pw passwd -m C:\Users\irfan\Documents\run.txt host 

*Replace user, passwd and host with actuals.

Carate run.txt file in your documents directory and enter few commands in it.

In this case I have C:\Users\irfan\Documents\run.txt with date and  ls commands.

Putty command line options

Above command will open putty application, logged into host based on credentials to execute commands from run.txt file.
But it will not return anything back to command prompt.

So what should be I doing to return the output back to command prompt

command prompt > plink.exe -l user -pw passwd -m C:\Users\irfan\Documents\run.txt host 

*Replace user, passwd and host with actuals.

This command will return the output to your command prompt.

Plink command line options

Enjoy!

Advertisements

mod_rewrite


This is the powerful url rewrite engine comes with apache 1.3 and later version only you need to check the apache.conf file to uncomment if the loadmodule mod_rewrite.so is commented earlier.

You can check the same using the small program is .htaccess the file which is the rule file in which all the rule and action you need to write. The .htaccess is the file where you will be coding for the url rewrite engine.

I been assigned the task to convert the PHP / MYSQL site SEO i.e. (Search Engine Optimized)

Some basic rules which tells the story how one should go to achieve the rewrite rules properly

#Must be on
RewriteEngine on

#this is the directory under which the .htaccess file saved
RewriteBase /website/handy_fun/

#this statement will check for all the *.php file and changed them to *.html into the URL
RewriteRule ^(.*).html$ $1.php [PT]

Above you can see the PT which is the pass through directive and its been used to replace the string but no physical change will occur.

Like the above statement one can do the same which up to 9 variables

#all the (.*) will be replace by the corresponding $ variables
RewriteRule ^(.*)/(.*)-(.*)- (.*)-(.*).html$ $1.php?cat=$2&id=$3&title=$4&gid=$5 [PT]

That’s all about the mod_rewrite so go and enjoy the rewrite engine.