SlideShare a Scribd company logo
1 of 8
Download to read offline
Programming on Linux




      Navya Linux Lectures


         Chintalagiri Shashank
Programming on Linux


    ●   The Linux Command Line

    ●   Text Editors

    ●   Compiling

    ●   IDEs


chintal@iitk.ac.in               Navya Linux Lectures
The Linux Command Line
        –   Some basic commands
             ●   ls <path>
                  –   list all files in <path>
                  –   only 'ls' displays all files in the current directory
             ➢   cd <path>
                  ➢   changes the directory to <path>
                        ➢ if no <path> - goes into your home directory

                        ➢ if <path> = .. - goes one level up

             ➢   pwd
                  ➢   prints out the current path
             ➢   touch <filename>
                  ➢   creates a blank file named <filename>
             ➢   cp <original file> <destination>
             ➢   mv <original file> <destination>
             ➢   rm <filename>
                  ➢   removes the file <filename>
                  ➢   not undo-able. use with care.                     Navya Linux Lectures
chintal@iitk.ac.in
Text Editors
     ●   vim
         –   (command line)
     ●   nano
         –   (command line)
     ●   emacs
         –   (command line, can be installed using apt / synaptic)
     ●   gedit
         –   (graphical)
     ●   kate
         –   (graphical, needs kdelibs, built in terminal, needs to be
             installed using apt / synaptic)
chintal@iitk.ac.in                                  Navya Linux Lectures
Writing programs on linux

    ●   Shebang
        –
        –
        –   Some typical interpreters for shebang lines:
        –      * #!/bin/bash — Execute using bash program in the /bin/ directory
        –      * #!/bin/csh — Execute using csh, the C shell instead
        –      * #!/bin/ksh — Execute using the Korn shell
        –      * #!/bin/awk — Execute using awk program in the /bin/ directory
        –      * #!/bin/sh — Execute using sh
        –      * #!/usr/bin/perl — Execute using Perl
        –      * #!/usr/bin/php — Execute using PHP
        –      * #!/usr/bin/python — Execute using Python
        –      * #!/usr/bin/env — Invocation of some other program using env program in
            /usr/bin directory




chintal@iitk.ac.in                                                   Navya Linux Lectures
Compiling / Running

    ●   C / C++ (installed with build-essential)
            ●   Writing programs
                 –   file extension should be .cpp or .cc for C++ for compatibility with
                     older versions of gcc
                 –   gcc / g++ is slightly different from Turbo C/ TC ++
                        ● C++ header files do not have a '.h' at the end of the name

                        ● to use cout, cin, etc. from iostream(.h), put in the line

                                 “using namespace std;”
                            in the global scope.
                        ● main is int main() instead of void main()

            ●   Compiling programs
                 –   do this from the command line
                 –   gcc <filename.c> -o <output filename>
                 –   g++ <filename.cpp> -o <output filename>
            ●   Running Programs
                 –   ./<output filename>                          Navya Linux Lectures
chintal@iitk.ac.in
Compiling / Running

    ●   Sun Java
        –   Install the java compiler using apt-get or add/remove
            programs. package name : sun-java5-bin
        –   Compiling and running programs is the same as in Java
            for windows
    ●   Python
        –   run from a command line :
             ●   python <filename>
                  –   if <filename> is blank, it takes you to the interpreter mode.
    ●   Perl
        –   run from a command line :
             ●   perl <filename>
                  –   if <filename> is blank, it takes you to the interpreter mode.
chintal@iitk.ac.in                                                  Navya Linux Lectures
Compiling / Running
     ●   Lisp (install gcl using apt/ synaptic)
             ●   Compiling programs
                  –   do this from the command line
                  –   gcl <filename.lisp> -o <output filename>
             ●   Running Programs
                  –   ./<output filename>
     ●   HTML / PHP / CSS
             ●   edit on any text editor
             ●   graphical tool
                  –   Nvu (for HTML)
     ●   Fortran
                  –   To install the GNU Fortran 77 compiler - g77, you need the g77
                      package.
             ●   to compile
                  –   g77 <filename> -o <output filename>
             ●   to run
                  –   ./<output filename>                        Navya Linux Lectures
chintal@iitk.ac.in

More Related Content

What's hot

GCC Compiler as a Performance Testing tool for C programs
GCC Compiler as a Performance Testing tool for C programsGCC Compiler as a Performance Testing tool for C programs
GCC Compiler as a Performance Testing tool for C programsDaniel Ilunga
 
