On older Solaris or other Unix systems we quite often see following error while opening log files etc in vi or view terminal
root> vi abc
Terminal too wide
:
This is because the terminal is not wide enough to display more characters in one line.
Solution:
Execute following command on shell prompt. This will increase the width the number of columns on the terminal. After this you should be able to open files in vi or view without any issues.
stty columns 120
Many a times we face a problem wherein mistakenly some files get created in a directory which are hard to rename or remove especially when working with putty terminal, by mistake if you paste come content on command prompt then it will create junk files with hyphen, tilde or any junk character in beginning.
For example “-abc”, “~abc” etc.
Solution:
In this case “rm -abc” or “rm ~abc” etc will not work. Simple solution is to use “rm ./-abc” or “rm./~abc” etc
Unix vi commands quick reference
General Notes:
1. Before practicing using this vi tutorial, type the following command followed by a carriage return: :set showmode
2. vi is not VI. It is case sensitive!!! So make sure Caps Lock is OFF.
Requirements:
In order to work correctly the vi need correct terminal type (TERM) setting. The TERM setting depends on the type of terminal you have. Commonly used TERM types are vt100, vt220 and ANSI. In most cases vt100 will work fine. In case vi is not able to understand the TERM you have given, it starts in open mode giving you a line by line display. Generally TERM is taken from .profile or /etc/profile, but can be set at the command line as:
$TERM=vt100
$export TERM
echo $TERM will display the current TERM set.
Read more…
Quick Reference: Unix Commands and options
The following format is used for commands:
Italic indicates a variable that you supply
Bold indicates exactly what you type
[ ] Square brackets indicate that the thing which they surround is optionally typed. The square brackets themselves are not to be typed.
To display a command description from the Unix Manual and can be used to get more information on each command. Type following on shell prompt to see the manual:
man command
Example: man ls to find more about the command ls
If you are not sure of the exact command name, you can use man with the -k option to help you find the command you need. To see one line summaries of each reference page that contains the keyword you specify, enter: man -k keyword Read more…
Special commands and characters:
Converting DOS commands to UNIX commands
There are a few command line questions that are asked very often. These questions, with answers that should be typed at your shell prompt are printed below:
DOS UNIX
dir ............... ls
cls ............... clear
del ............... rm
copy .............. cp
move / rename ..... mv
type .............. cat
cd ................ cd
more < file ....... more file
md ................ mkdir
rd ................ rmdir
win ............... startx
(Note: Unlike DOS, commands and their arguments MUST be separated by a space.
For example, "cd/" doesn't work, but "cd /" does.)
Redirection
| < |
Routes input to command from file |
| > |
Routes output from command to file |
| >> |
Appends output to existing file |
| | |
Routes output between commands |