History of Linux

In 1969, Four programmer Ken Thompson, Dennis Ritchie, Rudd Canady & Doug McElroy made a
program in Bell labs which does not have any name in year 1969.
Brian Kernighan checked that program & found it is very good software for client & networking
purpose. He gave the name Unix to this program on 1st January 1970 (epoch time). First Operating System.
That time that program was written in Assembly language.
In 1972, a programmer Dennis Ritchie started converting this program in C language. (Also called
founder of C language).
1973- Unix in C language.
1980- Berkeley Software Development (a part of research program of Berkeley University)
launches open BSD (a small program written in a single floppy).
Paul Allen & Bill Gates are the employee of Bell Labs.
In 1981, they both started Microsoft with 9 more candidates & they gave a programme named
Xenix (1980) but it was flopped.
In 1981- Launched MS-DOS 1.0
In 1984- UNIX open source
In 1985- First Graphical Based OS- Win 2.0
In 1991, Linus Benedict Torvalds, B-tech Iind year Computer Science, 23 years old student of
University of Helensiki (Finland) made Kernel (25th August 1991).
In 1994- RedHat Company (collection of Linux Sets) came into existence.
99 % servers of Linux till 2012.

LINUX PRINCIPLE

1. Everything is a file.
2. Small, single purpose programmers’
3. Ability to Chain programmers’
4. Avoid captive user interfaces.
5. Configuration data stored in text.

 Linux Directory Structure
/home                  Users home (all users folders)
/bin                      Commands (user executable & Scripts)
/usr/bin                Commands (user executable & Scripts)
/sbin                     root privileged command
/usr/local/bin         commands which we make for our use.
/etc                      System Configuration files
/boot                   Linux Kernel & Bootable files
/root                    root (Admin) Data
/mnt                    for mounting any external devices
/dev                    devices (hdd, CD-Rom, Pen Drive)
/srv                     Server data
/sys                     System Information
/lib                       Library files stored
/proc                   virtual file system
/tmp                    Temporary files
/var                      Variable file (database,logs)

/opt                      Add on Application  software

Linux Basic Commands

Directory commands:
1. # mkdir – For creating directory.
2. # cd – change directory.
3. # cd .. – to come out from working directory.
4. # rmdir – to remove directory

File Commands:
1. # touch <filename> – creates a blank file.
2. # cat > filename – creates a file and for saving this file (ctrl + D)
3. # cat – to see the content of the file.
4. # cat file1 >> file2 – to move file1 matter in file2
5. # cat -n filename – to see how many lines are written in that file.

Commands for deleting:
1. # rm filename – deletes a file.
2. # rm -i – deletes file/folder in interactive mode (asking mode)
3. # rm -r – deletes directory.
4. # rm -f – deletes files/folders forcefully.

Help Commands:
1. # whatis <command> These all are the help commands. Prints all related tags
2. # man <command> about that command.
3. # info <command>
4. # <command> –help
5. # which <command>
6. # cd /usr/share/doc

Rename & Move:
1. # mv <oldfile> <newfile> (Rename)
2. # mv <filename> <where we have to move the file> (Move)

Listing Commands:
1. # ls – listing files/folders
2. # ls -l (ll) – long listing of files/folders with whole information
3. # ls -a – lists all files/folders (hidden also)
4. # ls ??? – all files/folders named with 3 characters
5. # ls m* – files & directories started with letter m.

Copy:
1. # cp <source> <destination> – copies files from source to destination
2. # cp -i <source> <destination> – copies files from source to destination in asking mode
3. # cp -i * <destination> – copies current working directory all data to destination.
4. # cp -r <directory name> <destination> – copies directory from source to destination

Editors in linux:
1. nano
2. vi These editors are used in console mode.
3. vim
4. gvim
5. gedit These editors are used in graphical mode.
6. Emacs

VI editor/ VIM editor:
There are three modes in vi editors
1. ex mode (default mode, by pressing escape key, this mode is used for saving and exit )
2. Insert mode (by pressing insert or I key, this mode is used for editing)
3. Replace mode (this mode is used for replacing text written, by again pressing insert or r key)
For saving document- come on esc mode and write :wq
For setting line numbers in document come on esc mode and write : se nu
For coming on any specific line press line no. and then ‘G’ (ex- 102 then G) or :line no (enter)
For going at the end of page press ‘G’
For going at the top of page press gg
For searching any text in the file /text
For undo u and for redo ctrl+r
Vim editor is not installed default when you install linux, you have to install vim editor. It is the
enhanced version of vi editor.
# vim/vi filename
Press ‘v’ to come to visual mode, here we can select the matter which we want to copy , press ‘yy’
to copy (y stands for yank). Press ‘p’ to paste that matter.
Press ‘dd’ to delete a particular line where cursor is.
Nano Editor:
Nano is a command based editor, earlier used when advanced editors were not came into being.
When you open a a file with this editor, you will find all related help of this command.

SOME BASIC COMMANDS
1. # poweroff -f
2. # halt -n -p – These commands are used to turn off computer.
3. # init 0
4. # init 6 – These commands are used to Restart computer.
5. # reboot
6. # startx – Switch from command to graphic.
7. # init 5 – Restarts system from command mode to graphic mode.
8. # history – To see history of recent commands.
9. # history -c – To clear the history of recent commands
10. # cat > /etc/issue – To create logoff scripts.
11. # cat > /etc/motd – To create logon scripts.
12. # cal yyyy or mm yyyy – To see the calendar of that month & year.
13. # bc – Starts basic calculator.
14. # whoiam or # w – To know by which user we logged on
15. # adduser <username> – To create user
16. # passwd <username> – To give password to user.
17. # userdel <username> – To delete user.
18. # usermod -L <username> – To lock a user account.
19. # usermod -U <username> – To unlock a user account.
20. # passwd -d <username> – To remove password for a user.
21. # cd ~ – Switch directly to users home directory with.
22. # head <filename> – To see the top ten lines of a file.
23. # head -n 16 <filename> – To see top 16 lines of a file.
24. # tail <filename> – To see the bottom ten lines of a file.
25. # tail -n 16 <filename> – To see bottom 16 lines of a file.
26. # evince <filename.pdf> – To open a pdf file (only on graphical terminal)
27. # sort <filename> – Sort file in a-z format.
28. # sort -d <filename> – Sort file in dictionary format.
29. # sort -r <filename> – Sort file in z-a format.
30. # sort -t : -k 3 –n/r/u <filename>- Sort the file according to given delimiter (n=numeric, r= decending, u=removes duplication)