100% found this document useful (1 vote)
72 views

Su - : Unix Basic Commands Log in As The Specified User Prompts For Password

This document provides summaries of basic commands for Unix and vi text editors, as well as SQL Plus commands. It lists common Unix commands like su, pwd, cd, ls, more and ps. It describes basic vi commands for navigating, editing, searching, copying and pasting text. It also outlines how to invoke and exit SQL Plus, display table definitions, select tables and view/modify data fields.

Uploaded by

sathishcog
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
72 views

Su - : Unix Basic Commands Log in As The Specified User Prompts For Password

This document provides summaries of basic commands for Unix and vi text editors, as well as SQL Plus commands. It lists common Unix commands like su, pwd, cd, ls, more and ps. It describes basic vi commands for navigating, editing, searching, copying and pasting text. It also outlines how to invoke and exit SQL Plus, display table definitions, select tables and view/modify data fields.

Uploaded by

sathishcog
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 8

Unix Basic Commands

su - <username>
log in as the specified user; prompts for password

pwd
print working directory

cd <pathname>
change directory to <pathname>

cd
change directory to home directory of user

ls
list contents of directory (there's additional flags to
show long listing, group ID,
owner, size, date last modified, etc.)

more <filename>
view <filename> one screen at a time; use [CR] to
advance one line at a time, or
spacebar to advance one screen at a time
[ESC] when filec (file completion) is set, type a few
distinguishing characters and unix
fills in the rest

ps -ef
process status (shows what processes are running)
ps -ef | grep <tag>
shows only processes
containing <tag> in the process name

cp <filename1><filename2>
copies < filename1> to <filename2>; could be a
pathname also

mv <filename1><filename2>
moves < filename1> to <filename2>; could be a
pathname also

man <command>
man page providing description of command and
list of command line arguments
and options or <command>
find . –name <filename>
Searching for <filename> recursively in the current
directory
mkdir <directory name>
Creating directory with name <directory name>
vi commands

Invoking vi
vi <filename> start up vi to edit the file <filename>
[ESC] to return to Command Mode at any time
(press Escape key, do not type the brackets)

Exiting vi
ZZ/:wq writes file then exits vi
:q! [CR] quits without saving changes

Displaying Text
^d scrolls down
^u scrolls up
^l clears and refreshes the screen

Simple Cursor Movements


h moves left one character
j moves down one line
k moves up one line
l moves right one character
[CR] moves to beginning of next line
- moves to beginning of previous line

Moving Cursor To Text Objects


^ moves to beginning of current line
$ moves to end of current line
<#>G go to beginning of line #
G go to beginning of last line
w moves to next word
b moves to previous word
e moves to next end of word

Searching
f<x> moves to next occurrence of character <x> on
current line
/<string>[CR] moves to next occurrence of <string>
?<string>[CR] moves backward to previous
occurrence of <string>
n repeats last / or ? command (see above)

Adding Text
a<string>[ESC] appends <string> after current
character
i<string>[ESC] inserts <string> before current
character
o<string>[ESC] opens new line below current line
and appends <string> at beginning of new line
O<string>[ESC] opens new line above current line
and appends <string> at beginning of new line
@ during Input Mode, deletes current input line
:r <filename> inserts text from file at cursor

Deleting Text
x deletes current character
dw deletes current word, starting at current
character
D deletes current line, starting at current character
dd deletes entire current line

Changing Text
r<x> replaces current character with character "x"
s<string>[ESC] replaces current character with
<string>
cw<string>[ESC] replaces current word starting at
current character with <string>
C<string>[ESC] replaces current line starting at
current character with <string>
cc<string>[ESC] replaces entire line with <string>

Copying Text
yw yanks current word, starting at current character
into vi's Unnamed buffer
y$ yanks current line, starting at current character
into vi's Unnamed buffer
yy yanks entire line into vi's Unnamed buffer
p puts contents of vi's Unnamed buffer after current
character (or line)
P puts contents of vi's Unnamed buffer before
current character(or line)
:<beginning line #>,<end line#> w<filename>
copies specified text to file
More Editing Commands
u undoes the last editing command
U undoes all previous commands on current line
only
:set nu turns on line numbers
:e![CR] undoes all previous commands
. repeats the last editing command
J joins the current line with the next line
:g/<string>/s//<newstring>/g[CR] globally
substitutes <newstring> for all occurrences of
<string>
:!<command> executes a shell command

File Manipulation
:w[CR] writes to the file specified on the vi command
line
:w <filename>[CR] writes to specified file

Copying and Pasting Between Files


" <registername--must be a single letter> y `
<blockname>
1. Select the text to replace with pasted text. To
mark the beginning of the selection, type
m <selectionname>
where <selectionname> is a single letter).
1. Move to the end of the text to select.
2. At the end of the text block, type
" <registername--which must be a single letter> y `
<blockname>
This puts the text block into a register named with
the chosen letter.
1. Type :e <filename> to specify what text should
replace the selected text.
2. Type " <registername> p to replace the text.

SQL Plus Commands

Invoking sqlplus
Start up sqlplus (use the oracle username and
password, not the UNIX ones)
sqlplus
<username>/<password>@<database_alias>
Exiting sqlplus
quit exits sqlplus

Displaying Table Definitions


desc <table_t> lists all fields defined in table
<table_t>

Select a Table from User Tables


select tname from tab;

Viewing Data Fields In Tables


Several different operands can be used to specify
search criteria. For example: =, >,< (or nothing if
there are a very small number of rows in the
specified table).
select <field1>,<field2>,<field3>,<fieldn> from
<table_t> [where <field>=<value>]

Modifying Data Fields In Tables


Writing to Oracle directly without going through the
PCM API is unsupported and voids warranty. This is
for testing and debug purposes only!
Update <table_t> set <field>=<value> where
<field2>=<value2>;

You might also like