0% found this document useful (0 votes)
7 views

Unixcard

This document provides a quick reference for UNIX shell features and commands, and the vi text editor. It includes: 1) A table of contents listing the topics covered which include shell features like redirection and piping, vi commands for cursor movement and text modification, and commands for saving files and exiting vi. 2) Brief explanations of shell features such as redirection operators > and >> to overwrite or append standard output, and the pipe symbol | to pass the output of one command into the next. 3) A reference of basic vi commands including movement keys like j and k to go down and up lines, deletion commands like dd to delete a line, and text insertion commands like i, a, and o.

Uploaded by

Rogerio SOUZA
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Unixcard

This document provides a quick reference for UNIX shell features and commands, and the vi text editor. It includes: 1) A table of contents listing the topics covered which include shell features like redirection and piping, vi commands for cursor movement and text modification, and commands for saving files and exiting vi. 2) Brief explanations of shell features such as redirection operators > and >> to overwrite or append standard output, and the pipe symbol | to pass the output of one command into the next. 3) A reference of basic vi commands including movement keys like j and k to go down and up lines, deletion commands like dd to delete a line, and text insertion commands like i, a, and o.

Uploaded by

Rogerio SOUZA
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

UNIX

SHELL FEATURES vi EDITOR REFERENCE SEARCH & GLOBAL SUBSTITUTE COMMANDS

Feature Character(s) Purpose ACCESSING THE vi EDITOR AND EDITOR MODES /<pattern> Next occurrence of <pattern>

vi <file-list>
?<pattern> Previous occurrence of <pattern> QUICK REFERENCE CARD
Redirection > Standard output (overwrites) n Repeat previous search
>> Standard output (appends) TABLE OF CONTENTS
< Standard input Command Mode: Characters typed are interpreted as vi commands. When :g/<pattern1>/s//<pattern2>/g
2> Diagnostic output (overwrites) vi is entered, Command Mode is the current mode. To Substitute <pattern1> with <pattern2> globally GENERAL COMMAND SYNTAX...................................................................1
2>> Diagnostic output (appends) enter Command Mode from Text Mode, hit the <esc> LOG IN / LOG OUT...........................................................................................1
Piping | Standard output of previous key. TEXT MODIFICATION COMMANDS SPECIAL DIRECTORIES.................................................................................1
command becomes the standard Text Mode: Characters types are entered into the file as text. A Text CONTROL CHARACTERS..............................................................................1
input of next command Entering command must be used to enter Text Mode. x Delete character under cursor DIRECTORY COMMANDS.............................................................................2
Variables <n>=<v> Assign value <v> to variable <n> r Replace character under cursor with next character typed FILE COMMANDS............................................................................................2
export <n> Export variable <n> CURSOR MOVEMENT COMMANDS R Strikeover old text beginning at cursor MISCELLANEOUS COMMANDS...................................................................4
$<n> Reference the value of variable dd Delete current line PROCESS COMMANDS...................................................................................5
<n> j or  Down one line nG Line n d$ Delete from cursor to end of current line COMMON ENVIRONMENT VARIABLES....................................................5
Metacharacters * Zero or more character match in a k or  Up one line G Last line dw Delete from cursor to beginning of next word SHELL FEATURES...........................................................................................6
filename h or  Left one space 0 Beginning of line cc Change current line vi EDITOR REFERENCE..................................................................................7
? Single character match in a l or  Right one space $ End of line c$ Change from cursor to end of current line
filename ^D Down half a page ^U Up half a page cw Change word beginning at cursor
GENERAL COMMAND SYNTAX
[] Character(s) in brackets used for a ^B Back a full page ^F Forward a full page
single character match in a Delete or change commands can be preceded with a repetition factor (e.g.
COMMANDS FOR INSERTING TEXT 5dd will delete the next 5 lines). <command> [<options>] [<expression>] [<file-list>]
filename
Escape Character Escape the special meaning of
i Before cursor I Beginning of line J Join current and next lines [ ... ] Optional
the next character and treat it
a After cursor A End of line u Undo the last edit command < ... > Fill in with filename(s), etc.
simply as an ASCII character
o Open new line O Open new line U Undo all changes to line with cursor italics Quiet (not displayed to screen)
Single Quotes ’ Characters in quotes are a literal below cursor above cursor . Repeat the last edit command LOG IN LOG OUT
character string
Back Quotes ‘ Characters in quotes are a VENIX SAVING FILES AND EXITING THE EDITOR COPYING AND MOVING TEXT
command to be executed and its login: <acct-name> $ exit
result back-substituted into the :w Write the text to the file yy Yank the current line and place it in a buffer password: <password> $ ^D
string :q Exit, if no changes since the last write y$ Yank rest of the line beginning at cursor SPECIAL DIRECTORIES CONTROL CHARACTERS
Double Quotes " Characters in quotes are a literal :q! Emphatic exit, no changes written to file yw Yank the current word beginning at cursor
character string, with command :wq Write changes and exit the editor "cyy Yank the current line and place it in buffer c (c is a to z) / Root directory ^D Log out (exit shell)
substitution and variable ZZ Write changes and exit the editor p Paste contents of buffer after cursor . Current directory ^S Stop scrolling
substitution allowed :n,kw file Write lines n through k to a different file P Paste contents of buffer before cursor .. Parent directory ^Q Resume scrolling
Background cmd> & Execute <cmd> in the background :n,kw >> file Append lines n through k to a different file "cp Paste contents of buffer c after cursor ^C Kill foreground process
Process :n Next file, when editing multiple files ^Z Kill foreground process and
The yank commands can also include a repetition factor. To move text, generate core dump
delete then paste; and to copy text, yank then paste.
The Foxboro Training Institute
888-FOXBORO
Foxboro, MA  Houston, TX

