Linux File System
File system is a structure in which all the information on our computer store. The files are organized with in hierarchically of directories. The Redhat Linux directories are classified below.
Over view of file system hierarchically standard.
/root à Super user for our Linux home directory.
/bin à Contain common Linux commands.
e.g. cat, cp, cut, date, echo, ed, grep, login, ls mail, mkdir, mount, mv, pwd, rmdir, ps, su,
touch, umount ….etc.
/dev à Contains files representing the access point to the device on the system.
/boot à Contain the bootable kernel file and also the boot loader configuration files.
e.g. Grub, lilo
/etc à Contain all the administrator configuration file .
/home à Contains directories assigned to each user with a login account.
/lib à Contain only those libraries that are needed to execute the binaries in /bin and /sbin.
/mnt à Provides a location of the mounting a device (or) the /mnt directory refers to temporarily
mounted file system. Such as cdrom and floppy disk.
/opt à To provides an area for usually large software package.
/proc à Contains special files that are either extract information from (or) send information to the
kernel. Memory information & cpu information are stored.
/sbin à Contain admin command and daemon process [higher admin].
/tmp à Contain temporary files used by application.
/usr à Contains user documentations, games, graphical files, library and other admin commands.
/var à Contains directories of data used by various applications and also contain all system log file. It contains several directions.
Identifying and Working with File Types
If you are new to Linux, you may see certain file types that you do not recognize because of their unfamiliar extension. A file's extension is the last part of a file's name after the final dot (in the file sneakers.txt, "txt" is that file's extension).
Here is a brief listing of file extensions and their meanings:
Compressed and Archived Files
· .bz2 — a file compressed with bzip2
· .gz — a file compressed with gzip
· .tar — a file archived with tar (short for tape archive), also known as a tar file
· .tbz — a tarred and bzipped file
· .tgz — a tarred and gzipped file.
· .zip — a file compressed with ZIP compression, commonly found in MS-DOS applications. Most compressed files for Linux use the gzip compression, so finding a .zip archive for Linux files is rare.
For information on working with bzip2, gzip, and tar files, refer to Section 14.3 File Compression and Archiving.
File Formats
· .au — an audio file
· .gif — a GIF image file
· .html/.htm — an HTML file
· .jpg — a JPEG image file
· .pdf — an electronic image of a document; PDF stands for Portable Document Format
· .png — a PNG image file (short for Portable Network Graphic)
· .ps — a PostScript file; formatted for printing
· .txt — a plain ASCII text file
· .wav — an audio file
· .xpm — an image file
System Files
· .lock — a lock file; determines whether a program or device is in use
· .rpm — a Red Hat Package Manager file used to install software
Programming and Scripting Files
· .c — a C program language source code file
· .cpp — a C++ program language source code file
· .h — a C or C++ program language header file
· .o — a program object file
· .pl — a Perl script
· .py — a Python script
· .so — a library file
· .sh — a shell script
· .tcl — a TCL script
But file extensions are not always used, or used consistently. So what happens when a file does not have an extension, or the file does not seem to be what the extension says it is supposed to be?
That is when the file command can be helpful.
For example, you find a file called saturday without an extension. Using the file command, you can tell what type of file it is by typing:
file saturday |
In the example, the command file saturday will display ASCII text, telling you it is a text file. Any file that is designated as a text file should be readable by using the cat, more, or less commands, or by using a text editor such as gedit or vi.
Basic Commands
# man à Help Command
# man –ls à Display all details about ls.
# -ls à Listen file
# -l à Long listing (To display file permission, links, owner, group, Capacity & modify date
Should be display)
# -a à Display all files including hidden files.
# -d à Listing the name of the directory instead of its content
# -R à Recursive listing – list out the content all the sub directories
# -s à sort by file size.
# -t à sort by the modification time
# -u à last access time in place of modification time.
Cat Function
Create a file
# cat > <file name>
-------- -
----------- (enter some message)
-----------
^d
Modification a file
# cat >> <file name>
-------- -
----------- (enter some message)
-----------
^d
# cat <file name> | tr “[a-z]” “[A-Z]” tr à translating lowercase to upper & upper to lowercase.
OR
| tr “a” “A”
# cat –n <file name> à Display with line number.
# pwd à To display the present working directory path should be display.
Creating Directory
# mkdir <directory name>
(e.g) # mkdir test
# mkdir –p <dir path> (Hierarchically to create a directory test1/test2/test3 )
Changing Directories
Command |
Function |
cd |
returns you to your login directory |
cd ~ |
also returns you to your login directory |
cd / |
takes you to the entire system's root directory |
cd /root |
takes you to the home directory of the root, or superuser, account created at installation; you must be the root user to access this directory |
cd /home |
takes you to the home directory, where user login directories are usually stored |
cd .. |
moves you up one directory |
cd ~otheruser |
takes you to otheruser's login directory, if otheruser has granted you permission |
cd /dir1/subdirfoo |
regardless of which directory you are in, this absolute path would take you straight to subdirfoo, a subdirectory of dir1 |
cd ../../dir3/dir2 |
this relative path would take you up two directories, then to dir3, then to the dir2 directory. |
Linux allows you to enter multiple commands at one time. The only requirement is that you separate the commands with a semicolon.
Suppose you have downloaded a new file called foobar-1.3-2.i386.rpm, and you want to put it in a new subdirectory within your home directory called rpms/, but the subdirectory has not been created. You can combine both the creation of the rpms/ directory and the moving of your downloaded file into the directory by typing the following at a shell prompt:
mkdir rpms/; mv foobar-1.3-2.i386.rpm rpms/
|
Running the combination of commands creates the directory and moves the file in one line.
cd – Navigating through directories
# cd <dir name> à To get the directories.
# cd .. à To come out the directories.
# cd à To come out of my home directories.
Changing directories is easy as long as you know where you are (your current directory) and how that relates to where you want to go.
To change directories, use the cd command. Typing this command by itself will always return you to your home directory; moving to any other directory requires a pathname.
You can use absolute or relative pathnames. Absolute paths start at the top of the file system with / (referred to as root) and then look down for the requested directory; relative paths look down from your current directory, wherever that may be. The following directory tree illustrates how cd operates.
/
/directory1
/directory1/directory2
/directory1/directory2/directory3
|
If you are currently in directory3 and you want to switch to directory1, you need to move up in the directory tree.
Executing the command
cd directory1
|
while you are in directory3, will present you with an error message explaining that there is no such directory. This is because there is no directory1 below directory3.
To move up to directory1, type:
cd /directory1
|
This is an example of an absolute path. It tells Linux to start at the top of the directory tree (/) and change to directory1. A path is absolute if the first character is a /. Otherwise, it is a relative path.
Using absolute paths allows you to change to a directory from the / directory, which requires you to know and type the complete path. Using relative paths allows you to change to a directory relative to the directory you are currently in, which can be convenient if you are changing to a subdirectory within your current directory.
The command cd .. tells your system to go up to the directory immediately above the one in which you are currently working. To go up two directories, use the cd ../.. command.
Use the following exercise to test what you have learned so far regarding absolute and relative paths. From your home directory, type the relative path:
cd ../../etc/X11
|
After using the full command in the example, you should be in the directory X11, which is where you will find configuration files and directories related to the X Window System.
Take a look at your last cd command. You told your system to:
1. Go up one level to your login directory's parent directory (probably /home)
2. Then go up to that directory's parent (which is the root, or /, directory)
3. Then go down to the etc directory
4. Finally, go to the X11 directory
Conversely, using an absolute path would get you to the /etc/X11 directory more quickly. For example:
cd /etc/X11
|
Absolute paths start from the root directory (/) and move down to the directory you specify.
Command |
Function |
cd |
returns you to your login directory |
cd ~ |
also returns you to your login directory |
cd / |
takes you to the entire system's root directory |
cd /root |
takes you to the home directory of the root, or superuser, account created at installation; you must be the root user to access this directory |
cd /home |
takes you to the home directory, where user login directories are usually stored |
cd .. |
moves you up one directory |
cd ~otheruser |
takes you to otheruser's login directory, if otheruser has granted you permission |
cd /dir1/subdirfoo |
regardless of which directory you are in, this absolute path would take you straight to subdirfoo, a subdirectory of dir1 |
cd ../../dir3/dir2 |
this relative path would take you up two directories, then to dir3, then to the dir2 directory. |
Table 13-1. cd Options
Now that you are starting to understand how to change directories, see what happens when you change to root's login directory (the superuser account). Type:
cd /root
|
If you are not logged in as root, you are denied permission to access that directory.
Deleting Files and Directories
You learned about creating files with the touch command, and you created the directory tigger using mkdir.
Now you need to learn how to delete files and directories. Deleting files and directories with the rm command is a straightforward process. See the rm man page for more information. Options for removing files and directories include:
· -i — interactive. Prompts you to confirm the deletion. This option can stop you from deleting a file by mistake.
· -f — force. Overrides interactive mode and removes the file(s) without prompting. This might not be a good idea, unless you know exactly what you are doing.
· -v — verbose. Shows the progress of the files as they are being removed.
· -r — recursive. Will delete a directory and all files and subdirectories it contains.
To delete the file piglet.txt with the rm command, type:
rm piglet.txt |
Use the -i (interactive) option to give you a second chance to think about whether or not you really want to delete the file.
rm -i piglet.txt rm: remove 'piglet.txt'? |
You can also delete files using the wildcard *, but be careful, because you can easily delete files you did not intend to throw away.
To remove a file using a wildcard, you would type:
rm pig* |
The above command will remove all files in the directory which start with the letters pig.
You can also remove multiple files using the rm command. For example:
rm piglet.txt sneakers.txt |
You can use rmdir to remove a directory (rmdir foo, for example), but only if the directory is empty. To remove directories with rm, you must specify the -r option.
For example, if you want to recursively remove the directory tigger you would type:
rm -r tigger |
If you want to combine options, such as forcing a recursive deletion, you can type:
rm -rf tigger |
A safer alternative to using rm for removing directories is the rmdir command. With this command, you will not be allowed to use recursive deletions, so a directory which has files in it will not be deleted.
rmdir – Deleting Directories
# rmdir <dir name> à To remove empty directories.
# rmdir –p <dir path> à
# rm <file name> à Delete the single file or more than one files.
# rm –r <dir name> à Recursive Deleting.
# rm –ir <dir name> à It ask question are u sure you want to delete.
# rm –f <file name> à Deleting the file without asking for confirmation.
# rm –rf <dir name> à
Creating Files
You can create new files either with applications (such as text editors) or by using the command touch, which will create an empty file that you can use to add text or data. To create a file with touch, type the following at a shell prompt.
touch <filename> |
Replace <filename> with the name of your choice. If you run a directory listing, you can see that the file contains zero (0) bytes of information because it is an empty file. For example, typing the command ls -l newfile at the shell prompt returns the following output:
-rw-rw-r-- 1 sam sam 0 Apr 10 17:09 newfile |
Copying Files
Like so many other Linux features, there is a variety of ways to manipulate files and directories. You can also use wildcards, as explained in Section 13.11.5 Wildcards and Regular Expressions, to make the process of copying, moving, or deleting multiple files and directories faster.
To copy a file, type the following command.
cp <source> <destination> |
Replace <source> with the name of the file you want to copy, and <destination> with the name of the directory where you want the file to go.
So, to copy the file sneakers.txt to the directory tigger/ in your home directory, move to your home directory and type:
cp sneakers.txt tigger/ |
You can use both relative and absolute pathnames with cp. Our home directory is the parent of the directory tigger; tigger is one directory down from our home directory.
Read the cp man page (type man cp at the shell prompt) for a full list of the options available with cp. Among the options you can use with cp are the following:
· -i — interactive. Prompts you to confirm if the file is going to overwrite a file in your destination. This is a handy option because it can help prevent you from making mistakes.
· -r — recursive. Rather than just copying all the specified files and directories, this will copy the whole directory tree, subdirectories and all.
· -v — verbose. Shows the progress of the files as they are being copied.
Now that you have the file sneakers.txt in the tigger directory, use cp -i to copy the file again to the same location.
cp -i sneakers.txt tigger cp: overwrite 'tigger/sneakers.txt'? |
To overwrite the file that is already there, press [Y] and then [Enter]. If you do not want to overwrite the file, press [N] and [Enter].
Moving Files
To move files, use the mv command. For more about mv, see the mv man page (type man mv).
Common options for mv include the following:
· -i — interactive. This will prompt you if the file you have selected will overwrite an existing file in the destination directory. This is a good option, because like the -i option for cp, you will be given the chance to make sure you want to replace an existing file.
· -f — force. Overrides the interactive mode and moves without prompting. Unless you know what you are doing, this option is dangerous; be very careful about using it until you become more comfortable with your system.
· -v — verbose. Shows the progress of the files as they are being moved.
If you want to move a file out of your home directory and into another existing directory, type the following (you will need to be in your home directory):
mv sneakers.txt tigger |
Alternatively, the same command using absolute pathnames looks like
mv sneakers.txt /home/newuser/sneakers.txt /home/newuser/tigger |
Wildcards and Regular Expressions
What if you forget the name of the file you are looking for? Using wildcards or regular expressions, you can perform actions on a file or files without knowing the complete filename. Just fill out what you know, then substitute the remainder with a wildcard. Wildcards are special symbols that you can substitute for letters, numbers, and symbols that make finding particular directories and files easier than examining long directory listings to find what you are searching for.
We know the file is called "sneak____.txt," so type:
ls sneak*.txt |
and there is the name of the file:
sneakers.txt |
You will probably use the asterisk (*) most frequently when you are searching. The asterisk will search out everything that matches the pattern you are looking for. So even by typing:
ls *.txt |
Or:
ls sn* |
You would find sneakers.txt and any other files whose name ends with .txt or begin with sn. It helps to narrow your search as much as possible.
One way to narrow a search is to use the question mark symbol (?). Like the asterisk, using ? can help locate a file matching a search pattern.
In this case, though, ? is useful for matching a single character, so if you were searching for sneaker?.txt, you would get sneakers.txt as a result, and/or sneakerz.txt, if there were such a filename.
Regular expressions are more complex than the straightforward asterisk or question mark.
When an asterisk, for example, just happens to be part of a filename, as might be the case if the file sneakers.txt was called sneak*.txt, that is when regular expressions can be useful.
Using the backslash (\), you can specify that you do not want to search out everything by using the asterisk, but you are instead looking for a file with an asterisk in the name.
If the file is called sneak*.txt, type:
sneak\*.txt |
Here is a brief list of wildcards and regular expressions:
· * — Matches all characters
· ? — Matches one character in a string
· \* — Matches the * character
· \? — Matches the ? character
· \) — Matches the ) character
# ls a* à Starting ‘a’ character file & folder should be display.
# ls aca?a à Display all aca..a files will be displayed.
(e.g) acabb
acaba o/p acaba , acama display.
asama
# ls [a-z]* à The above command will list out all the files.
# ls [a-z A-Z]* àThe above command will display all the files starting with any alphabet regards
of the case
# ls [!a-z]* à Display all the file name that are not starting with lower case.
Word Count Command
# wc <option> file name
# wc <file name> à count the number of lines, words & characters are available in a file.
-l à count only the number of line in a file.
-w à count only the number of word in a file.
-c à count only the number of character in a file.
# clear à Clear screen.
# alias <variable name> = command
(e.g) alias dir = ls
alias cls = clear
Calculator command
# bc à calculator command ued for calculation purpose
# exit à To exit a calculator.
Touch – Change the access and modification time of a file
touch <file name> à empty file will be created if you have non existing file.
touch ibu.txt à The above command will set the current time as the last access time of the file
ibu.txt
touch –t yymmddhhmm <file name>
To set the specification time stamp as the access and modification time of the file.
touch –a <file name> à Change only the access time.
touch –m <file name> à Change only the modification time.
# ln <source file name> <destination file name> à linking command.
(e.g) ln –s /root/raj /root/raj1 (raj file is link to raj1)
Head – Display the top line of the file
# head option <file name>
# head -10 /etc/passwd à In this above command First 10 lines will be display in etc/passwd files.
# head -20 emp à This above command will display the first 20 lines in emp files.
Tail – Display the bottom lines of a files
# tail option <file name> à This command can be used to display the last few line.
# tail -15 /etc/passwd à In this above command last 15 lines will be display in etc/passwd files.
# head -4 test | tail -1 à You enter four lines o/p last line only display.
The grep Command
The grep command is useful for finding specific character strings in a file. For example, if you want to find every reference made to "coffee" in the file sneakers.txt, you would type:
grep coffee sneakers.txt |
You would see every line in that file where the word "coffee" is found.
e.g :- grep –c coffee sneakers
-c à Total number of count coffee in sneakers file.
-w à exact pattern
-n à For the according to display with line number.
-I à For the ignorance in the case.
-v à another Coffee word will be display.
Mail Command
In this command is used to send the mail to the particular user.
e.g. #mail ibu (enter) à In this command ibu is a user name.
Subject : Hai how are you
-------
------- (enter message)
-------
press ^d
It ask Cc: (Type another user or enter)
A mail (message) will be send to ibu user.
[root@local host ibu]$ mail To receive a mail in ibu user (mail list will be display)
# write <user name> At this time Immediately to send the message in particular user only.
-------
------- (enter message)
-------
Press ^d
# wall <user name> (For brad cost message) At this time Immediately to send the message in
all users.
-------
------- (enter message)
-------
Press ^d
#sort <file name> à This command is a ordinary sort like ascending.
10 10
20 o/p => 100
100 20
30 30
# sort –r <file name> à File sort on reverse order.
# sort –n <file name> à Sorting on ascending order.
Cut Command:
# cut –c4 <file name> à First four character should be display in all lines.
# cut –d “:” –f3 <file name> à Ibu :Msc :Jmc
Jaha :Msc :Jmc o/p à 3rd Field Jmc only display.
Paste – Paste command:
# paste <file1><file2> (You can create a two files namely file1, file2. This 2 files are pare paste in
Column wise)
# paste file1 file2
File1 File2 o/pà File1
Ibu jaha Ibu jaha
Ahm jars Ahm jars
# who à In this command displayed in total username and time should be displayed.
# who am I à In this command only display in username, Terminal and time will be displayed.
# whoami à username only display.
# uniq <file name> à uniq file and others should be displayed.
e.g. Ahm o/p à Ahm
Ahm ibu
Ibu
Find command
# Find .—name test1 à This command will be search in current directory.
# find –user raj à This command will be searched in particular user.
# find –user raj –type –d à Directory
-f à File
-l à
locate command is also same as find command.
CMP Command:
# cmp <file1> <file2> à This command should be compare in two files.
File1 File2
Accel Accel
Ibu ahm o/p à Second line only display.
# !! à Automatically executing last command
Uname Command:
# uname –n à To display the system name.
# uname –m à Architecture name & machine name display.
# uname –r à To display which type of version are working.
# uname –s à Display OS details.
# uname –p à Processor architecture.
# uname –a à To display is all default commands.
Date commands:
# date à display the system date.
# date mmddyy à Change the date.
History commands:
# history à Store the previous history commands.
# history 20 à last 20 history only displayed.
Here are other command history shortcuts which may be useful to you:
· "Bang, bang": Typing !! (called "bang bang") executes the last command in the history.
· "Bang number": Typing !number (as in !302) will execute the command which is numbered 302 in the history file.
· "Bang string": Typing !string (as in !rpm) will execute a command with the most recent matching string from the history file.
Tput Commands:
# tput cup 15 15 à Terminal put, cursor moved location in horizontal & vertical location.
# tput blink à Cursor should be blink up to type next commands.
Compressed files use less disk space and download faster than large, uncompressed files. In Red Hat Linux you can compress files with the compression tools gzip, bzip2, or zip.
The bzip2 compression tool is recommended because it provides the most compression and is found on most UNIX-like operating systems. The gzip compression tool can also be found on most UNIX-like operating systems. If you need to transfer files between Linux and other operating system such as MS Windows, you should use zip because it is more compatible with the compression utilities on Windows.
Compression Tool |
File Extension |
Uncompression Tool |
gzip |
.gz |
gunzip |
bzip2 |
.bz2 |
bunzip2 |
zip |
.zip |
unzip |
Table 14-1. Compression Tools
By convention, files compressed with gzip are given the extension .gz, files compressed with bzip2 are given the extension .bz2, and files compressed with zip are given the extension .zip.
Files compressed with gzip are uncompressed with gunzip, files compressed with bzip2 are uncompressed with bunzip2, and files compressed with zip are uncompressed with unzip.
To use bzip2 to compress a file, type the following command at a shell prompt:
bzip2 filename
|
The file will be compressed and saved as filename.bz2.
To expand the compressed file, type the following command:
bunzip2 filename.bz2
|
The filename.bz2 is deleted and replaced with filename.
You can use bzip2 to compress multiple files and directories at the same time by listing them with a space between each one:
bzip2 filename.bz2 file1 file2 file3 /usr/work/school
|
The above command compresses file1, file2, file3, and the contents of the /usr/work/school directory (assuming this directory exists) and places them in a file named filename.bz2.
To use gzip to compress a file, type the following command at a shell prompt:
gzip filename
|
The file will be compressed and saved as filename.gz.
To expand the compressed file, type the following command:
gunzip filename.gz
|
The filename.gz is deleted and replaced with filename.
You can use gzip to compress multiple files and directories at the same time by listing them with a space between each one:
gzip -r filename.gz file1 file2 file3 /usr/work/school
|
The above command compresses file1, file2, file3, and the contents of the /usr/work/school directory (assuming this directory exists) and places them in a file named filename.gz.
To compress a file with zip, type the following command:
zip -r filename.zip filesdir
|
In this example, filename.zip represents the file you are creating and filesdir represents the directory you want to put in the new zip file. The -r option specifies that you want to include all files contained in the filesdir directory recursively.
To extract the contents of a zip file, type the following command:
unzip filename.zip
|
You can use zip to compress multiple files and directories at the same time by listing them with a space between each one:
zip -r filename.zip file1 file2 file3 /usr/work/school
|
The above command compresses file1, file2, file3, and the contents of the /usr/work/school directory (assuming this directory exists) and places them in a file named filename.zip.
A tar file is a collection of several files and/or directories in one file. This is a good way to create backups and archives.
Some of the options used with the tar are:
· -c — create a new archive.
· -f — when used with the -c option, use the filename specified for the creation of the tar file; when used with the -x option, unarchive the specified file.
· -t — show the list of files in the tar file.
· -v — show the progress of the files being archived.
· -x — extract files from an archive.
· -z — compress the tar file with gzip.
· -j — compress the tar file with bzip2.
To create a tar file, type:
tar -cvf filename.tar directory/file
|
In this example, filename.tar represents the file you are creating and directory/file represents the directory and file you want to put in the archived file.
You can tar multiple files and directories at the same time by listing them with a space between each one:
tar -cvf filename.tar /home/mine/work /home/mine/school
|
The above command places all the files in the work and the school subdirectories of /home/mine in a new file called filename.tar in the current directory.
To list the contents of a tar file, type:
tar -tvf filename.tar
|
To extract the contents of a tar file, type:
tar -xvf filename.tar
|
This command does not remove the tar file, but it places copies of its unarchived contents in the current working directory, preserving any directory structure that the archive file used. For example, if the tarfile contains a file called bar.txt within a directory called foo/, then extracting the archive file will result in the creation of the directory foo/ in your current working directory with the file bar.txt inside of it.
Remember, the tar command does not compress the files by default. To create a tarred and bzipped compressed file, use the -j option:
tar -cjvf filename.tbz file
|
tar files compressed with bzip2 are conventionally given the extension .tbz; however, sometimes users archive their files using the tar.bz2 extension.
The above command creates an archive file and then compresses it as the file filename.tbz. If you uncompress the filename.tbz file with the bunzip2 command, the filename.tbz file is removed and replaced with filename.tar.
You can also expand and unarchive a bzip tar file in one command:
tar -xjvf filename.tbz
|
To create a tarred and gzipped compressed file, use the -z option:
tar -czvf filename.tgz file
|
tar files compressed with gzip are conventionally given the extension .tgz.
This command creates the archive file filename.tar and then compresses it as the file filename.tgz. (The file filename.tar is not saved.) If you uncompress the filename.tgz file with the gunzip command, the filename.tgz file is removed and replaced with filename.tar.
You can expand a gzip tar file in one command:
tar -xzvf filename.tgz
|
Vi Editors:
Three types of mode
I, Esc Mode ii, Command mode iii, Insert mode à Press i.
In Esc mode
:w à Too save command.
:q à Quit without save.
:wq à Write and quit. àshift +z+z.
# vi
------
------ (enter some message)
------
:w <file name> This one is same as in save commands.
h à Cursor move one character left side.
I à Cursor move one character right side.
j à Cursor move one character down.
k à Cursor move one character.
0 à Cursor move beginning of the first line in first character.
$ à Cursor move end of the first line in first character.
a à Function of i. (like insert commands)
x à Delete a letter one by one.
R à Like insert key.
u à undo option.
B à Beginning of the each word cursor should be moved.
e à Move the cursor to end of the current word.
w à Move the cursor to right of the word.
H à Cursor moved on the first line (like page up).
L à Cursor moved on the last line (like page down).
M à Cursor moved the middle of the screen.
o à Opens a new line below a cursor.
O à Opens a new line above a cursor.
yy à Copy a one line (Particular line).
p à Paste aline.
dd à Deleting a particular line.
dw à Deleting a particular word.
:set nu à Display with line number.
:1,2 co 2 à Copy a 1st and 2nd line & put the below a second line.
:1,2 mo 2 à Move the 1st & 2nd line and display with second line.
Mails to : khatibkhan@yahoo.com