Skip to main content

Advanced Intro to Linux

Posted in

Tueday September 18, 2012

Presentation: Chris Jensen


Alternatives to Gnome:

  • KDE
    • similar to Windows


Compiling/Running Code

  • from terminal
  • to compile:

g++ [progName].cpp -g -o [executableName]

  • -g is for debugging
  • -o [executableName] sets the name of the executable generated (default is a.out)


  • make files
    • for compiling
    • good when you have multiple files or many modifiers
    • the easiest way to create a makefile for your use is to find an existing makefile and modify it (this is what nearly everyone does)


  • to debug without GUI:

gdb [executableName]

break [lineNumber]

display [variableName]

  • break sets a break point
  • display tells gdb to print out the value of the variable


  • to debug with GUI:

ddd [progName].cpp

  • still uses gdb, but provides GUI for ease of use
  • top window
    • example use: display graphical version of array and its contents
  • middle window
    • displays source code, break points, arrow indicating current location in run
  • bottom window
    • shows gdb commands


Text Editors

  • VIM
    • to type, hit Insert
    • to return to non-typing mode, hit Esc
    • rather arcane
  • gEdit
    • simple text editor with syntax highlighting
    • default syntax highlighting is determined by file extension
    • to force specific syntax highlighting, View -> Highlighting
  • Eclipse
    • full-featured editor (Linux version of Visual Studio)
    • primarily for Java
  • nano
    • very simple
    • good if you have only terminal access and don't want to fuss with VIM


Redirecting Output

cat [filename]

  • displays contents of file

[progName] > [fileName]

  • sends output to specified file

[progName] >> [fileName]

  • appends output to specified file