Performance: Observe and Tune
Performance: Observe and TunePerformance: Observe and Tune
Performance: Observe and TunePaul V. Novarese
 
Kernel Recipes 2016 - Speeding up development by setting up a kernel build farm
Kernel Recipes 2016 - Speeding up development by setting up a kernel build farmKernel Recipes 2016 - Speeding up development by setting up a kernel build farm
Kernel Recipes 2016 - Speeding up development by setting up a kernel build farmAnne Nicolas
 
Docker in 30 minutes
Docker in 30 minutesDocker in 30 minutes
Docker in 30 minutesSteve Poole
 
configuring a warm standby, the easy way
configuring a warm standby, the easy wayconfiguring a warm standby, the easy way
configuring a warm standby, the easy wayCommand Prompt., Inc
 
GCMA: Guaranteed Contiguous Memory Allocator
GCMA: Guaranteed Contiguous Memory AllocatorGCMA: Guaranteed Contiguous Memory Allocator
GCMA: Guaranteed Contiguous Memory AllocatorSeongJae Park
 
01 linux-quick-start
01 linux-quick-start01 linux-quick-start
01 linux-quick-startNguyen Vinh
 
Debugging Rails 3 Applications
Debugging Rails 3 ApplicationsDebugging Rails 3 Applications
Debugging Rails 3 ApplicationsNathan Broadbent
 
gcma: guaranteed contiguous memory allocator
gcma:  guaranteed contiguous memory allocatorgcma:  guaranteed contiguous memory allocator
gcma: guaranteed contiguous memory allocatorSeongJae Park
 
Linux Kernel Memory Model
Linux Kernel Memory ModelLinux Kernel Memory Model
Linux Kernel Memory ModelSeongJae Park
 
LCU14 201- Binary Analysis Tools
LCU14 201- Binary Analysis ToolsLCU14 201- Binary Analysis Tools
LCU14 201- Binary Analysis ToolsLinaro
 
Debugging Ruby (with Pry)
Debugging Ruby (with Pry)Debugging Ruby (with Pry)
Debugging Ruby (with Pry)LukeBergen
 
Vanquishing Latency Outliers in the Lightbits LightOS Software Defined Storag...
Vanquishing Latency Outliers in the Lightbits LightOS Software Defined Storag...Vanquishing Latency Outliers in the Lightbits LightOS Software Defined Storag...
Vanquishing Latency Outliers in the Lightbits LightOS Software Defined Storag...ScyllaDB
 
Design choices of golang for high scalability
Design choices of golang for high scalabilityDesign choices of golang for high scalability
Design choices of golang for high scalabilitySeongJae Park
 
Practical SystemTAP basics: Perl memory profiling
Practical SystemTAP basics: Perl memory profilingPractical SystemTAP basics: Perl memory profiling
Practical SystemTAP basics: Perl memory profilingLubomir Rintel
 
Red Hat - LVM - Mazenet Solution
Red Hat - LVM - Mazenet SolutionRed Hat - LVM - Mazenet Solution
Red Hat - LVM - Mazenet SolutionMazenetsolution
 
Overview of FreeBSD PMC Tools
Overview of FreeBSD PMC ToolsOverview of FreeBSD PMC Tools
Overview of FreeBSD PMC ToolsACMBangalore
 
Logical Volume Manager. An Introduction
Logical Volume Manager. An IntroductionLogical Volume Manager. An Introduction
Logical Volume Manager. An IntroductionJuan A. Suárez Romero
 

What's hot (20)

GCC Compiler as a Performance Testing tool for C programs
GCC Compiler as a Performance Testing tool for C programsGCC Compiler as a Performance Testing tool for C programs
GCC Compiler as a Performance Testing tool for C programs
 
Linux: LVM
Linux: LVMLinux: LVM
Linux: LVM
 
Performance: Observe and Tune
Performance: Observe and TunePerformance: Observe and Tune
Performance: Observe and Tune
 
Pitr Made Easy
Pitr Made EasyPitr Made Easy
Pitr Made Easy
 
Kernel Recipes 2016 - Speeding up development by setting up a kernel build farm
Kernel Recipes 2016 - Speeding up development by setting up a kernel build farmKernel Recipes 2016 - Speeding up development by setting up a kernel build farm
Kernel Recipes 2016 - Speeding up development by setting up a kernel build farm
 
Docker in 30 minutes
Docker in 30 minutesDocker in 30 minutes
Docker in 30 minutes
 
configuring a warm standby, the easy way
configuring a warm standby, the easy wayconfiguring a warm standby, the easy way
configuring a warm standby, the easy way
 
