background preloader

PuTTY

Facebook Twitter

Korn shell scripting. A beginner’s guide Kurt RileyPublished on June 17, 2008 What is a shell?

Korn shell scripting

The IBM® AIX® operating system and other UNIX-like operating systems need a way to communicate with the kernel. This is done is through the use of a shell. There are a few different shells that you can use, but this article focuses on the Korn shell. When you log into AIX, you are started at a prompt in a certain directory. When you log in, you are said to be at the command line or command prompt. Listing 1. Korn Shell (ksh) Programming. This is the top level of my "Intro to Korn shell programming" tree.

Korn Shell (ksh) Programming

Korn shell is a 'shell-scripting' language, as well as a user-level login shell. It is also a superset of a POSIX.1 compliant shell, which is great for ensuring portability. Why scripting? Scripting, when done right, is a fast, easy way to "get the job done", without the usual "code,compile,test,debug" overhead of writing in C or some other compiled language. It is easier than C for multiple reasons: Scripting commands tend to be more readable than low-level code.

A quick scripting solution can be used as a prototype. That is not to say that scripts cannot be robust! KSH script BASICS. Contents Principle of ScriptVariablesBranchingLoopingCommandline ArgumentsComparisonsVariable ManipulationsKsh Regular ExpressionsFunctionsData RedirectionPipesCoprocessesRead Input from User and from FilesSpecial VariablesAction on Success or Failure of a CommandTrivial CalculationsNumerical Calculations using "bc""grep""sed""awk""perl" Principle of Script Defining the Shell Type To make a ksh script (which is a ksh program) crate a new file with a starting line like:#!

KSH script BASICS

/usr/bin/ksh It is important that the path to the ksh is propper and that the line doesn not have more than 32 characters. Four Types of Lines A script has four types of lines: The shell defining line at the top, empty lines, commentary lines starting with a # and command lines. . #! Start and End of Script The script starts at the first line and ends either when it encounters an "exit" or the last line. Start and End of Command print -n "Name: "; read name; print "" Name and Permissions of Script File Variables Filling in Using. A Beginner's Guide to SSH. Author: Daniel St.

A Beginner's Guide to SSH

Jules; Date Added: 2008-08-20; Views: 58191 SSH, or Secure Shell, is a popular network protocol that allows for the exchange of data using cryptography for additional security. It is most commonly used to log into a remote machine, such as a server, and execute commands via the command line. So, how is this useful to you, someone who I assume is not familiar with SSH? In the case that you may own a VPS or dedicated server, it will allow you to possess a greater control over your account, some highlights including the ability to modify configuration files which may not be available to you otherwise such as httpd.conf - this customization could allow for better optimization, increased performance, and as a result, a better bang for your buck.

So, what will you get out of this tutorial? Installing PuTTY To start things off, you'll need to download an SSH client. Opening an SSH session using PuTTY. How to Enable SSH via cPanel Tutorial. You can enable the SSH access from your cPanel -> Advanced Section -> SSH/Shell Access.

How to Enable SSH via cPanel Tutorial

Once you open the corresponding section, you can generate a new pair of SSH keys. You will need these keys in order to configure an SSH connection from your local computer to the server. The public key is saved on the server and you will have to insert the private in your local SSH software. You should enter your first name, last name and e-mail account. You can generate a random pass phrase or enter a chosen one. Once you are ready, click on the Generate button. If you already have an SSH pair, you can directly paste the public key in the Public Key text window.

In the Manage Current keys section you can view the details for the allowed SSH connections. You can remove all the SSH keys or just a chosen one. You can add more IPs through the Add IP link. Using Putty for SSH Tutorial. In this tutorial we will show you how to connect to your Siteground's hosting account through SSH using PuTTY.

Using Putty for SSH Tutorial

First, you need to login to your cPanel -> SSH / Shell Access and generate an SSH keys pair as explained at: After you have generated your SSH Key you will see it in the bottom of the SSH / Shell Access page. Click on the Private Key link which will get you to the corresponding page where you will be able to view and copy the key. Then create a file called private_key.ppk, open it with notepad, paste your private key inside and save the file. After this start puttygen.exe and click on the Load button. Select the private_key.ppk file that you have previously created with your private key and click on the Open button.