|
|
|
UNIX - COMMAND LINE COMMANDS |
||
---|---|---|
Command |
Category |
Options |
cal |
calendar, display |
cal yyyy cal mm yyyy |
calendar |
calendar, reminder service |
|
clear |
|
clear screen |
date |
date, display |
|
cd |
directory, change |
|
mkdir filename |
directory, create |
-p make multiple levels of directories, e.g. mkdir dirname1 dirname2 |
rm |
delete file (current directory) |
- i for confirm |
rmdir |
directory, remove, empty |
to remove directories |
cd | directory, to root | |
cd $HOME or $home |
directory, to root |
|
ls
ls directoryname |
directory listing |
-a
list all files, including invisible files |
compress filename |
file, compress |
-b -i -r |
cp |
file, copy |
|
find |
file, find |
-name filename |
pwd |
path, show working |
|
man subject |
help, review manual |
|
^d |
logoff vi |
|
^u |
kill line |
erases commands typed at prompt |
: set nu | line numbers | to turn off :nonum |
password |
password, change |
change your password. new password must change at least 3 char from old; must be at least 6 char long; differ from userID |
cat filename filename |
print, to screen |
can be used to create files, display files and join files |
cancel printJobName |
print, cancel job |
if needed, to get the job name, see lpstat. specifying printername only, cancels the current job printing, others remain in que |
print, to printer |
a) assuming the keyboard is the standard input
device, when no filename is specified, what you type will goto the lp |
|
lpr | print, to printer |
-p -# -T -m -T bannertext filename, prints specified banner text on the first page of the print request |
lpstat | print, status |
used
to obtain printer requests and status of printer |
ps |
print process status |
-A E F |
pwd | print working directory to screen | |
^s |
scroll, stop |
|
^q |
scroll, start |
|
[Del] or ^c |
terminate, interrupt |
stop your process |
who |
|
lists current users and relative data |
who am i |
|
returns the invoker's real username |
|
||
Command |
Category |
Extended Definition |
vi filename |
newfile, vi |
filename starting at line 1, must start text editor with: i |
vi -r filename |
recover after crash |
recover filename being edited during crash |
<esc>:w |
save/stay vi |
save contents of the buffer and- stays in the editor |
<esc> :w |
save to originalFile |
write current contents to file named in original vi call |
<esc>:w newfilename |
save to newfilename |
write current contents to newfileName |
<esc> :w! otherfilename |
save overfile |
write current contents over existing otherfilename |
<shift> ZZ |
save/quit vi |
save contents of the buffer and quits the editor |
<esc>:wq |
save/quit vi |
save contents of the buffer and quits the editor |
<esc> :x |
save/quit vi |
write to file named in original invocation, exit vi |
<esc>:xx,xxw smallfile |
save xx to newfile |
write content of lines (number) xx through xx to newfilename |
<esc> :q |
quit vi |
quit the editor |
<esc>:q! |
no save Exit vi |
exit vi when last changes have not be saved |
vi
COMMAND MODE-
<esc> - the view editor and
vi TEXT INPUT MODE
|
---|
Command |
Short Description |
I |
C |
Description |
---|---|---|---|---|
[up arrow] | command history | X | at command line, the up arrow scrolls previous commands | |
<Backspace> |
cursor, left 1 |
X |
X |
move cursor left one character |
<esc> h |
cursor, left 1 |
|
X |
move cursor left one character |
[left-arrow] |
cursor, left 1 |
X |
X |
move cursor left one character |
<Spacebar> |
cursor, right 1 |
X |
move cursor right one character |
|
0 (zero) |
cursor, to start current line |
X |
move cursor to start of current line |
|
$ |
cursor, end current line |
X |
move cursor to end of current line |
|
<esc> : <ret> |
cursor, to bottom |
|
X |
move cursor to bottom of screen to invoke command mode |
<esc>j |
cursor, down 1 line |
|
X |
move cursor down one line |
[down-arrow] |
cursor, down 1 line |
X |
X |
move cursor down one line |
<esc> k |
cursor, up 1 line |
X |
move cursor up one line |
|
[up-arrow] |
cursor, up 1 line |
X |
X |
move cursor up one line |
<esc>l |
cursor, right 1 car |
|
X |
move cursor right one character |
[right-arrow] |
cursor, right 1 car |
X |
X |
move cursor right one character |
w |
cursor, begin next word |
X |
move cursor to beginning of next word |
|
b |
cursor, back 1 word |
X |
move cursor back one word |
|
e |
cursor, end of word |
X |
move cursor to end of word |
|
<esc>:0<Return> |
cursor, first line in file |
X |
move cursor to first line in file |
|
<esc>:n or nG |
cursor, to line n |
X |
move cursor to line n (n = number) |
|
<esc>:$ or G |
cursor, to last row of file |
X |
move cursor to last row of file |
|
<esc>:$ or G |
cursor, to last row of file |
X |
move cursor to last row of file |
|
yy |
copy, current line into buffer |
|
X |
copy /cut the current line into the buffer |
Nyy or yNy |
copy, N into buffer |
|
X |
copy/cut the next n lines, including the current line, into the buffer |
[backspace] |
erase, back |
X |
|
erase characters backwards, return when finished |
^h |
erase |
X |
|
erase characters, return when finished |
:r filename |
insert from other file |
|
X |
read file named filename and insert after current line (the line with cursor) |
i |
insert, invoke text edit |
|
X |
from vi, inserts the text you enter before the character that the cursor is on |
I |
insert, invoke text editing |
X |
from vi, places your text at the beginning of the current line |
|
o |
insert, add below <Esc> to vi |
|
X |
from
vi, opens a blank line below the
current line with cursor at beginning of new line
|
O |
insert, add above <Esc> to vi |
|
X |
from vi, put text in a new line above current line, then <Esc> backto command mode |
a |
insert text, append |
|
X |
from vi, append text after cursor, then <Esc> backto command mode |
A |
insert text, append /<Esc> to vi |
|
X |
from vi, append text to end of current line, then <Esc> backto command mode |
:.= |
line, display current # |
|
X |
return line number of current line at bottom of screen |
:= |
lines, display # |
|
X |
return the total number of lines at bottom of screen |
^g |
lines, display location |
|
X |
display current line number, and total number of lines in file, at bottom of screen |
p |
paste, lines in buffer |
|
|
put (paste) the line(s) in the buffer into the text after the current line |
^f |
screen, move forward 1 |
|
X |
move forward one screen |
^b |
screen, move back 1 |
|
X |
move backward one screen |
^d |
screen, move down 1/2 |
|
X |
move down (forward) one half screen |
^u |
screen, move up 1/2 |
|
X |
move up (back) one half screen |
^l |
screen, redraw |
|
X |
redraw screen |
^r |
screen, redraw, purge |
|
X |
redraw screen, removing deleted lines |
/string |
string, search forward |
X |
X |
search forward for occurrence of string |
? string |
string, search
back |
X |
X |
search backward for occurrence of
string |
cw |
text, change word |
|
|
start with the character under cursor, change the current word with new text<Esc> |
cnw |
text, change words |
|
|
change n words beginning with character under cursor, until <Esc> ; (e.g., c3w changes 3 words) |
C |
text, change text |
replace the characters in the current line, until <Esc> |
||
x |
text, delete at cursor |
|
X |
delete text at cursor position |
dd |
text line, delete at cursor |
|
X |
delete line specified by the cursor position |
. (dot) |
text, REPEAT text change |
|
X |
repeat the last text changes |
r |
text, replace |
|
X |
replace single character at cursor location (no <Esc> needed) |
R |
text, replace and remain in edit |
Y |
X |
replace characters, starting with current cursor position then remain in text edit mode |
cc |
text, replace entire line |
|
|
replace the entire current line (stop <Esc>) |
Ncc or cNc |
text, replace n |
|
|
replace the next n lines, starting with the current line, (stop <Esc>) |
u |
text, undo, back 1 step |
|
X |
undo last change only - back only one step |
U |
text, undo all in line |
|
X |
undo all changes on the current line |
Command |
Short Description |
|
|
Description |
nroff |
||||
troff |
|
|
|
|
UNIXbasicCommands.htm