GCMA: Guaranteed Contiguous Memory Allocator
GCMA: Guaranteed Contiguous Memory AllocatorGCMA: Guaranteed Contiguous Memory Allocator
GCMA: Guaranteed Contiguous Memory Allocator
 
01 linux-quick-start
01 linux-quick-start01 linux-quick-start
01 linux-quick-start
 
Debugging Rails 3 Applications
Debugging Rails 3 ApplicationsDebugging Rails 3 Applications
Debugging Rails 3 Applications
 
gcma: guaranteed contiguous memory allocator
gcma:  guaranteed contiguous memory allocatorgcma:  guaranteed contiguous memory allocator
gcma: guaranteed contiguous memory allocator
 
Linux Kernel Memory Model
Linux Kernel Memory ModelLinux Kernel Memory Model
Linux Kernel Memory Model
 
LCU14 201- Binary Analysis Tools
LCU14 201- Binary Analysis ToolsLCU14 201- Binary Analysis Tools
LCU14 201- Binary Analysis Tools
 
Debugging Ruby (with Pry)
Debugging Ruby (with Pry)Debugging Ruby (with Pry)
Debugging Ruby (with Pry)
 
Vanquishing Latency Outliers in the Lightbits LightOS Software Defined Storag...
Vanquishing Latency Outliers in the Lightbits LightOS Software Defined Storag...Vanquishing Latency Outliers in the Lightbits LightOS Software Defined Storag...
Vanquishing Latency Outliers in the Lightbits LightOS Software Defined Storag...
 
Design choices of golang for high scalability
Design choices of golang for high scalabilityDesign choices of golang for high scalability
Design choices of golang for high scalability
 
Practical SystemTAP basics: Perl memory profiling
Practical SystemTAP basics: Perl memory profilingPractical SystemTAP basics: Perl memory profiling
Practical SystemTAP basics: Perl memory profiling
 
Red Hat - LVM - Mazenet Solution
Red Hat - LVM - Mazenet SolutionRed Hat - LVM - Mazenet Solution
Red Hat - LVM - Mazenet Solution
 
Overview of FreeBSD PMC Tools
Overview of FreeBSD PMC ToolsOverview of FreeBSD PMC Tools
Overview of FreeBSD PMC Tools
 
Logical Volume Manager. An Introduction
Logical Volume Manager. An IntroductionLogical Volume Manager. An Introduction
Logical Volume Manager. An Introduction
 

Viewers also liked

Bridging the Gaps : Electronic Interconnect Protocols
Bridging the Gaps : Electronic Interconnect ProtocolsBridging the Gaps : Electronic Interconnect Protocols
Bridging the Gaps : Electronic Interconnect ProtocolsShashank Chintalagiri
 
Learn BEM: CSS Naming Convention
Learn BEM: CSS Naming ConventionLearn BEM: CSS Naming Convention
Learn BEM: CSS Naming ConventionIn a Rocket
 
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika AldabaLightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldabaux singapore
 

Viewers also liked (7)

Roboclub, IITK (2008)
Roboclub, IITK (2008)Roboclub, IITK (2008)
Roboclub, IITK (2008)
 
Linux Community
Linux CommunityLinux Community
Linux Community
 
Linux - Introduction
Linux - IntroductionLinux - Introduction
Linux - Introduction
 
Bridging the Gaps : Electronic Interconnect Protocols
Bridging the Gaps : Electronic Interconnect ProtocolsBridging the Gaps : Electronic Interconnect Protocols
Bridging the Gaps : Electronic Interconnect Protocols
 
Pelizaeus–Merzbacher disease
Pelizaeus–Merzbacher diseasePelizaeus–Merzbacher disease
Pelizaeus–Merzbacher disease
 
Learn BEM: CSS Naming Convention
Learn BEM: CSS Naming ConventionLearn BEM: CSS Naming Convention
Learn BEM: CSS Naming Convention
 
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika AldabaLightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
 

Similar to Programming

Bullwinkle introduction
Bullwinkle introductionBullwinkle introduction
Bullwinkle introductionTurner England
 
Approaching package manager
Approaching package managerApproaching package manager
Approaching package managerTimur Safin
 
Linux basic for CADD biologist
Linux basic for CADD biologistLinux basic for CADD biologist
Linux basic for CADD biologistAjay Murali
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014biicode
 
Toolbox of a Ruby Team
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby TeamArto Artnik
 
9 steps to install and configure postgre sql from source on linux
9 steps to install and configure postgre sql from source on linux9 steps to install and configure postgre sql from source on linux
9 steps to install and configure postgre sql from source on linuxchinkshady
 
PyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and MorePyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and MoreMatt Harrison
 
Jenkins and Docker for native Linux packages
Jenkins and Docker for native Linux packagesJenkins and Docker for native Linux packages
Jenkins and Docker for native Linux packagesDaniel Paulus
 
Makefile for python projects
Makefile for python projectsMakefile for python projects
Makefile for python projectsMpho Mphego
 
Capistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient wayCapistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient waySylvain Rayé
 
Quick Guide with Linux Command Line
Quick Guide with Linux Command LineQuick Guide with Linux Command Line
Quick Guide with Linux Command LineAnuchit Chalothorn
 
Software management in linux
Software management in linuxSoftware management in linux
Software management in linuxnejadmand
 
Using R on High Performance Computers
Using R on High Performance ComputersUsing R on High Performance Computers
Using R on High Performance ComputersDave Hiltbrand
 
One-Liners to Rule Them All
One-Liners to Rule Them AllOne-Liners to Rule Them All
One-Liners to Rule Them Allegypt
 
Django dev-env-my-way
Django dev-env-my-wayDjango dev-env-my-way
Django dev-env-my-wayRobert Lujo
 
Debian Linux on Zynq (Xilinx ARM-SoC FPGA) Setup Flow (Vivado 2015.4)
Debian Linux on Zynq (Xilinx ARM-SoC FPGA) Setup Flow (Vivado 2015.4)Debian Linux on Zynq (Xilinx ARM-SoC FPGA) Setup Flow (Vivado 2015.4)
Debian Linux on Zynq (Xilinx ARM-SoC FPGA) Setup Flow (Vivado 2015.4)Shinya Takamaeda-Y
 
Linux Troubleshooting
Linux TroubleshootingLinux Troubleshooting
Linux TroubleshootingKeith Wright
 

Similar to Programming (20)

Smoking docker
Smoking dockerSmoking docker
Smoking docker
 
Bullwinkle introduction
Bullwinkle introductionBullwinkle introduction
Bullwinkle introduction
 
CPAN Training
CPAN TrainingCPAN Training
CPAN Training
 
Linux
LinuxLinux
Linux
 
Approaching package manager
Approaching package managerApproaching package manager
Approaching package manager
 
Linux basic for CADD biologist
Linux basic for CADD biologistLinux basic for CADD biologist
Linux basic for CADD biologist
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
 
Toolbox of a Ruby Team
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby Team
 
9 steps to install and configure postgre sql from source on linux
9 steps to install and configure postgre sql from source on linux9 steps to install and configure postgre sql from source on linux
9 steps to install and configure postgre sql from source on linux
 
PyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and MorePyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and More
 
Jenkins and Docker for native Linux packages
Jenkins and Docker for native Linux packagesJenkins and Docker for native Linux packages
Jenkins and Docker for native Linux packages
 
Makefile for python projects
Makefile for python projectsMakefile for python projects
Makefile for python projects
 
Capistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient wayCapistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient way
 
Quick Guide with Linux Command Line
Quick Guide with Linux Command LineQuick Guide with Linux Command Line
Quick Guide with Linux Command Line
 
Software management in linux
Software management in linuxSoftware management in linux
Software management in linux
 
Using R on High Performance Computers
Using R on High Performance ComputersUsing R on High Performance Computers
Using R on High Performance Computers
 
One-Liners to Rule Them All
One-Liners to Rule Them AllOne-Liners to Rule Them All
One-Liners to Rule Them All
 
Django dev-env-my-way
Django dev-env-my-wayDjango dev-env-my-way
Django dev-env-my-way
 
Debian Linux on Zynq (Xilinx ARM-SoC FPGA) Setup Flow (Vivado 2015.4)
Debian Linux on Zynq (Xilinx ARM-SoC FPGA) Setup Flow (Vivado 2015.4)Debian Linux on Zynq (Xilinx ARM-SoC FPGA) Setup Flow (Vivado 2015.4)
Debian Linux on Zynq (Xilinx ARM-SoC FPGA) Setup Flow (Vivado 2015.4)
 
Linux Troubleshooting
Linux TroubleshootingLinux Troubleshooting
Linux Troubleshooting
 

More from Shashank Chintalagiri

More from Shashank Chintalagiri (8)

Jugnu
JugnuJugnu
Jugnu
 
Notes on experimental methods for measure of viscosity on a falling ball
Notes on experimental methods for  measure of viscosity on a falling ballNotes on experimental methods for  measure of viscosity on a falling ball
Notes on experimental methods for measure of viscosity on a falling ball
 
