telnet in Unix
For
connecting to a remote Unix machine and work on that machine remotely. Telnet
is a utility that allows a computer user at one site to make a connection,
login and then conduct work on a computer at another site. Once you are login using telnet, you can perform all the
activities on your remotely connect machine.
Finger
Command(finger)
The
finger command displays information about users on a given host. The host can
be either local or remote. Finger may be disabled on other systems for security
reasons. Following are the simple syntax to use finger command-
[root@localhost
~]# finger
Login Name
Tty Idle Login Time
Office Office Phone
oracle *:0 Jul 7 00:50
oracle pts/1 7
Jul 8 17:07 (:0.0)
oracle pts/2 Jul
9 19:07 (:0.0)
[root@localhost
~]# finger oracle
Login:
oracle Name:
(null)
Directory:
/home/oracle Shell:
/bin/bash
On
since Sun Jul 7 00:50 (IST) on :0
(messages off)
On
since Mon Jul 8 17:07 (IST) on pts/1
from :0.0
10 minutes 53 seconds idle
On
since Tue Jul 9 19:07 (IST) on pts/2
from :0.0
Last
login Tue Jul 9 19:09 (IST) on pts/3
from 192.168.0.1
No
mail.
No
Plan.
Unix Editors(vi,
vim)
There
are many ways to edit files in Unix and for me one of the best ways is using
screen-oriented text editor vi. This editor enable you to edit lines in context
with other lines in the file. Now a days you would find an improved version of
vi editor which is called VIM (Vi Improved).
You
can use vi editor to edit an existing file or to create a new file from
scratch. You can also use this editor to just read a text file.
Operation Modes
While
working with vi editor you would come across following two modes:
# Command mode: This mode enables you to perform
administrative tasks such as saving files, executing commands, moving the
cursor, cutting (yanking) and pasting lines or words, and finding and
replacing. In this mode, whatever you type is interpreted as a command.
# Insert mode:
This mode enables you to insert text into the file. Everything that's
typed in this mode is interpreted as input and finally it is put in the file.
The
vi always starts in command mode. To enter text, you must be in insert mode. To
come in insert mode you simply press i. To get out of insert mode, press
the Esc key, which will put you back
into command mode.
Quit and Save vi
Editor
The
command to quit out of vi is :q.
Once in command mode, type colon, and 'q', followed by return. If your file has
been modified in any way, the editor will warn you of this, and not let you
quit. To ignore this message, the command to quit out of vi without saving
is :q!.
This lets you exit vi without saving any of the changes.
The
command to save the contents of the editor is
:w. You can combine the above
command
with
the quit command, or :wq and return.
You
can specify a different file name to save to by specifying the name after the
:w. For example, if you wanted to save the file you were working as another
filename called filename2, you would type :w
filename and return.
The
vi is case-sensitive, so you need to pay special attention to capitalization
when using commands.
Replacing Text
The
substitution command (:s/) enables
you to quickly replace words or groups of words within
your
files. Here is the simple syntax-
:s/search/replace/g
The
g stands for globally. The result of this command is that all occurrences on
the cursor's line are changed.
Running Commands
The
vi has the capability to run commands from within the editor. To run a command,
you only need to go into command mode and type :! command.
For
example, if you want to check whether a file exists before you try to save your
file to that filename, you can type :!
ls and you will see the output of ls on the screen.
No comments:
Post a Comment