UNIX is a trademark of Novell Corporation


PUB FTI 1000 1M 2/99
6 7 8
DIRECTORY COMMANDS MISCELLANEOUS COMMANDS PROCESS COMMANDS
FILE COMMANDS (continued)

Command Function Command Function Command Function


Command Function

cd <dir-name> Change directory date Display date and time ps [-eln/<kernel-name>] Generate a process status report
cp <file1> <file2> Copy file1 to file2 -e For all processes
ls [-ladrsixCR] [<dir-list>] List directory contents find <dir-list> <primary-list> Find the files meeting criteria in
cp <file-list> <directory> Copy files in file-list to directory -l Long listing
-l Long listing <primary-list>, where:
file <file-list> Displays the type of each file -n Alternate kernel (not venix)
-a All files -name By name
file -f file Displays the type of each file listed in file kill [-9] <pid-list> Kills the listed processes
-d Directory information -inum By inode (VENIX ONLY)
head [-n] <file-list> Display the top of the files, by default the top -9 Absolute kill (cannot be
-r Reverse alphabetic -type By file type
10 lines trapped)
-s Size in blocks -user By owner
-n Top n lines nice [-n] <cmd> [<arg-list>] Execute the command with a lower
-i I-node number -group By group
ln [-f] <file1> <file2> Link file1 to file2 priority
-x Columns across screen -print Output results
ln [-f] <file-list> <directory> Link files in file-list to directory -n Value to lower priority (1 
-C Columns down screen -o Logical OR
-f Force n  19)
-R Recursively list contents of juxtaposition
lp [-d dst] [-n num] <file-list> Prints files nohup <cmd> [<arg-list>] Make process immune to quit signals
subdirectories Logical AND
-d Alternate printer and log outs
mkdir <dir-list> Create directories ! Logical NOT
-n Number of copies
pwd Print working directory \(...\) Grouping
more <file-list> Display file contents to stdout one screen at a COMMON ENVIRONMENT VARIABLES
rmdir <dir-list> Remove empty directories format [-n] <file> Format the diskette <file>
time
n No file system
space Next screen CDPATH Colon-delimited list of directories to be
FILE COMMANDS grep [-v] <reg-exp> <file-list> Search files for occurrences of <reg-
enter One line searched whenever cd is executed with
exp>, where:
[n]d n lines a directory argument specified as a
Command Function ^ Beginning of line
^D Half screen relative path name.
$ End of line
q Quit HOME Home directory. Used by cd when no
cat <file-list> Display file contents to stdout . Single character
mv [-f] <file1> <file2> Move file1 to file2 argument is given.
chgrp <group> <file-list> Change the group of files [] Single character within
mv [-f] <file-list> <directory> Move files in file-list to directory LOGNAME Name of the user logged in.
chmod <absolute> <file-list> Change permissions as specified by class
-f Force MAIL Name of the file to check for mail.
absolute (octal value) {n} Repeat n times
pg <file-list> Same as more. MAILCHECK Specifies, in seconds, how often to
chmod <symbolic> <file-list> Change permissions as specified by * Repeat zero or more
rm [-fri] <file-list> Removes files check for mail. Default is 600.
symbolic (user classes, operations, times
-f Force MAILPATH Colon-delimited list of files to be
and permissions) passwd <acct-name> Change passwords
-i Interactive checked for the arrival of mail.
User Class: u Owner su [-n] [<acct-name>] Switch effective user id
-r Recursive PATH Colon-delimited list of directories to be
g Group - Set up shell as if logged
tail [+n | -n] <file> Display end of file, by default last 10 lines searched when command is executed
o Public in
-n Last n lines using a relative path name. Current
a All tar [crxtv] [f file] <file-list> Archive backup and restore
+n Line n to end of file directory is indicated as :: or just : of it
Operation: + Add c Create new archive
wc [-cwl] <file-list> Counts characters, words, and lines of files heads the list.
- Remove r Append to archive
-c Characters PS1 Primary system prompt, default is '$'.
= Set x Extract from archive
-w Words PS2 Secondary system prompt, default is '>'.
Permission: r Read t List archive contents
-l Lines
w Write v Verbose listing
x Execute f Name of archive file
chown <owner> <file-list> Change the ownership of files follows option

2 5
3 4

You might also like