Workshop For Second Year Computer Engineering Students Abdulkarim Memon (VIT, Final Year) Akshay Mankar (VIIT, Alumnus) Imran Ahmed (JSCoE, ALumnus) Miheer Vaidya (VIT, Final Year) Prathamesh Sonpatki (VIT, Alumnus) Vishwakarma Institute of Information Technology 27th Jun 2012 c GNU Free Document Licnese Vishwakarma Institute of Information Technology Linux Orientation Workshop – 1/23
Linux Basics What is Linux The Filesystem Shell Basic Commands 2 Writing Programs What We Need Write a program Compile and Run 3 Debugging Programs Introduction Debugger Operations Debug Tricks ddd c GNU Free Document Licnese Vishwakarma Institute of Information Technology Linux Orientation Workshop – 2/23
4 Communication Guidelines Mailing Lists IRC c GNU Free Document Licnese Vishwakarma Institute of Information Technology Linux Orientation Workshop – 3/23
Linux • Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution.1 • Available in various Distros bundled with various other free software • Ubuntu • Fedora • Linux Mint • ... • Started by Linus Torvalds in 1991 c GNU Free Document Licnese Vishwakarma Institute of Information Technology Linux Orientation Workshop – 4/23
Interface between user and kernel • Can be command line (eg. Bash, Csh, Zsh, etc.) or can be graphical (eg. Gnome, KDE, etc.) Figure: Bash c GNU Free Document Licnese Vishwakarma Institute of Information Technology Linux Orientation Workshop – 7/23
• * : All files • \ : Escape Character • ˜ : Home • . : Current Directory • .. : Parent Directory c GNU Free Document Licnese Vishwakarma Institute of Information Technology Linux Orientation Workshop – 9/23
< and > : Redirect • << and >> : Append • | : Pipe c GNU Free Document Licnese Vishwakarma Institute of Information Technology Linux Orientation Workshop – 10/23
Need • Editor : gedit, kate, vim, emacs. • Compiler : GNU Compiler Collection (gcc) • Debugger : GNU Debugger (gdb) c GNU Free Document Licnese Vishwakarma Institute of Information Technology Linux Orientation Workshop – 11/23
program • Create directory /home/student/sum/ • Create a file sum.c • Open the File • Write a Program in C to calculate sum on n numbers. c GNU Free Document Licnese Vishwakarma Institute of Information Technology Linux Orientation Workshop – 12/23
Run • Command to use: gcc • Syntax: gcc [options] input file.c • Options • -o : Output File • -Wall : Show all warnings • -c : Compile Only • Example $ gcc -o sum sum.c • Run $ ./sum c GNU Free Document Licnese Vishwakarma Institute of Information Technology Linux Orientation Workshop – 14/23
• Debugger used: GNU Debugger (gdb) • Required For Debugging: • CPU Instructions : Required to execute • Symbol Table : Required to map higher level code with binary instructions • $ gcc -o sum sum.c will generate only Binary Executable • Use option -g to generate binary with symbol table • So the command is $ gcc -g -o sum sum.c • Start the Debugger by $ gdb sum c GNU Free Document Licnese Vishwakarma Institute of Information Technology Linux Orientation Workshop – 15/23
• break : Set Breakpoints • run : Start Execution • step : Step into • next : Step over • print : Evaluate an expression • display : Set Watch • undisplay : Unset Watch • continue : Continue to next breakpoint or till end of program c GNU Free Document Licnese Vishwakarma Institute of Information Technology Linux Orientation Workshop – 16/23
• b = break • r = run • s = step • n = next • p = print • Enter blank command to repeat last command • Get help: http://sourceware.org/gdb/current/onlinedocs/gdb/ c GNU Free Document Licnese Vishwakarma Institute of Information Technology Linux Orientation Workshop – 17/23
Data Display Debugger • A Simple to use GUI for gdb. • Also has gdb shell to support programmers c GNU Free Document Licnese Vishwakarma Institute of Information Technology Linux Orientation Workshop – 18/23
• PLUG http://www.plug.org.in/mailman/listinfo/plug-mail Pune Linux Users Group • CoFSUG groups.google.com/group/cofsug CoEP Free Software Users Group c GNU Free Document Licnese Vishwakarma Institute of Information Technology Linux Orientation Workshop – 20/23
Internet Relay Chat • On irc.freenode.net • #ubuntu - Ubuntu Community • #python - Python programmong language • ##c - C programming language • #viitlug - VIIT Linux Users group • #valu - VIT Linux Users group • #ppg-irc - PICT Pune Tech Group c GNU Free Document Licnese Vishwakarma Institute of Information Technology Linux Orientation Workshop – 21/23
Help • dgp-lug summer training class logs http://wiki.dgplug.org/index.php/SummerTraining12#Class Logs • How to communicate using IRC on Fedora Wiki https://fedoraproject.org/wiki/How to communicate using IRC • Careers with GNU/Linux http://www.shakthimaan.com/downloads.html#careers-with- gnu-linux • Using git version control system http://www.shakthimaan.com/downloads.html#di-git-ally- managing-love-letters c GNU Free Document Licnese Vishwakarma Institute of Information Technology Linux Orientation Workshop – 22/23
Workshop For Second Year Computer Engineering Students Abdulkarim Memon (VIT, Final Year) Akshay Mankar (VIIT, Alumnus) Imran Ahmed (JSCoE, ALumnus) Miheer Vaidya (VIT, Final Year) Prathamesh Sonpatki (VIT, Alumnus) Vishwakarma Institute of Information Technology 27th Jun 2012 c GNU Free Document Licnese Vishwakarma Institute of Information Technology Linux Orientation Workshop – 23/23