iPhone tip: Common terminal shortcuts
iphone, linux August 29th, 2007
Here’s a hint to help those looking to create shortcuts for common things…
Upload/create the file /var/root/.profile with these contents:
# Aliases
alias pico='pico -w'
alias rm='rm -i'
alias ssh='ssh2'
alias myssh='ssh2 username@myserver.com'# User specific environment
PATH=$PATH:/sbin:/usr/sbin
TERM=vt100export PATH TERM
This assumes you have uploaded vt100 for using fullscreen goodies like pico. If you haven’t got vt100 on your iphone remove the TERM line and remove ‘TERM’ from the end of the ‘export’ line.
Note: You must have the binary ‘login’ uploaded to your iPhone from one of the bin-kits for this to work.
If you are a *nix user no further explanation is needed, you know what that file does and why… for those who don’t read on…
The .profile file will get ’sourced’ when you login/start a ’sh’ shell. By default the preferred shell for the root user is ‘/bin/sh’. If you want to use this file for a different shell you need to rename and possibly change the contents, all depends on the shell. For bash shells just change the filename to .bash_profile, the same content works for both /bin/sh and /bin/bash.
These profile files let you configure your environment the way you like. I’ve included some sample common settings that you can remove or alter to your liking. Here’s what each line does:
The aliases are shortcuts, typing the first part of the alias will execute what’s in the quotes.
The pico alias will execute pico with the ‘-w’ flag, prevents long lines from wrapping.
The rm alias will execute rm with the ‘-i’ flag, prompts you to confirm everything you try to delete (you can override this by doing rm -f).
The ssh alias is just for those who don’t want to type ssh2.
The myssh is an example for you to setup a shorter way of ssh’ing into a common host with a username so you don’t have to type/touch it all out everytime on the iphone.
“PATH=$PATH:/sbin” -> This guy adds directories to be searched when you type a command to execute. You can add more paths by adding “:/path/to/add” to the end of that line.
“TERM=vt100″ -> If you want to use full screen goodies like pico on the iphone you need to install vt100, and you need to set the TERM environment variable to be ‘vt100′. That’s what this line is doing. If you don’t have vt100 installed remove or comment this line!
The final ‘export’ command injects the specified variables into your environment, in this case our updated ‘PATH’ and ‘TERM’ will get injected into our environment.
Enjoy!
Leave a Comment
You must be logged in to post a comment.