1st class
login
logout
passwd
vi editorcommand mode, insert mode
:w
:wq
:w filename
:q!
dd
ndd
yy
nyy
cp
mv
cat
ls
ls -l
ls -R list all files and the subdirectories and their files recursively
date
mkdir
cd subdir
cd ..
rmdir subdir
pwd
clear
2nd class{program} { option(s) } {argument(s) }
w
head
tail
nl (similar to cat -b)
. and ..
wild card characters - *, ? []
files and directories - tree structure
Absolute and relative addressing
echo
sleep
man
wc
wc
wc -l
wc -w
wc -c
vi editor
dw - deletes a word
d$ - deletes from here to end of line
3rd Classtouch
System information
users - Displays user names of all users currently logged into the system
hostname
uname -all
uname -v
uname -r
uname -o
uname -p
uname -k
uname -m
uname -n
uptime
rm -d subdir_name deletes a directory
rm -r subdir_name deletes the directory recursively
mkdir -p temp1/temp2/temp3 the -p option makes parent directories if they do not already exist
tac filename - displays a file in reverse order, starting from the end of the file (reverse of cat)
more filename
less filename
See the output of ls and ls * and note the difference
Give cat without any parameters and type a few lines and see the output
Vi EditorSaving a portion of a file
vi allows you to save only a part of a file by specifying the line numbers you want to write. The syntax is:
:first_line, last_linew filename<
The letter "w" should be there at the end of the last line number to identify the operation as a write request. Two wild cards can be used for either line number specification:
$ - to signify the last line in the file
. - to signify the current line
Examples of saving portions of a file
:., 12w newfile Saves lines from where the cursor currently is to the line 12 in a file named newfile
:2, 5w newfile Saves lines 2 to 5 in a file named newfile
:12, $w newfile Saves lines from 12 to the end of the file in a file named newfile
Reading from a file
To copy the contents of another file into this one at the location where the cursor resides, do the following:
:r {filename}
This inserts the text from the other file directly into the location in this file where the cursor resides.For example, to bring the contents of a file named sample into this file, the command is
:r sample
Navigation
xG "Goto" line number x