Su - : Unix Basic Commands Log in As The Specified User Prompts For Password
Su - : Unix Basic Commands Log in As The Specified User Prompts For Password
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
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
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