Topics <ul><li>Vim
Programming in C using gcc
Using gdb-GNU Debugger
Shell Scripting </li></ul>
Basics <ul><li>Different editors in GNU/Linux
Vim-Vi Improved
Emacs
Gedit
Kate
nano
Many more.... </li></ul>
Why Vim? <ul><li>Simple to use
Has all the features that must be there in a basic editor
Upcoming SlideShare
Loading in...5
×

Basics

651
-1

Published on

A small presentation I prepared for the basics of vim, gcc and gdb.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
651
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Basics

  1. 1. Topics <ul><li>Vim
  2. 2. Programming in C using gcc
  3. 3. Using gdb-GNU Debugger
  4. 4. Shell Scripting </li></ul>
  5. 5. Basics <ul><li>Different editors in GNU/Linux
  6. 6. Vim-Vi Improved
  7. 7. Emacs
  8. 8. Gedit
  9. 9. Kate
  10. 10. nano
  11. 11. Many more.... </li></ul>
  12. 12. Why Vim? <ul><li>Simple to use
  13. 13. Has all the features that must be there in a basic editor
  14. 14. Unlimited undo
  15. 15. Syntax colouring
  16. 16. Visual selection
  17. 17. Split windows
  18. 18. Also has a GUI interface - Gvim
  19. 19. Many more...... </li></ul>
  20. 20. Vim Basics <ul><li>Start vim --- vim test.c
  21. 21. Open multiple files using -o and -O attributes
  22. 22. Insertion
  23. 23. Deletion
  24. 24. Dw to delete a word from the cursor
  25. 25. Cw to change a word from the cursor
  26. 26. Dd and cc to delete & change a line respectively
  27. 27. Esc to cancel your commads
  28. 28. Replace </li></ul>
  29. 29. Vim Basics <ul><li>Playing with the cursor
  30. 30. Use normal arrow keys or h,j,k,l to move the cursor left,down,up,right.
  31. 31. Ctrl-f and ctrl-b for page down and page up.
  32. 32. 1G, nG, G to move to first, nth and last line.
  33. 33. 0 or ^ and $ for start and end of a particular line.
  34. 34. w and e for moving to start of next word and end of next word and b for moving to the previous word.
  35. 35. ( and ) for start and end of a sentence and { and } for start and end of paragraph.
  36. 36. H, M and L to move the cursor to the top,middle and bottom of the screen. </li></ul>
  37. 37. Vim basics <ul><li>Some more short-cuts to edit
  38. 38. Yy and yw to yank a line and a word
  39. 39. p to paste
  40. 40. Adding a number in front of the command repeats the command so many times, example, 12yy, 3i
  41. 41. Visual Mode
  42. 42. v, V and Ctrl-V for visual mode of a character, line and block respectively
  43. 43. d-delete ,y-yank,U-convert to uppercase,u-convert to lowercase, ~ -togle,<-unident ,> - ident
  44. 44. Undo the last change using 'u' in normal mode </li></ul>
  45. 45. Vim Basics <ul><li>Search for a word using '/', n and N to get next and previous match
  46. 46. Search and replace using %s/old/new/gc
  47. 47. %: the range of whole file, can replace with a range of lines like (2,50)
  48. 48. s: substitution
  49. 49. old: old pattern to match
  50. 50. new: new pattern for replacement
  51. 51. g: global
  52. 52. c: confirm for every replacement
  53. 53. Split and vs for horizontal and vertical split
  54. 54. '!' can be used to execute commands
  55. 55. Ctrl-p in insert mode shows suggestions in autocomplete </li></ul>
  56. 56. Gcc basics <ul><li>GCC developed by Richard M Stallman as a part of GNU Project
  57. 57. First release in 1987 and in 1992, second release feature to compile
  58. 58. c++ was added.
  59. 59. Features of GCC
  60. 60. It is a portable compiler, runs on most platforms including microcontrollers,DSPs and 64-bit CPUs
  61. 61. GCC is not only a native compiler but also a cross compiler and hence can produce executables for a different system than itself. It can compile itself.
  62. 62. It has multiple language front-ends for parsing different languages.
  63. 63. It has a modular design, hence allowing new languages and architectures to be added very easily
  64. 64. GCC is completely free software!!!! </li></ul>
  65. 65. Gcc Basics <ul><li>How does gcc compile the source code into executable?
  66. 66. Preprocessing (to expand macros)
  67. 67. cpp hello.c > hello.i (for c++, it is .ii)
  68. 68. Compilation (from source code to assembly language)
  69. 69. gcc -Wall -S hello.i (-S instructs the compiler not to create the object file)
  70. 70. Assembly (from assembly language to machine code)
  71. 71. as hello.s -o hello.o (calls to external functions are left undefined to be filled later by the linker)
  72. 72. Linking (to create the final executable)
  73. 73. gcc hello.o
  74. 74. Run ./a.out to get ”Hello, World!” </li></ul>as hello.s -o hello.o
  75. 75. Gcc basics <ul><li>In short, to compile the source code use
  76. 76. gcc -Wall hello.c , the executable is stored as a.out
  77. 77. or
  78. 78. gcc -Wall hello.c -o hello , the executable is stored as hello
  79. 79. To execute the executable
  80. 80. ./a.out or ./hello </li></ul>
  81. 81. Gdb basics <ul><li>Normal DeBugging Techniques
  82. 82. Insert lots of printf statements.
  83. 83. Insert lots of assert statements.
  84. 84. Use a debugger to find out where your code went wrong.
  85. 85. Uses of Gdb
  86. 86. Used to examine the code, line by line and check the status variables.
  87. 87. Very important in situations like segmentation faults </li></ul>
  88. 88. GDB basics <ul><li>Basic commands
  89. 89. Run
  90. 90. Display and print
  91. 91. Break and ignore and disable
  92. 92. Backtrace
  93. 93. Next and step
  94. 94. Continue </li></ul>
  95. 95. Thank you T. Vignesh Prabhu (tvigneshprabhu@gmail.com)
  1. Gostou de algum slide específico?

    Recortar slides é uma maneira fácil de colecionar informações para acessar mais tarde.

×