Wednesday, 21 December 2016

Linux Theory & About Vi editor



Free
Linux is free.
First ,It's available free of cost (You don't have to pay to use this OS, other OSes like MS-Windows or Commercial version of Unix may cost you money)
Second free means freedom to use Linux, i.e. when you get Linux you will also get source code of Linux, so you can modify OS (Yes OS! Linux OS!!) according to your taste.
It also offers many Free Software applications, programming languages, and development tools etc. Most of the Program/Software/OS are under GNU General Public License (GPL).

Unix Like 
Unix is almost 35 year old Os. 
In 1964 OS called MULTICS (Multiplexed Information and Computing System) was developed by Bell Labs, MIT & General Electric. But this OS was not the successful one.

Then Ken Thompson (System programmer of Bell Labs) thinks he could do better (In 1991, Linus Torvalds felt he could do better than Minix - History repeats itself.). So Ken Thompson wrote OS on PDP - 7 Computer, assembler and few utilities, this is know as Unix (1969). But this version of Unix is not portable. Then Unix was rewrote in C. Because Unix written in 'C', it is portable. It means Unix can run on verity of Hardware platform (1970-71). 
At the same time Unix was started to distribute to Universities. There students and professor started more experiments on Unix. Because of this Unix gain more popularity, also several new features are added to Unix. Then US govt. & military uses Unix for there inter-network (now it is know as INTERNET).
So Unix is Multi-user, Multitasking, Internet-aware Network OS.  Linux almost had same Unix Like feature for e.g.
  • Like Unix, Linux is also written is C.
  • Like Unix, Linux is also the Multi-user/Multitasking/32 or 64 bit Network OS.
  • Like Unix, Linux is rich in Development/Programming environment.
  • Like Unix, Linux runs on different hardware platform; for e.g.
    • Intel x86 processor (Celeron/PII/PIII/PIV/Old-Pentiums/80386/80486)
    • Macintosh PC's 
    • Cyrix processor 
    • AMD processor 
    • Sun Microsystems Sparc processor
    • Alpha Processor (Compaq)
 
Open Source
Linux is developed under the GNU Public License. This is sometimes referred to as a "copyleft", to distinguish it from a copyright.
Under GPL the source code is available to anyone who wants it, and can be freely modified, developed, and so forth. There are only a few restrictions on the use of the code. If you make changes to the programs , you have to make those changes available to everyone. This basically means you can't take the Linux source code, make a few changes, and then sell your modified version without making the source code available.

Common vi editor command list
For this Purpose
Use this vi Command Syntax
To insert new text
esc + i ( You have to press 'escape' key then 'i')
To save file
esc + : + w (Press 'escape' key  then 'colon' and finally 'w')
To save file with file name (save as)
esc + : + w  "filename"
To quit the vi editor
esc + : + q
To quit without saving
esc + : + q!
To save and quit vi editor
esc + : + wq
To search for specified word in forward direction
esc + /word (Press 'escape' key, type /word-to-find, for e.g. to find word 'shri', type as
/shri)
To continue with search 
n
To search for specified word in backward direction
esc + ?word (Press 'escape' key, type word-to-find)
To copy the line where cursor is located
esc + yy
To paste the text just deleted or copied at the cursor
esc + p
To delete entire line where cursor is located
esc + dd
To delete word from cursor position
esc + dw
To Find all occurrence of given word and Replace then globally without confirmation 
esc + :$s/word-to-find/word-to-replace/g
For. e.g. :$s/mumbai/pune/g
Here word "mumbai" is replace with "pune"

To Find all occurrence of given word and Replace then globally with confirmation
esc + :$s/word-to-find/word-to-replace/cg
To run shell command like ls, cp or date etc within vi
esc + :!shell-command

For e.g. :!pwd

No comments:

Post a Comment