Your SlideShare is downloading. ×
Linux     for Beginners   <ul><ul><li>RAHUL SINGH </li></ul></ul><ul><ul><li>Rahul projects1991@gmail.com </li></ul></ul>
Agenda <ul><li>Introduction  </li></ul><ul><li>Linux Distributions  </li></ul><ul><li>Quick Start </li></ul><ul><li>Files ...
Introduction  <ul><li>This course is for beginners  </li></ul><ul><li>What you learn  </li></ul><ul><ul><li>General introd...
Introduction <ul><li>Security perspectives  </li></ul><ul><li>OS role  </li></ul><ul><ul><li>Govern any things in computer...
Introduction <ul><li>Why Linux?  </li></ul><ul><li>Free </li></ul><ul><ul><li>Open Source, Freedom, GPL (GNU Public Licens...
History  <ul><li>1960 </li></ul><ul><ul><li>MULTICS, Multiplex Computing System </li></ul></ul><ul><li>1974 in AT&T </li><...
History  <ul><li>1991 </li></ul><ul><ul><li>Linus Torvalds  </li></ul></ul><ul><ul><li>Free kernel for i386 </li></ul></ul...
Now  <ul><li>linux-2.6.26,  www.kernel.org  </li></ul><ul><li>Multitasking, SMP, multi-user </li></ul><ul><li>Wide range o...
Linux Distributions  <ul><li>What required </li></ul><ul><ul><li>OS, kernel, kernel-space </li></ul></ul><ul><ul><li>Appli...
Linux Distributions  <ul><li>Red Hat & Fedora  </li></ul><ul><ul><li>Stable and commercial support  </li></ul></ul><ul><li...
Linux Distributions  <ul><li>Bluecat </li></ul><ul><ul><li>Linux for embedded systems </li></ul></ul><ul><li>LinuxPPC </li...
Quick Start  <ul><li>Access to Linux  </li></ul><ul><ul><li>Remote  </li></ul></ul><ul><ul><li>Local  </li></ul></ul><ul><...
Quick Start  <ul><li>System powered on </li></ul><ul><li>BIOS </li></ul><ul><li>POST </li></ul><ul><li>Bootloader, Grub or...
Quick Start  <ul><li>System Services  </li></ul><ul><li>Configured Services </li></ul><ul><ul><li>network and network serv...
Text vs. X <ul><li>Contrary to MS Windows </li></ul><ul><ul><li>X isn't integrated into OS </li></ul></ul><ul><ul><li>X is...
Bash <ul><li>After successful login, you get shell prompt </li></ul><ul><ul><li>$  : user  </li></ul></ul><ul><ul><li>#  :...
Bash <ul><li>Linux is multiprocess, even in command line </li></ul><ul><ul><li>Process can be run in background  </li></ul...
Bash <ul><li>IO redirection to a process </li></ul><ul><ul><li>|  : pass output of command as input to other command  </li...
Bash <ul><li>History for each user </li></ul><ul><li>Use arrow keys </li></ul><ul><li>! # : # command  </li></ul><ul><li>!...
Linux/shell vs. Windows/cmd <ul><li>Path separator: / not  </li></ul><ul><li>File extensions have NOT any meaning  </li></...
Help & Doc <ul><li>Command's builtin helps:  -h  or  --help </li></ul><ul><li>Man pages  </li></ul><ul><li>Info pages </li...
Help & Doc <ul><li>Man pages </li></ul><ul><ul><li>Most complete documentation in Linux  </li></ul></ul><ul><ul><li>Very t...
Mans <ul><li>/usr/share/man </li></ul><ul><li>man1: User commands </li></ul><ul><li>man2: System libraries  </li></ul><ul>...
Internet documents  <ul><li>The Linux Documentation Project:  www.tldp.org </li></ul><ul><li>Tutorials  </li></ul><ul><li>...
Files <ul><li>Everything in Linux is file, if it is NOT process </li></ul><ul><li>Files can be   </li></ul><ul><ul><li>Reg...
Files <ul><li>Files system  </li></ul><ul><ul><li>User Space, a tree structure  </li></ul></ul><ul><ul><li>Kernel Space, V...
File system structure  <ul><li>/boot </li></ul><ul><ul><li>Bootloader, bootloader config and kernel images  </li></ul></ul...
File system structure  <ul><li>/etc </li></ul><ul><ul><li>System configuration, passwords, service config </li></ul></ul><...
File system structure  <ul><li>/tmp </li></ul><ul><ul><li>temporary files, socket files, pipe files  </li></ul></ul><ul><l...
File system structure  <ul><li>/dev </li></ul><ul><ul><li>Device files, block devices, character devices  </li></ul></ul><...
File System Navigation  <ul><li>List directories </li></ul><ul><ul><li>ls </li></ul></ul><ul><ul><li>Options:  -a -l -h -R...
File System Navigation & Modification <ul><li>Find where are you, absolute name  </li></ul><ul><ul><li>pwd </li></ul></ul>...
File System Navigation & Modification <ul><li>Remove file  </li></ul><ul><ul><li>rm  <file name> </li></ul></ul><ul><ul><l...
File System Navigation & Modification <ul><li>move file and directories </li></ul><ul><ul><li>mv  <source> <destination> <...
File System Navigation & Modification <ul><li>Links (like windows short-cuts)‏ </li></ul><ul><li>Two Types </li></ul><ul><...
File Commands <ul><li>Commands </li></ul><ul><ul><li>File as an object  </li></ul></ul><ul><ul><li>File content </li></ul>...
File Commands <ul><li>Find files and directories </li></ul><ul><ul><li>find <path> <regular expression> </li></ul></ul><ul...
File Commands <ul><li>Archive  </li></ul><ul><ul><li>Create:  tar -cf  <archive name> <directory> </li></ul></ul><ul><ul><...
File Security  <ul><li>File permissions </li></ul><ul><ul><li>ls -l </li></ul></ul><ul><ul><li>-rwxrwxrwx: -(user)(group)(...
File Security  <ul><li>More file permissions  </li></ul><ul><ul><li>t: sticky bit. Others can not delete your file even wi...
File Security  <ul><li>Default permission  </li></ul><ul><ul><li>umask: Invert of your permission  </li></ul></ul><ul><ul>...
File Commands <ul><li>Most important file type in Linux:  Text </li></ul><ul><ul><li>Config files </li></ul></ul><ul><ul><...
File Commands <ul><li>What is in a file  </li></ul><ul><ul><li>cat  <file name> </li></ul></ul><ul><ul><li>tac  <file name...
File Commands <ul><li>Search content of file  </li></ul><ul><ul><li>grep  <regular expression> <file name> </li></ul></ul>...
Editors <ul><li>Again Text editor </li></ul><ul><li>Text Editors </li></ul><ul><ul><li>X editors </li></ul></ul><ul><ul><l...
Editors <ul><li>emacs   </li></ul><ul><ul><li>Old and very user friendly  </li></ul></ul><ul><ul><li>Menu based, F10 </li>...
vim  <ul><li>Three modes  </li></ul><ul><ul><li>Input mode: edit your document </li></ul></ul><ul><ul><li>Command mode: si...
vim  <ul><li>Command mode, the default mode </li></ul><ul><li>Go from input mode by:  Esc </li></ul><ul><li>Navigation com...
vim  <ul><li>Edit commands  </li></ul><ul><ul><li>x  : cut a char </li></ul></ul><ul><ul><li>#dw  : cut # of words  </li><...
vim  <ul><li>Line Input mode </li></ul><ul><ul><li>Go from command mode by  : </li></ul></ul><ul><ul><li>:w  : save file, ...
Process <ul><li>In Linux, every things is file,  if it is NOT a process </li></ul><ul><li>Linux is multi-user, multi-proce...
Process <ul><li>Background  </li></ul><ul><ul><li>&  at end of command  </li></ul></ul><ul><ul><li>suspend (CTRL-Z), send ...
Process <ul><li>Scheduling, running in background  </li></ul><ul><ul><li>at  time  -f  <file name>,  atq ,  atrm  <id> </l...
Process  <ul><li>Monitoring  </li></ul><ul><ul><li>ps  : list of your process </li></ul></ul><ul><ul><li>ps aux  : all run...
Process <ul><li>Process and Signal  </li></ul><ul><ul><li>Signals are notifiers  </li></ul></ul><ul><ul><li>Kernel and use...
System Information <ul><li>uname -a, -r  : Kernel name  </li></ul><ul><li>dmesg  : Kernel messages </li></ul><ul><li>/var/...
Shell <ul><li>Executable applications </li></ul><ul><ul><li>Binary programs: usually in developed in C </li></ul></ul><ul>...
Bash <ul><li>Environment Variables  </li></ul><ul><ul><li>Save, parameters and some configurations  </li></ul></ul><ul><li...
Bash <ul><li>Define a variable </li></ul><ul><ul><li>ABC=“This is test” </li></ul></ul><ul><li>View variable content  </li...
Bash Script <ul><li>Bash programming language  </li></ul><ul><ul><li>Variables </li></ul></ul><ul><ul><ul><li>User defined...
Bash Script <ul><ul><li>Control statements  </li></ul></ul><ul><ul><ul><li>for  <name>  in  <word>;  do  <commands>;  done...
Example  vim test.sh  #!/bin/bash for file in *; do if grep -q $1 $file; then echo “Found in file: “ $file  fi; done; exit...
C programming  <ul><li>GCC: GNU Compiler Collection  </li></ul><ul><ul><li>C, C++, Java, ADA, Fortran, ... </li></ul></ul>...
C programming  <ul><li>All steps altogether </li></ul><ul><ul><li>gcc -o <output name> <input C> </li></ul></ul><ul><li>In...
C programming (make & Makefile)  <ul><li>Open source world  </li></ul><ul><li>Automate compiling large packages:  make  & ...
Installing programs <ul><li>Binary format </li></ul><ul><ul><li>Distribution depended </li></ul></ul><ul><ul><ul><li>Red H...
Networking  <ul><li>Most of network protocols are implemented in Linux </li></ul><ul><ul><li>Application layer: bind, apac...
Networking  <ul><li>Network interface (Ethernet)‏ </li></ul><ul><ul><li>ifconfig eth0 10.10.10.1 netmask 255.255.255.0 up ...
Networking  <ul><li>DNS </li></ul><ul><ul><li>/etc/resolve.conf </li></ul></ul><ul><ul><li>/etc/hosts </li></ul></ul><ul><...
Networking  <ul><li>Monitoring and Troubleshooting </li></ul><ul><ul><li>List of all connections:  netstat -an </li></ul><...
Using from Network  <ul><li>Remote shell:  telnet, ssh </li></ul><ul><li>Remote file transfer:  ftp, lftp, sftp, scp </li>...
Services <ul><li>Linux services </li></ul><ul><ul><li>Network services: web, mail, ... </li></ul></ul><ul><ul><li>Local se...
Security  <ul><li>Security  </li></ul><ul><ul><li>Local: File security, Process security  </li></ul></ul><ul><ul><li>Netwo...
Security  <ul><li>Process security  </li></ul><ul><ul><li>Each process has its own user id </li></ul></ul><ul><ul><li>You ...
Network Security  <ul><li>Statefull Firewall: iptables </li></ul><ul><li>IDS: snort  </li></ul><ul><li>VPNs </li></ul><ul>...
<ul><li>Now is the end time of my presentation </li></ul><ul><li>But it is the start of your Linux learning  </li></ul>
Upcoming SlideShare
Loading in...5
×

Linux

2,002

Published on

RAHUL SINGH SHAHDOL HARMILAP COLLEGE

Published in: Technology
1 Comment
8 Likes
Statistics
Notes
  • THANNKS VERY MUCH!!!
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total Views
2,002
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
5
Comments
1
Likes
8
Embeds 0
No embeds

No notes for slide
  • End of session 1
  • End of session 2
  • End of session 3
  • End of session 4
  • End of session 5
  • Transcript of "Linux"

    1. 1. Linux for Beginners <ul><ul><li>RAHUL SINGH </li></ul></ul><ul><ul><li>Rahul projects1991@gmail.com </li></ul></ul>
    2. 2. Agenda <ul><li>Introduction </li></ul><ul><li>Linux Distributions </li></ul><ul><li>Quick Start </li></ul><ul><li>Files </li></ul><ul><li>Process </li></ul><ul><li>Shell & Programming </li></ul><ul><li>Networking </li></ul><ul><li>Security </li></ul>
    3. 3. Introduction <ul><li>This course is for beginners </li></ul><ul><li>What you learn </li></ul><ul><ul><li>General introduction to GNU/Linux OS </li></ul></ul><ul><ul><li>Basic operations in Text Mode </li></ul></ul><ul><ul><li>A little about administration </li></ul></ul><ul><li>What you don't learn learn </li></ul><ul><ul><li>In depth Linux structure </li></ul></ul><ul><ul><li>Kernel Internal </li></ul></ul><ul><ul><li>System programming </li></ul></ul><ul><ul><li>… </li></ul></ul>
    4. 4. Introduction <ul><li>Security perspectives </li></ul><ul><li>OS role </li></ul><ul><ul><li>Govern any things in computer </li></ul></ul><ul><ul><li>Has privilege </li></ul></ul><ul><ul><li>Insecure OS insecure machine </li></ul></ul>
    5. 5. Introduction <ul><li>Why Linux? </li></ul><ul><li>Free </li></ul><ul><ul><li>Open Source, Freedom, GPL (GNU Public License)‏ </li></ul></ul><ul><ul><li>No charge </li></ul></ul><ul><li>More secure </li></ul><ul><ul><li>Open source </li></ul></ul><ul><li>OS for computer scientists </li></ul><ul><ul><li>You see what happen, no hidden things </li></ul></ul><ul><li>You need it </li></ul>
    6. 6. History <ul><li>1960 </li></ul><ul><ul><li>MULTICS, Multiplex Computing System </li></ul></ul><ul><li>1974 in AT&T </li></ul><ul><ul><li>Free Unix </li></ul></ul><ul><ul><li>Free BSD </li></ul></ul><ul><li>POSIX </li></ul><ul><ul><li>Unix is commercial </li></ul></ul><ul><li>MINIX </li></ul><ul><ul><li>Simple and free UNIX liked OS, by Tanenbaum </li></ul></ul>
    7. 7. History <ul><li>1991 </li></ul><ul><ul><li>Linus Torvalds </li></ul></ul><ul><ul><li>Free kernel for i386 </li></ul></ul><ul><li>5 Oct 1991 in newsgroup of minix </li></ul><ul><ul><li>Linux 0.0.2 </li></ul></ul><ul><li>1994 </li></ul><ul><ul><li>Linux 1.0 </li></ul></ul><ul><li>Linux Logo </li></ul><ul><ul><li>TUX </li></ul></ul>
    8. 8. Now <ul><li>linux-2.6.26, www.kernel.org </li></ul><ul><li>Multitasking, SMP, multi-user </li></ul><ul><li>Wide range of CPUs </li></ul><ul><li>Popular OS in universities and academic research </li></ul><ul><ul><li>Open source </li></ul></ul><ul><li>Platform of network services </li></ul><ul><ul><li>Wide range of network protocols and services </li></ul></ul><ul><li>Platform for embedded development </li></ul>
    9. 9. Linux Distributions <ul><li>What required </li></ul><ul><ul><li>OS, kernel, kernel-space </li></ul></ul><ul><ul><li>Applications, user-space </li></ul></ul><ul><ul><ul><li>Interfaces and basic commands </li></ul></ul></ul><ul><ul><ul><li>Applications </li></ul></ul></ul><ul><ul><ul><li>Services </li></ul></ul></ul><ul><li>Kernel by Linus and world wide developers </li></ul><ul><li>Most of applications by GNU project </li></ul><ul><ul><li>GNU : GNU is Not Unix </li></ul></ul><ul><li>Our operating system: GNU/Linux </li></ul>
    10. 10. Linux Distributions <ul><li>Red Hat & Fedora </li></ul><ul><ul><li>Stable and commercial support </li></ul></ul><ul><li>SuSE </li></ul><ul><ul><li>Most updated and user friendly </li></ul></ul><ul><ul><li>Supported by Novel </li></ul></ul><ul><li>UBUNTU </li></ul><ul><ul><li>New fast growing user friendly Debian based </li></ul></ul><ul><li>Debian </li></ul><ul><ul><li>Most complete distribution, the Sarge </li></ul></ul>
    11. 11. Linux Distributions <ul><li>Bluecat </li></ul><ul><ul><li>Linux for embedded systems </li></ul></ul><ul><li>LinuxPPC </li></ul><ul><ul><li>Linux to run on PowerPC machines </li></ul></ul><ul><li>Astaro </li></ul><ul><ul><li>Security applaince, Firewall, Antivirus </li></ul></ul><ul><li>Live CD </li></ul><ul><ul><li>KNOPPIX, PHLAK, Karamad, ... </li></ul></ul>
    12. 12. Quick Start <ul><li>Access to Linux </li></ul><ul><ul><li>Remote </li></ul></ul><ul><ul><li>Local </li></ul></ul><ul><li>Remote </li></ul><ul><ul><li>Through network </li></ul></ul><ul><ul><li>Telnet, insecure and disabled now </li></ul></ul><ul><ul><li>SSH, Secure Shell Protocol </li></ul></ul><ul><li>Local </li></ul><ul><ul><li>Linux installation or Live CDs </li></ul></ul>
    13. 13. Quick Start <ul><li>System powered on </li></ul><ul><li>BIOS </li></ul><ul><li>POST </li></ul><ul><li>Bootloader, Grub or LiLo </li></ul><ul><ul><li>Initialize Hardware </li></ul></ul><ul><ul><li>Kernel extraction </li></ul></ul><ul><li>Kernel </li></ul><ul><ul><li>Initialize Hardware </li></ul></ul><ul><ul><li>Kernel data structures initialization </li></ul></ul>
    14. 14. Quick Start <ul><li>System Services </li></ul><ul><li>Configured Services </li></ul><ul><ul><li>network and network services </li></ul></ul><ul><li>User interface </li></ul><ul><ul><li>G raphical </li></ul></ul><ul><ul><ul><li>Called as X window system, it is a service </li></ul></ul></ul><ul><ul><ul><li>KDE, GNOME </li></ul></ul></ul><ul><ul><li>Text, Shells </li></ul></ul><ul><li>Switch between them: ALT-F? and CTRL-ALT-F? </li></ul><ul><li>Screen 7 is the X </li></ul>
    15. 15. Text vs. X <ul><li>Contrary to MS Windows </li></ul><ul><ul><li>X isn't integrated into OS </li></ul></ul><ul><ul><li>X is just an application </li></ul></ul><ul><li>Shell </li></ul><ul><ul><li>Interactive program, interface between user and kernel </li></ul></ul><ul><ul><li>Real power of Linux, specially for hackers and administrators </li></ul></ul><ul><ul><li>Bash (Brown Again Shell), tsh, csh </li></ul></ul><ul><li>We study Linux Text Mode and just applications not Kernel </li></ul>
    16. 16. Bash <ul><li>After successful login, you get shell prompt </li></ul><ul><ul><li>$ : user </li></ul></ul><ul><ul><li># : root </li></ul></ul><ul><li>There are two privilege in user space </li></ul><ul><li>reset : reinitialize your screen </li></ul><ul><li>Linux is case sensitive </li></ul><ul><li>Autocomplete: commands and file names </li></ul><ul><ul><li>Commands in $PATH </li></ul></ul><ul><ul><li>File name in specified path </li></ul></ul>
    17. 17. Bash <ul><li>Linux is multiprocess, even in command line </li></ul><ul><ul><li>Process can be run in background </li></ul></ul><ul><li>Widecards </li></ul><ul><ul><li>* : string </li></ul></ul><ul><ul><li>?: a char </li></ul></ul><ul><ul><li>[]: regular expression </li></ul></ul><ul><li>IO redirection to file </li></ul><ul><ul><li>> : overwrite, 2> : overwrite by stderror </li></ul></ul><ul><ul><li>>> : append </li></ul></ul><ul><ul><li>< : Read input </li></ul></ul>
    18. 18. Bash <ul><li>IO redirection to a process </li></ul><ul><ul><li>| : pass output of command as input to other command </li></ul></ul><ul><ul><li>One of the main features in UNIX-like systems </li></ul></ul><ul><ul><li>Simple commands which are piped together </li></ul></ul><ul><li>Some short-cuts </li></ul><ul><ul><li>CTRL-D: Logout, End of file </li></ul></ul><ul><ul><li>CTRL-L: Clear Screen </li></ul></ul><ul><ul><li>CTRL-C: Stop </li></ul></ul><ul><ul><li>CTRL-Z: Suspend </li></ul></ul><ul><ul><li>CTRL-E: cut to end of line </li></ul></ul><ul><ul><li>CTRL-U: cut to start of line </li></ul></ul>
    19. 19. Bash <ul><li>History for each user </li></ul><ul><li>Use arrow keys </li></ul><ul><li>! # : # command </li></ul><ul><li>! <start_of_command>: last command started with ... </li></ul><ul><li>CTRL-R: search history </li></ul><ul><li>history : see command history </li></ul><ul><li>.bash_history : saved $HISTSIZE number of command </li></ul>
    20. 20. Linux/shell vs. Windows/cmd <ul><li>Path separator: / not </li></ul><ul><li>File extensions have NOT any meaning </li></ul><ul><li>Hidden file started by ., .bashrc, .bash_history </li></ul><ul><li>End of file is CTRL-D </li></ul><ul><li>New line is n not nr </li></ul><ul><li>Options are passed by - or -- </li></ul><ul><li>All system configurations are saved in text files </li></ul>
    21. 21. Help & Doc <ul><li>Command's builtin helps: -h or --help </li></ul><ul><li>Man pages </li></ul><ul><li>Info pages </li></ul><ul><li>Documents in /usr/share/doc </li></ul><ul><li>Info pages </li></ul><ul><ul><li>are NOT complete </li></ul></ul><ul><ul><li>Easy to use </li></ul></ul><ul><ul><li>info <command name> or pinfo <command name> </li></ul></ul><ul><li>whatis </li></ul>
    22. 22. Help & Doc <ul><li>Man pages </li></ul><ul><ul><li>Most complete documentation in Linux </li></ul></ul><ul><ul><li>Very technical </li></ul></ul><ul><ul><ul><li>Title, description, see also and files </li></ul></ul></ul><ul><ul><li>man <man-category> file/command/function </li></ul></ul><ul><ul><li>searched in <MANPATH> </li></ul></ul><ul><ul><li>manpath : find out the <MANPATH> </li></ul></ul><ul><ul><li>configuration file: /etc/manpath.conf </li></ul></ul><ul><ul><li>man -k topic : search topic in titles = apropos </li></ul></ul><ul><ul><li>man -K topic: search topic in body </li></ul></ul>
    23. 23. Mans <ul><li>/usr/share/man </li></ul><ul><li>man1: User commands </li></ul><ul><li>man2: System libraries </li></ul><ul><li>man3: Programming libraries </li></ul><ul><li>man4: Special files </li></ul><ul><li>man5: File formats </li></ul><ul><li>man7: Misc. network protocols, ... </li></ul><ul><li>man8: System administration </li></ul><ul><li>Other mans: Application man pages </li></ul>
    24. 24. Internet documents <ul><li>The Linux Documentation Project: www.tldp.org </li></ul><ul><li>Tutorials </li></ul><ul><li>HOWTOs </li></ul><ul><li>Software home pages </li></ul><ul><li>Mailing lists </li></ul><ul><li>Everything is googlized </li></ul>
    25. 25. Files <ul><li>Everything in Linux is file, if it is NOT process </li></ul><ul><li>Files can be </li></ul><ul><ul><li>Regular file </li></ul></ul><ul><ul><li>Directory </li></ul></ul><ul><ul><li>Links </li></ul></ul><ul><ul><li>device </li></ul></ul><ul><ul><li>named pipe, ... </li></ul></ul><ul><li>Uniform interface, open, read/write, close </li></ul><ul><li>You should fully understand the Linux file structure </li></ul>
    26. 26. Files <ul><li>Files system </li></ul><ul><ul><li>User Space, a tree structure </li></ul></ul><ul><ul><li>Kernel Space, VFS and file system depended drivers </li></ul></ul><ul><li>What file systems in Linux </li></ul><ul><ul><li>Kernel configuration depended </li></ul></ul><ul><ul><li>ext2, ext3, jfs, nfs, fat, ntfs, ... </li></ul></ul><ul><ul><li>man fs </li></ul></ul><ul><li>mkfs.ext2, mkfs.ext3, mkfs.fat, ... </li></ul><ul><ul><li>make file systems </li></ul></ul>
    27. 27. File system structure <ul><li>/boot </li></ul><ul><ul><li>Bootloader, bootloader config and kernel images </li></ul></ul><ul><li>/bin </li></ul><ul><ul><li>Binary files, basic utilities, required for boot </li></ul></ul><ul><li>/sbin </li></ul><ul><ul><li>System binary, system management tools </li></ul></ul><ul><li>/lib </li></ul><ul><ul><li>Shared libraries and kernel modules </li></ul></ul>
    28. 28. File system structure <ul><li>/etc </li></ul><ul><ul><li>System configuration, passwords, service config </li></ul></ul><ul><li>/home </li></ul><ul><ul><li>Home directory of users </li></ul></ul><ul><li>/root </li></ul><ul><ul><li>Home directory of root </li></ul></ul><ul><li>/var </li></ul><ul><ul><li>log files, message files, lock files, www root, ... </li></ul></ul>
    29. 29. File system structure <ul><li>/tmp </li></ul><ul><ul><li>temporary files, socket files, pipe files </li></ul></ul><ul><li>/usr </li></ul><ul><ul><li>Like the /, /usr/include additional directories bin, sbin, </li></ul></ul><ul><li>/ opt </li></ul><ul><ul><li>Additional softwares </li></ul></ul><ul><li>/proc </li></ul><ul><ul><li>Virtual file system, process and system information </li></ul></ul><ul><ul><li>Kernel Interface in user space </li></ul></ul>
    30. 30. File system structure <ul><li>/dev </li></ul><ul><ul><li>Device files, block devices, character devices </li></ul></ul><ul><li>/sys </li></ul><ul><ul><li>Kernel interface for hardwares info and management </li></ul></ul><ul><li>/mnt and /media </li></ul><ul><ul><li>Add new media and file system into your file system </li></ul></ul><ul><ul><li>New media has its own file system (kernel level driver)‏ </li></ul></ul><ul><ul><li>mount -t vfat /dev/sdb1 /mnt/flash </li></ul></ul>
    31. 31. File System Navigation <ul><li>List directories </li></ul><ul><ul><li>ls </li></ul></ul><ul><ul><li>Options: -a -l -h -R </li></ul></ul><ul><li>Walking in file system </li></ul><ul><ul><li>Absolute vs. Relative path </li></ul></ul><ul><ul><li>cd <path> </li></ul></ul><ul><ul><li>cd , cd –, cd ~ </li></ul></ul><ul><ul><li>pushd </li></ul></ul><ul><ul><li>popd </li></ul></ul>
    32. 32. File System Navigation & Modification <ul><li>Find where are you, absolute name </li></ul><ul><ul><li>pwd </li></ul></ul><ul><li>Make directory </li></ul><ul><ul><li>mkdir <directory path> </li></ul></ul><ul><li>Remove empty directory </li></ul><ul><ul><li>rmdir <directory path> </li></ul></ul>
    33. 33. File System Navigation & Modification <ul><li>Remove file </li></ul><ul><ul><li>rm <file name> </li></ul></ul><ul><ul><li>rm -r <directory> </li></ul></ul><ul><ul><li>-i : ask you, -f : force </li></ul></ul><ul><li>Secure remove </li></ul><ul><ul><li>shred </li></ul></ul><ul><ul><li>-n : number, -z : fill zero </li></ul></ul><ul><ul><li>shred -n 10 -z -v /tmp/xxx </li></ul></ul>
    34. 34. File System Navigation & Modification <ul><li>move file and directories </li></ul><ul><ul><li>mv <source> <destination> </li></ul></ul><ul><li>copy file and directories </li></ul><ul><ul><li>cp <source file> <destination file> </li></ul></ul><ul><ul><li>cp -r <source directory> <destination directory> </li></ul></ul><ul><li>What is the rename? </li></ul>
    35. 35. File System Navigation & Modification <ul><li>Links (like windows short-cuts)‏ </li></ul><ul><li>Two Types </li></ul><ul><ul><li>Hard (only for files) and soft (files & directories)‏ </li></ul></ul><ul><li>Hard </li></ul><ul><ul><li>ln <target file> <link name> </li></ul></ul><ul><li>Soft </li></ul><ul><ul><li>ln -s <target name> <link name> </li></ul></ul><ul><li>View Links </li></ul><ul><ul><li>readlink <link name>, ls -l </li></ul></ul>
    36. 36. File Commands <ul><li>Commands </li></ul><ul><ul><li>File as an object </li></ul></ul><ul><ul><li>File content </li></ul></ul><ul><li>Alert timestamp of file </li></ul><ul><ul><li>Creation, access and modification </li></ul></ul><ul><ul><li>touch <file name> : update mod. time to now </li></ul></ul><ul><ul><li>-a : access time, -m : modification time </li></ul></ul><ul><ul><li>-t : set time </li></ul></ul><ul><ul><li>create new file </li></ul></ul>
    37. 37. File Commands <ul><li>Find files and directories </li></ul><ul><ul><li>find <path> <regular expression> </li></ul></ul><ul><ul><li>name, size, time, type, permission, ... </li></ul></ul><ul><ul><li>find /etc/ -name *.conf -exec cp '{}' /home/backup ';' </li></ul></ul><ul><li>Where are commands and man pages </li></ul><ul><ul><li>whereis <command name> </li></ul></ul><ul><li>Which command is executed </li></ul><ul><ul><li>which <command name> </li></ul></ul>
    38. 38. File Commands <ul><li>Archive </li></ul><ul><ul><li>Create: tar -cf <archive name> <directory> </li></ul></ul><ul><ul><li>Extract: tar -xf <archive name> </li></ul></ul><ul><li>File Compression </li></ul><ul><ul><li>gzip <file name>, gunzip <zipped file name> </li></ul></ul><ul><ul><ul><li>best compress: -9 </li></ul></ul></ul><ul><ul><li>bzip2 <file name>, bunzip2 <zipped file> </li></ul></ul><ul><ul><li>z* commands </li></ul></ul><ul><ul><ul><li>zcat, zdiff, zless </li></ul></ul></ul>
    39. 39. File Security <ul><li>File permissions </li></ul><ul><ul><li>ls -l </li></ul></ul><ul><ul><li>-rwxrwxrwx: -(user)(group)(other)‏ </li></ul></ul><ul><ul><li>In binary format -421421421 </li></ul></ul><ul><ul><li>r: read, w: write, x: execute </li></ul></ul>
    40. 40. File Security <ul><li>More file permissions </li></ul><ul><ul><li>t: sticky bit. Others can not delete your file even with “w” permission </li></ul></ul><ul><ul><li>s & g: Set User/Group ID. Change process id to file owner </li></ul></ul><ul><li>Chang permissions </li></ul><ul><ul><li>chmod [ugo][+-=][rwx/binary] file </li></ul></ul><ul><li>Attributes: undelete, fill zero, append only, ... </li></ul><ul><ul><li>lsattr, chattr </li></ul></ul>
    41. 41. File Security <ul><li>Default permission </li></ul><ul><ul><li>umask: Invert of your permission </li></ul></ul><ul><ul><li>umask 077 : no one else can do anything </li></ul></ul><ul><li>Chang owner and group (only root)‏ </li></ul><ul><ul><li>chgrp <group> file </li></ul></ul><ul><ul><li>chown <user> file </li></ul></ul>
    42. 42. File Commands <ul><li>Most important file type in Linux: Text </li></ul><ul><ul><li>Config files </li></ul></ul><ul><ul><li>Log files </li></ul></ul><ul><ul><li>Source codes </li></ul></ul><ul><li>File type </li></ul><ul><ul><li>file <file name> </li></ul></ul><ul><li>Binary files </li></ul><ul><ul><li>xpdf, gimp, openoffice2, firefox, konqueror, xdiv, kde, ... </li></ul></ul>
    43. 43. File Commands <ul><li>What is in a file </li></ul><ul><ul><li>cat <file name> </li></ul></ul><ul><ul><li>tac <file name> </li></ul></ul><ul><li>View large files </li></ul><ul><ul><li>more <file name> or pipe: ls -l | more </li></ul></ul><ul><ul><li>less <file name> or pipe: cat test.txt | less </li></ul></ul><ul><li>View not all of file </li></ul><ul><ul><li>tail -# <file name>, -f is continues </li></ul></ul><ul><ul><li>head -# <file name> </li></ul></ul>
    44. 44. File Commands <ul><li>Search content of file </li></ul><ul><ul><li>grep <regular expression> <file name> </li></ul></ul><ul><ul><li>-i : ignore case, -v : invert result, -r : recursive </li></ul></ul><ul><li>Count file words </li></ul><ul><ul><li>wc <file name> </li></ul></ul><ul><ul><li>-l : Lines, -w : words, -c : characters </li></ul></ul><ul><li>Difference between files </li></ul><ul><ul><li>diff <file 1> <file 2> </li></ul></ul><ul><ul><li>-Nu : create patch </li></ul></ul>
    45. 45. Editors <ul><li>Again Text editor </li></ul><ul><li>Text Editors </li></ul><ul><ul><li>X editors </li></ul></ul><ul><ul><li>text mode editors </li></ul></ul><ul><li>Again text mode editors </li></ul><ul><li>X editors </li></ul><ul><ul><li>gedit, kwrite </li></ul></ul><ul><ul><li>kate </li></ul></ul>
    46. 46. Editors <ul><li>emacs </li></ul><ul><ul><li>Old and very user friendly </li></ul></ul><ul><ul><li>Menu based, F10 </li></ul></ul><ul><li>mcedit </li></ul><ul><ul><li>A part of the midnight commander </li></ul></ul><ul><ul><li>Menu based, easy to use </li></ul></ul><ul><li>vi & vim (vi improved)‏ </li></ul><ul><ul><li>Difficult </li></ul></ul><ul><ul><li>Editor for programmers </li></ul></ul>
    47. 47. vim <ul><li>Three modes </li></ul><ul><ul><li>Input mode: edit your document </li></ul></ul><ul><ul><li>Command mode: simple commands </li></ul></ul><ul><ul><li>Line input mode: special and advance commands </li></ul></ul><ul><li>Input mode </li></ul><ul><ul><li>Go from command mode by i or a </li></ul></ul><ul><ul><li>Type what you want </li></ul></ul><ul><ul><li>Arrow keys, del , home , ... are workings </li></ul></ul>
    48. 48. vim <ul><li>Command mode, the default mode </li></ul><ul><li>Go from input mode by: Esc </li></ul><ul><li>Navigation commands </li></ul><ul><ul><li>home : start of line </li></ul></ul><ul><ul><li>end : end of line </li></ul></ul><ul><ul><li>b : previous word </li></ul></ul><ul><ul><li>w : next work </li></ul></ul><ul><ul><li>:# : go to line # </li></ul></ul>
    49. 49. vim <ul><li>Edit commands </li></ul><ul><ul><li>x : cut a char </li></ul></ul><ul><ul><li>#dw : cut # of words </li></ul></ul><ul><ul><li>#dd : cut # of lines </li></ul></ul><ul><ul><li>d$ : cut to end of line, d^ : cut to start of line </li></ul></ul><ul><ul><li>#yw : copy # of words </li></ul></ul><ul><ul><li>#yy : copy # of lines </li></ul></ul><ul><ul><li>p : past </li></ul></ul><ul><ul><li>u : undo </li></ul></ul>
    50. 50. vim <ul><li>Line Input mode </li></ul><ul><ul><li>Go from command mode by : </li></ul></ul><ul><ul><li>:w : save file, :w! : force to save </li></ul></ul><ul><ul><li>:e <filename> : open file </li></ul></ul><ul><ul><li>:q : quit, :q! : force to quit </li></ul></ul><ul><ul><li>:! <any command> : run shell command </li></ul></ul><ul><ul><li>/<str> : search str </li></ul></ul><ul><ul><li>:#1,#2 s/ <str1> / <str2> /[c,g] : replace </li></ul></ul>
    51. 51. Process <ul><li>In Linux, every things is file, if it is NOT a process </li></ul><ul><li>Linux is multi-user, multi-process, time-sharing OS </li></ul><ul><li>Each process has a unique id and a parent (tree)‏ </li></ul><ul><li>Process can be run in </li></ul><ul><ul><li>Foreground </li></ul></ul><ul><ul><li>Background </li></ul></ul><ul><li>Foreground is default </li></ul>
    52. 52. Process <ul><li>Background </li></ul><ul><ul><li>& at end of command </li></ul></ul><ul><ul><li>suspend (CTRL-Z), send resume signal ( bg <job id>)‏ </li></ul></ul><ul><ul><li>Process id is NOT job id </li></ul></ul><ul><ul><li>fg <job id> : Job come from background to foreground </li></ul></ul><ul><ul><li>jobs : list of jobs </li></ul></ul>
    53. 53. Process <ul><li>Scheduling, running in background </li></ul><ul><ul><li>at time -f <file name>, atq , atrm <id> </li></ul></ul><ul><ul><li>cron, crontab, man crontab </li></ul></ul><ul><ul><li>nohup <command> & : Leave job running </li></ul></ul><ul><li>Priority </li></ul><ul><ul><li>less nice is better </li></ul></ul><ul><ul><li>nice -# <command> : priority is decreased by # </li></ul></ul><ul><ul><li>renice # <process id> : Change process priority </li></ul></ul>
    54. 54. Process <ul><li>Monitoring </li></ul><ul><ul><li>ps : list of your process </li></ul></ul><ul><ul><li>ps aux : all running process, with command Lines </li></ul></ul><ul><ul><li>top : top processes </li></ul></ul><ul><ul><li>ksysgaurd : Graphical monitor, more than process monitor </li></ul></ul><ul><ul><li>pstree : tree of running processes </li></ul></ul><ul><ul><li>/proc/process-id : kernel information about processes </li></ul></ul>
    55. 55. Process <ul><li>Process and Signal </li></ul><ul><ul><li>Signals are notifiers </li></ul></ul><ul><ul><li>Kernel and users can send signals </li></ul></ul><ul><ul><li>skill - <signal number> <process id>: user send signal </li></ul></ul><ul><ul><li>skill -L : List of signals </li></ul></ul><ul><ul><li>man 7 signal : Full description of signals </li></ul></ul><ul><ul><li>kill <procees-id>, kill -9 <process-id> : Kill the process </li></ul></ul><ul><ul><li>killall -9 <process name> : kill the process </li></ul></ul>
    56. 56. System Information <ul><li>uname -a, -r : Kernel name </li></ul><ul><li>dmesg : Kernel messages </li></ul><ul><li>/var/log/ : system logs (syslogd) and application's messages </li></ul><ul><li>date : date of system </li></ul><ul><li>uptime : How long time your system is alive? </li></ul><ul><li>iostat <device name>: usage of cpu and device </li></ul><ul><li>users, who, w : list of on-line users </li></ul><ul><li>finger <user-name>/@<computer name>: remote users info </li></ul>
    57. 57. Shell <ul><li>Executable applications </li></ul><ul><ul><li>Binary programs: usually in developed in C </li></ul></ul><ul><ul><li>Scripts: shell, perl, awk, python, ... </li></ul></ul><ul><li>Shell (Bash)‏ </li></ul><ul><ul><li>After login, your shell executes ( /etc/passwd )‏ </li></ul></ul><ul><ul><li>.bash_profile </li></ul></ul><ul><ul><li>/etc/bashrc </li></ul></ul><ul><ul><li>.bashrc </li></ul></ul>
    58. 58. Bash <ul><li>Environment Variables </li></ul><ul><ul><li>Save, parameters and some configurations </li></ul></ul><ul><li>Some important variables </li></ul><ul><ul><li>$PATH : Path of commands </li></ul></ul><ul><ul><li>$HOME : Your home directory </li></ul></ul><ul><ul><li>$SHELL : Your shell address </li></ul></ul><ul><ul><li>$PS1 : Bash prompt </li></ul></ul><ul><ul><li>$USER : Your login name </li></ul></ul>
    59. 59. Bash <ul><li>Define a variable </li></ul><ul><ul><li>ABC=“This is test” </li></ul></ul><ul><li>View variable content </li></ul><ul><ul><li>echo $ABC </li></ul></ul><ul><li>Define variable for subsequent shells </li></ul><ul><ul><li>export AAA=“This is test” </li></ul></ul><ul><li>View all variables </li></ul><ul><ul><li>printenv </li></ul></ul>
    60. 60. Bash Script <ul><li>Bash programming language </li></ul><ul><ul><li>Variables </li></ul></ul><ul><ul><ul><li>User defined variables </li></ul></ul></ul><ul><ul><ul><li>Built in variables: $0, $?, ... </li></ul></ul></ul><ul><ul><li>All commands </li></ul></ul>
    61. 61. Bash Script <ul><ul><li>Control statements </li></ul></ul><ul><ul><ul><li>for <name> in <word>; do <commands>; done </li></ul></ul></ul><ul><ul><ul><li>case <variable> in x) <command>;; y) <commands>;; esac </li></ul></ul></ul><ul><ul><ul><li>if <condition>; then <commands>; elif <condition> then <command>; fi </li></ul></ul></ul><ul><ul><ul><li>while <condition>; do <commands>; done </li></ul></ul></ul>
    62. 62. Example vim test.sh #!/bin/bash for file in *; do if grep -q $1 $file; then echo “Found in file: “ $file fi; done; exit 0 chmod +x test.sh ./test.sh test
    63. 63. C programming <ul><li>GCC: GNU Compiler Collection </li></ul><ul><ul><li>C, C++, Java, ADA, Fortran, ... </li></ul></ul><ul><li>Tools to build C or C++ program </li></ul><ul><ul><li>cpp : C preprocessor </li></ul></ul><ul><ul><li>cc : C Compiler </li></ul></ul><ul><ul><li>c++ : C++ Compiler </li></ul></ul><ul><ul><li>as : The assembler </li></ul></ul><ul><ul><li>ld : Linker </li></ul></ul><ul><ul><li>gdb : GNU debugger </li></ul></ul>
    64. 64. C programming <ul><li>All steps altogether </li></ul><ul><ul><li>gcc -o <output name> <input C> </li></ul></ul><ul><li>Intermediate results </li></ul><ul><ul><li>-c : Just compile, with out linking </li></ul></ul><ul><ul><li>-S: Produce assembly code </li></ul></ul><ul><ul><li>-E: Just process the file </li></ul></ul><ul><ul><li>-g: Add debugging options </li></ul></ul>
    65. 65. C programming (make & Makefile) <ul><li>Open source world </li></ul><ul><li>Automate compiling large packages: make & Makefile </li></ul><ul><li>target : req1 req2 .... </li></ul><ul><ul><li>Rule1 to make target </li></ul></ul><ul><ul><li>Rule2 to make target </li></ul></ul><ul><li>req1 : req11 req12 </li></ul><ul><ul><li>Rule11 to make req1 </li></ul></ul><ul><ul><li>.... </li></ul></ul>
    66. 66. Installing programs <ul><li>Binary format </li></ul><ul><ul><li>Distribution depended </li></ul></ul><ul><ul><ul><li>Red Hat & Fedora: rpm & yum </li></ul></ul></ul><ul><ul><ul><li>Debian based (Ubuntu): apt-get </li></ul></ul></ul><ul><li>Source code </li></ul><ul><li>./configure </li></ul><ul><li>make </li></ul><ul><li>make install </li></ul>
    67. 67. Networking <ul><li>Most of network protocols are implemented in Linux </li></ul><ul><ul><li>Application layer: bind, apache, sendmail, ssh, ftp, NFS </li></ul></ul><ul><ul><li>Transport layer: TCP, UDP </li></ul></ul><ul><ul><li>Network Layer: IP, IPX, ATM </li></ul></ul><ul><ul><li>Physical layer: PPP, Ethernet, 802.11 </li></ul></ul><ul><li>Configurations </li></ul><ul><ul><li>On line </li></ul></ul><ul><ul><li>Config files </li></ul></ul>
    68. 68. Networking <ul><li>Network interface (Ethernet)‏ </li></ul><ul><ul><li>ifconfig eth0 10.10.10.1 netmask 255.255.255.0 up </li></ul></ul><ul><ul><li>Red Hat: /etc/sysconfig/network & networking </li></ul></ul><ul><ul><li>Ubuntu: /etc/network/interfaces </li></ul></ul><ul><li>Routing </li></ul><ul><ul><li>route add -net 192.168.0.0/24 gw 10.10.10.2 dev eth0 </li></ul></ul><ul><ul><li>/etc/sysconfig/networking & network </li></ul></ul>
    69. 69. Networking <ul><li>DNS </li></ul><ul><ul><li>/etc/resolve.conf </li></ul></ul><ul><ul><li>/etc/hosts </li></ul></ul><ul><li>Host Name </li></ul><ul><ul><li>hostname </li></ul></ul><ul><ul><li>/etc/hostname </li></ul></ul><ul><li>IP suit: ip route, ip address, ip route .... </li></ul>
    70. 70. Networking <ul><li>Monitoring and Troubleshooting </li></ul><ul><ul><li>List of all connections: netstat -an </li></ul></ul><ul><ul><li>Find route and its MTU: tracepath, traceroute </li></ul></ul><ul><ul><li>Check liveness: ping </li></ul></ul><ul><ul><li>Your machine ip traffic: iptraf </li></ul></ul><ul><ul><li>Sniffer: tcpdum, ethereal </li></ul></ul><ul><ul><li>Scanners: nmap, amap, ... </li></ul></ul>
    71. 71. Using from Network <ul><li>Remote shell: telnet, ssh </li></ul><ul><li>Remote file transfer: ftp, lftp, sftp, scp </li></ul><ul><li>Web: lynx, firefox </li></ul><ul><ul><li>Download: wget, crul, prozilla </li></ul></ul><ul><li>Mail: fetchmail, mail </li></ul><ul><li>DNS resolver: nslookup, dig </li></ul><ul><li>Windows NetBIOS: smb* commands </li></ul>
    72. 72. Services <ul><li>Linux services </li></ul><ul><ul><li>Network services: web, mail, ... </li></ul></ul><ul><ul><li>Local services: udev, alsa </li></ul></ul><ul><li>Startup scripts </li></ul><ul><ul><li>/etc/init.d/<sevice name>, /etc/init.d/apache2 </li></ul></ul><ul><li>Configuration files </li></ul><ul><ul><li>/etc, /etc/apache2 </li></ul></ul>
    73. 73. Security <ul><li>Security </li></ul><ul><ul><li>Local: File security, Process security </li></ul></ul><ul><ul><li>Network </li></ul></ul><ul><li>SELinux: role-based access control and sandboxing </li></ul><ul><li>Each user </li></ul><ul><ul><li>Has its own unique ID, /etc/passwd </li></ul></ul><ul><ul><li>Belong to some groups, /etc/group </li></ul></ul>
    74. 74. Security <ul><li>Process security </li></ul><ul><ul><li>Each process has its own user id </li></ul></ul><ul><ul><li>You can kill only your processes, root can do anythings </li></ul></ul>
    75. 75. Network Security <ul><li>Statefull Firewall: iptables </li></ul><ul><li>IDS: snort </li></ul><ul><li>VPNs </li></ul><ul><ul><li>IPSec: openswan </li></ul></ul><ul><ul><li>SSL: stunnel, openswan </li></ul></ul><ul><li>Secure services </li></ul><ul><ul><li>SSH, SSL, Tunneling </li></ul></ul>
    76. 76. <ul><li>Now is the end time of my presentation </li></ul><ul><li>But it is the start of your Linux learning </li></ul>

    ×