Thursday, December 23, 2010

Using wget to simulate a handset request

wget --user-agent="Mozilla/5.0 (SymbianOS/9.2; U; Series60/3.1 Nokia6110Navigator/" --header="x-up-calling-line-id: xxxxxxxxxxx" -O- http://www.google.com

The 'xxxxxxxxxxx' should be replaced with the user's mobile number.

Wednesday, October 6, 2010

Line number that a specific string value occurs

If you want to find the line number of where specific string values occur within a given file in Linux you can use the grep command with the switch -n.

Example:

grep -n "string" filename

Thursday, May 6, 2010

SecureCRT shortcut key to move between tabs

By default there doesn't seem to be a short-cut key to move between the various tabbed terminals that may be open when you are using SecureCRT except if you use 'Alt-1', 'Alt-2', 'Alt-3', etc. to move between the various tabs.

You can create your own short-cuts by clicking Options -> Session Options. Under Terminal -> Emulation -> Mapped Keys, you can click 'Map a Key ...'. Choose the key you want to use to go to the next tab e.g. 'ctrl tab'. From the drop down menu select the function 'Menu' and then select the Menu Function 'MENU_TAB_NEXT'. Similarly you can create a short-cut for the previous tab.

SSH without a password

To ssh without a password you need to create a public/private key pair on the server you are performing the ssh from.

To create a DSA key use the following command (-t indicates the type of key to be created):
$ ssh-keygen -t dsa

To create an RSA key use the following command:
$ ssh-keygen -t rsa

If you accepted the default file in which to save the key you should find that a new file would have been created under the .ssh folder on the server called id_dsa.pub or id_rsa.pub depending on the type of key chosen.


On the remote server copy the contents of id_dsa.pub or id_rsa.pub into a file called authorized_keys under the .ssh folder:
$ vi authorized_keys

If you are manually creating the .ssh folder on the remote server change the permissions on the folder as follows:
$ chmod 700 .ssh

You should now be able to ssh into the remote server (from the server that you created your public/private key).

N.B. your home directory must only have read and execute permissions for other users and should not have write permissions e.g. drwxr-xr-x. To change your home directory to have this permissions run the following command from the home/ directory:
$ chmod 755 username


If you are using a Windows OS you can do something similar by using putty-gen to create a public/private key and setting up your ssh client (putty, SecureCRT, etc.) to use the key to login to the remove server.

Wednesday, January 27, 2010

vi Editor - Redo

To perform the redo function using the vi editor use 'Ctrl-R'.

Undo is 'u'.