Mechanosensitive Channel of Small Conductance (MscS)
Mechanosensitive Channel of Small Conductance (MscS)Mechanosensitive Channel of Small Conductance (MscS)
Mechanosensitive Channel of Small Conductance (MscS)
 
Intramembrane Proteases
Intramembrane ProteasesIntramembrane Proteases
Intramembrane Proteases
 
(2014) Quazar Data Acquisition Systems
(2014) Quazar Data Acquisition Systems (2014) Quazar Data Acquisition Systems
(2014) Quazar Data Acquisition Systems
 
Poster : STM/STS Techniques
Poster : STM/STS TechniquesPoster : STM/STS Techniques
Poster : STM/STS Techniques
 
Presentation : STM/STS Techniques
Presentation : STM/STS TechniquesPresentation : STM/STS Techniques
Presentation : STM/STS Techniques
 
Report : STM/STS Implementation
Report : STM/STS ImplementationReport : STM/STS Implementation
Report : STM/STS Implementation
 

Programming

  • 1. Programming on Linux Navya Linux Lectures Chintalagiri Shashank
  • 2. Programming on Linux ● The Linux Command Line ● Text Editors ● Compiling ● IDEs chintal@iitk.ac.in Navya Linux Lectures
  • 3. The Linux Command Line – Some basic commands ● ls <path> – list all files in <path> – only 'ls' displays all files in the current directory ➢ cd <path> ➢ changes the directory to <path> ➢ if no <path> - goes into your home directory ➢ if <path> = .. - goes one level up ➢ pwd ➢ prints out the current path ➢ touch <filename> ➢ creates a blank file named <filename> ➢ cp <original file> <destination> ➢ mv <original file> <destination> ➢ rm <filename> ➢ removes the file <filename> ➢ not undo-able. use with care. Navya Linux Lectures chintal@iitk.ac.in
  • 4. Text Editors ● vim – (command line) ● nano – (command line) ● emacs – (command line, can be installed using apt / synaptic) ● gedit – (graphical) ● kate – (graphical, needs kdelibs, built in terminal, needs to be installed using apt / synaptic) chintal@iitk.ac.in Navya Linux Lectures
  • 5. Writing programs on linux ● Shebang – – – Some typical interpreters for shebang lines: – * #!/bin/bash — Execute using bash program in the /bin/ directory – * #!/bin/csh — Execute using csh, the C shell instead – * #!/bin/ksh — Execute using the Korn shell – * #!/bin/awk — Execute using awk program in the /bin/ directory – * #!/bin/sh — Execute using sh – * #!/usr/bin/perl — Execute using Perl – * #!/usr/bin/php — Execute using PHP – * #!/usr/bin/python — Execute using Python – * #!/usr/bin/env — Invocation of some other program using env program in /usr/bin directory chintal@iitk.ac.in Navya Linux Lectures
  • 6. Compiling / Running ● C / C++ (installed with build-essential) ● Writing programs – file extension should be .cpp or .cc for C++ for compatibility with older versions of gcc – gcc / g++ is slightly different from Turbo C/ TC ++ ● C++ header files do not have a '.h' at the end of the name ● to use cout, cin, etc. from iostream(.h), put in the line “using namespace std;” in the global scope. ● main is int main() instead of void main() ● Compiling programs – do this from the command line – gcc <filename.c> -o <output filename> – g++ <filename.cpp> -o <output filename> ● Running Programs – ./<output filename> Navya Linux Lectures chintal@iitk.ac.in
  • 7. Compiling / Running ● Sun Java – Install the java compiler using apt-get or add/remove programs. package name : sun-java5-bin – Compiling and running programs is the same as in Java for windows ● Python – run from a command line : ● python <filename> – if <filename> is blank, it takes you to the interpreter mode. ● Perl – run from a command line : ● perl <filename> – if <filename> is blank, it takes you to the interpreter mode. chintal@iitk.ac.in Navya Linux Lectures
  • 8. Compiling / Running ● Lisp (install gcl using apt/ synaptic) ● Compiling programs – do this from the command line – gcl <filename.lisp> -o <output filename> ● Running Programs – ./<output filename> ● HTML / PHP / CSS ● edit on any text editor ● graphical tool – Nvu (for HTML) ● Fortran – To install the GNU Fortran 77 compiler - g77, you need the g77 package. ● to compile – g77 <filename> -o <output filename> ● to run – ./<output filename> Navya Linux Lectures chintal@iitk.ac.in