際際滷

際際滷Share a Scribd company logo
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 (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
Daniel Ilunga
Linux: LVM
Linux: LVMLinux: LVM
Linux: LVM
Michal Sedlak
Performance: Observe and Tune
Performance: Observe and TunePerformance: Observe and Tune
Performance: Observe and Tune
Paul V. Novarese
Pitr Made Easy
Pitr Made EasyPitr Made Easy
Pitr Made Easy
Joshua Drake
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
Anne Nicolas
Docker in 30 minutes
Docker in 30 minutesDocker in 30 minutes
Docker in 30 minutes
Steve 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 way
Command Prompt., Inc
GCMA: Guaranteed Contiguous Memory Allocator
GCMA: Guaranteed Contiguous Memory AllocatorGCMA: Guaranteed Contiguous Memory Allocator
GCMA: Guaranteed Contiguous Memory Allocator
SeongJae Park
01 linux-quick-start
01 linux-quick-start01 linux-quick-start
01 linux-quick-start
Nguyen Vinh
Debugging Rails 3 Applications
Debugging Rails 3 ApplicationsDebugging Rails 3 Applications
Debugging Rails 3 Applications
Nathan Broadbent
gcma: guaranteed contiguous memory allocator
gcma:  guaranteed contiguous memory allocatorgcma:  guaranteed contiguous memory allocator
gcma: guaranteed contiguous memory allocator
SeongJae Park
Linux Kernel Memory Model
Linux Kernel Memory ModelLinux Kernel Memory Model
Linux Kernel Memory Model
SeongJae Park
LCU14 201- Binary Analysis Tools
LCU14 201- Binary Analysis ToolsLCU14 201- Binary Analysis Tools
LCU14 201- Binary Analysis Tools
Linaro
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 scalability
SeongJae Park
Practical SystemTAP basics: Perl memory profiling
Practical SystemTAP basics: Perl memory profilingPractical SystemTAP basics: Perl memory profiling
Practical SystemTAP basics: Perl memory profiling
Lubomir Rintel
Red Hat - LVM - Mazenet Solution
Red Hat - LVM - Mazenet SolutionRed Hat - LVM - Mazenet Solution
Red Hat - LVM - Mazenet Solution
Mazenetsolution
Overview of FreeBSD PMC Tools
Overview of FreeBSD PMC ToolsOverview of FreeBSD PMC Tools
Overview of FreeBSD PMC Tools
ACMBangalore
Logical Volume Manager. An Introduction
Logical Volume Manager. An IntroductionLogical Volume Manager. An Introduction
Logical Volume Manager. An Introduction
Juan A. Su叩rez Romero
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
Daniel Ilunga
Performance: Observe and Tune
Performance: Observe and TunePerformance: Observe and Tune
Performance: Observe and Tune
Paul 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 farm
Anne Nicolas
Docker in 30 minutes
Docker in 30 minutesDocker in 30 minutes
Docker in 30 minutes
Steve 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 way
Command Prompt., Inc
GCMA: Guaranteed Contiguous Memory Allocator
GCMA: Guaranteed Contiguous Memory AllocatorGCMA: Guaranteed Contiguous Memory Allocator
GCMA: Guaranteed Contiguous Memory Allocator
SeongJae Park
01 linux-quick-start
01 linux-quick-start01 linux-quick-start
01 linux-quick-start
Nguyen Vinh
Debugging Rails 3 Applications
Debugging Rails 3 ApplicationsDebugging Rails 3 Applications
Debugging Rails 3 Applications
Nathan Broadbent
gcma: guaranteed contiguous memory allocator
gcma:  guaranteed contiguous memory allocatorgcma:  guaranteed contiguous memory allocator
gcma: guaranteed contiguous memory allocator
SeongJae Park
Linux Kernel Memory Model
Linux Kernel Memory ModelLinux Kernel Memory Model
Linux Kernel Memory Model
SeongJae Park
LCU14 201- Binary Analysis Tools
LCU14 201- Binary Analysis ToolsLCU14 201- Binary Analysis Tools
LCU14 201- Binary Analysis Tools
Linaro
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 scalability
SeongJae Park
Practical SystemTAP basics: Perl memory profiling
Practical SystemTAP basics: Perl memory profilingPractical SystemTAP basics: Perl memory profiling
Practical SystemTAP basics: Perl memory profiling
Lubomir Rintel
Red Hat - LVM - Mazenet Solution
Red Hat - LVM - Mazenet SolutionRed Hat - LVM - Mazenet Solution
Red Hat - LVM - Mazenet Solution
Mazenetsolution
Overview of FreeBSD PMC Tools
Overview of FreeBSD PMC ToolsOverview of FreeBSD PMC Tools
Overview of FreeBSD PMC Tools
ACMBangalore
Logical Volume Manager. An Introduction
Logical Volume Manager. An IntroductionLogical Volume Manager. An Introduction
Logical Volume Manager. An Introduction
Juan A. Su叩rez Romero

Viewers also liked (7)

Roboclub, IITK (2008)
Roboclub, IITK (2008)Roboclub, IITK (2008)
Roboclub, IITK (2008)
Shashank Chintalagiri
Linux Community
Linux CommunityLinux Community
Linux Community
Shashank Chintalagiri
Linux - Introduction
Linux - IntroductionLinux - Introduction
Linux - Introduction
Shashank Chintalagiri
Bridging the Gaps : Electronic Interconnect Protocols
Bridging the Gaps : Electronic Interconnect ProtocolsBridging the Gaps : Electronic Interconnect Protocols
Bridging the Gaps : Electronic Interconnect Protocols
Shashank Chintalagiri
PelizaeusMerzbacher disease
PelizaeusMerzbacher diseasePelizaeusMerzbacher disease
PelizaeusMerzbacher disease
Shashank Chintalagiri
Learn BEM: CSS Naming Convention
Learn BEM: CSS Naming ConventionLearn BEM: CSS Naming Convention
Learn BEM: CSS Naming Convention
In 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 Aldaba
ux singapore
Bridging the Gaps : Electronic Interconnect Protocols
Bridging the Gaps : Electronic Interconnect ProtocolsBridging the Gaps : Electronic Interconnect Protocols
Bridging the Gaps : Electronic Interconnect Protocols
Shashank Chintalagiri
Learn BEM: CSS Naming Convention
Learn BEM: CSS Naming ConventionLearn BEM: CSS Naming Convention
Learn BEM: CSS Naming Convention
In 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 Aldaba
ux singapore
Ad

Similar to Programming (20)

Linux Basics
Linux BasicsLinux Basics
Linux Basics
Team-VLSI-ITMU
Unix_commands_theory
Unix_commands_theoryUnix_commands_theory
Unix_commands_theory
Niti Patel
Linux: A Getting Started Presentation
Linux: A Getting Started PresentationLinux: A Getting Started Presentation
Linux: A Getting Started Presentation
Nap Ramirez
Information about linux operating system
Information about linux operating systemInformation about linux operating system
Information about linux operating system
PriyankaMate4
Linux shell ggsipu-lug
Linux shell ggsipu-lugLinux shell ggsipu-lug
Linux shell ggsipu-lug
Aashish Sawhney
Linux operating system by Quontra Solutions
Linux operating system by Quontra SolutionsLinux operating system by Quontra Solutions
Linux operating system by Quontra Solutions
QUONTRASOLUTIONS
Unleash your inner console cowboy
Unleash your inner console cowboyUnleash your inner console cowboy
Unleash your inner console cowboy
Kenneth Geisshirt
Linux CLI
Linux CLILinux CLI
Linux CLI
International Institute of Tropical Agriculture
Karkha unix shell scritping
Karkha unix shell scritpingKarkha unix shell scritping
Karkha unix shell scritping
chockit88
Linux shell scripting
Linux shell scriptingLinux shell scripting
Linux shell scripting
Mohamed Abubakar Sittik A
3. intro
3. intro3. intro
3. intro
Harsh Shrimal
Nguy畛n V滴 H動ng: Basic Linux Power Tools
Nguy畛n V滴 H動ng: Basic Linux Power Tools Nguy畛n V滴 H動ng: Basic Linux Power Tools
Nguy畛n V滴 H動ng: Basic Linux Power Tools
Vu Hung Nguyen
Raspberry pi Part 3
Raspberry pi Part 3Raspberry pi Part 3
Raspberry pi Part 3
Techvilla
cisco
ciscocisco
cisco
edomaldo
Linux Systems Programming: Ubuntu Installation and Configuration
Linux Systems Programming: Ubuntu Installation and ConfigurationLinux Systems Programming: Ubuntu Installation and Configuration
Linux Systems Programming: Ubuntu Installation and Configuration
RashidFaridChishti
Linux
LinuxLinux
Linux
nazeer pasha
BACKGROUND A shell provides a command-line interface for users. I.docx
BACKGROUND A shell provides a command-line interface for users. I.docxBACKGROUND A shell provides a command-line interface for users. I.docx
BACKGROUND A shell provides a command-line interface for users. I.docx
wilcockiris
Linux introduction-commands2338
Linux introduction-commands2338Linux introduction-commands2338
Linux introduction-commands2338
Cam YP Co., Ltd
Linux introduction-commands2338
Linux introduction-commands2338Linux introduction-commands2338
Linux introduction-commands2338
Cam YP Co., Ltd
Linux Introduction (Commands)
Linux Introduction (Commands)Linux Introduction (Commands)
Linux Introduction (Commands)
anandvaidya
Unix_commands_theory
Unix_commands_theoryUnix_commands_theory
Unix_commands_theory
Niti Patel
Linux: A Getting Started Presentation
Linux: A Getting Started PresentationLinux: A Getting Started Presentation
Linux: A Getting Started Presentation
Nap Ramirez
Information about linux operating system
Information about linux operating systemInformation about linux operating system
Information about linux operating system
PriyankaMate4
Linux shell ggsipu-lug
Linux shell ggsipu-lugLinux shell ggsipu-lug
Linux shell ggsipu-lug
Aashish Sawhney
Linux operating system by Quontra Solutions
Linux operating system by Quontra SolutionsLinux operating system by Quontra Solutions
Linux operating system by Quontra Solutions
QUONTRASOLUTIONS
Unleash your inner console cowboy
Unleash your inner console cowboyUnleash your inner console cowboy
Unleash your inner console cowboy
Kenneth Geisshirt
Karkha unix shell scritping
Karkha unix shell scritpingKarkha unix shell scritping
Karkha unix shell scritping
chockit88
Nguy畛n V滴 H動ng: Basic Linux Power Tools
Nguy畛n V滴 H動ng: Basic Linux Power Tools Nguy畛n V滴 H動ng: Basic Linux Power Tools
Nguy畛n V滴 H動ng: Basic Linux Power Tools
Vu Hung Nguyen
Raspberry pi Part 3
Raspberry pi Part 3Raspberry pi Part 3
Raspberry pi Part 3
Techvilla
Linux Systems Programming: Ubuntu Installation and Configuration
Linux Systems Programming: Ubuntu Installation and ConfigurationLinux Systems Programming: Ubuntu Installation and Configuration
Linux Systems Programming: Ubuntu Installation and Configuration
RashidFaridChishti
BACKGROUND A shell provides a command-line interface for users. I.docx
BACKGROUND A shell provides a command-line interface for users. I.docxBACKGROUND A shell provides a command-line interface for users. I.docx
BACKGROUND A shell provides a command-line interface for users. I.docx
wilcockiris
Linux introduction-commands2338
Linux introduction-commands2338Linux introduction-commands2338
Linux introduction-commands2338
Cam YP Co., Ltd
Linux introduction-commands2338
Linux introduction-commands2338Linux introduction-commands2338
Linux introduction-commands2338
Cam YP Co., Ltd
Linux Introduction (Commands)
Linux Introduction (Commands)Linux Introduction (Commands)
Linux Introduction (Commands)
anandvaidya
Ad

More from Shashank Chintalagiri (8)

Jugnu
JugnuJugnu
Jugnu
Shashank Chintalagiri
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
Shashank Chintalagiri
Mechanosensitive Channel of Small Conductance (MscS)
Mechanosensitive Channel of Small Conductance (MscS)Mechanosensitive Channel of Small Conductance (MscS)
Mechanosensitive Channel of Small Conductance (MscS)
Shashank Chintalagiri
Intramembrane Proteases
Intramembrane ProteasesIntramembrane Proteases
Intramembrane Proteases
Shashank Chintalagiri
(2014) Quazar Data Acquisition Systems
(2014) Quazar Data Acquisition Systems (2014) Quazar Data Acquisition Systems
(2014) Quazar Data Acquisition Systems
Shashank Chintalagiri
Poster : STM/STS Techniques
Poster : STM/STS TechniquesPoster : STM/STS Techniques
Poster : STM/STS Techniques
Shashank Chintalagiri
Presentation : STM/STS Techniques
Presentation : STM/STS TechniquesPresentation : STM/STS Techniques
Presentation : STM/STS Techniques
Shashank Chintalagiri
Report : STM/STS Implementation
Report : STM/STS ImplementationReport : STM/STS Implementation
Report : STM/STS Implementation
Shashank Chintalagiri
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
Shashank Chintalagiri
Mechanosensitive Channel of Small Conductance (MscS)
Mechanosensitive Channel of Small Conductance (MscS)Mechanosensitive Channel of Small Conductance (MscS)
Mechanosensitive Channel of Small Conductance (MscS)
Shashank Chintalagiri
(2014) Quazar Data Acquisition Systems
(2014) Quazar Data Acquisition Systems (2014) Quazar Data Acquisition Systems
(2014) Quazar Data Acquisition Systems
Shashank Chintalagiri
Presentation : STM/STS Techniques
Presentation : STM/STS TechniquesPresentation : STM/STS Techniques
Presentation : STM/STS Techniques
Shashank Chintalagiri

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