Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
16 views

Lab Compiling Under Linux

This document provides an introduction to CSCI 230 and outlines the objectives and agenda for the computing lab. It covers setting up the environment, using UNIX commands, sending email, subscribing to the class email, using the emacs text editor, compiling and running a simple C program, and logging into the UNIX system.

Uploaded by

nidheeshamrita
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Lab Compiling Under Linux

This document provides an introduction to CSCI 230 and outlines the objectives and agenda for the computing lab. It covers setting up the environment, using UNIX commands, sending email, subscribing to the class email, using the emacs text editor, compiling and running a simple C program, and logging into the UNIX system.

Uploaded by

nidheeshamrita
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 17

CSCI 230

Computing-I

Welcome to CSCI 230!


Problem Solving using C

1
Objectives for the Lab

 Learn problem solving strategies


 Achieve intermediate knowledge of C
Programming Language
 Gain experience leveraging basic data
structures
 Get an understanding of simple algorithms

2
Agenda
 Environment setup
 Login to Pegasus
 Email

 Introduction to UNIX
 UNIX files and directory structure
 Basic UNIX commands

3
Agenda

 How to use a text editor


 emacs editor -- basic commands

 Create and compiler your first C program!


 “Hello world” program
 Compile using “gcc” compiler
 Execute

4
Login to UNIX

 User Name
 Oncourse username
 Password
 Oncourse password

5
Login (Cont’d)

 UNIX is case-sensitive!
 The username and the password are in lower-case
 If you are NOT able to logon then:
 Contact a Lab Instructor or Course Instructor
 Once you login for the first time, the system will
prompt you to change the password…create a new
password and remember it

6
Introduction to UNIX

 UNIX is a multitasking operating system


that manages the resources of a computer
and provides a user interface.
 UNIX is case sensitive, which means, upper
and lower case characters are treated as
different characters.
 The UNIX machine for which you are given
an account is: pegasus.cs.iupui.edu

7
The UNIX Directory Structure
 A directory is a location to store
information.

 UNIX starts with a root directory


/

/etc /home /usr

/bin /jsmith /tjones /local


8
The UNIX Prompt

login: jsmith
Password:
Last login: Mon Aug 22 08:42:33 from gatekeep.usagrou
Sun Microsystems Inc. SunOS 5.8 Generic February 2000

pegasus{jsmith}1:
Command
Command
number
number
Machine
Machinename
name
User
Username
name

9
Essential UNIX Commands
 ls- list files in present working directory
 pwd- display present working directory
 cd- change directory
 cd .. Backup one directory level
 lp (or lpr) - print file to printer: Printer in SL251!
 rm- remove a file
 cp- copy a file
 mv- move or rename a file
 mkdir- make a directory
 rmdir- remove a directory
10
Email

 All email correspondence should take place


through Oncourse.

11
Class E-mail Subscription

 Subscribe to the class email to receive mail


sent to the entire class by instructors and
other classmates
 Send mail to: majordomo@cs.iupui.edu
 Subject: blank
 Body of Message:
subscribe cs230
12
Pine
 You can practice subscribing from unix, but you should
subscribe from whatever email account you use most
during the day or the email you want to receive
emergency notifications.
 From the unix prompt type pine
 The system will indicate the welcome message for the
first time
 Type c to compose a mail
 Write majordomo@cs.iupui.edu in the To field
 Leave the Subject field blank
 Type subscribe cs230 below Message Text
 Type control x to send the mail
 Type q to quit
13
How to Use Emacs

pegasus{jsmith}1:emacs filename

 There is a Tutorial listing the major emacs


commands. I suggest you use the Tutorial.
 To use the tutorial, type emacs at the prompt and
then type <ctrl>h t. This starts the tutorial.
 Quick Access Card – Linux

14
How to Compile A Program

pegasus{jsmith}1: gcc first1.c

 C programs end in the “.c” extension


 The executable file is called a.out

pegasus{jsmith}1: gcc first1.c

15
How to Execute Your Program

pegasus{jsmith}1: a.out
 Type the name of the executable file at the
prompt to run your program

16
Your First C Program

# include <stdio.h>
main(void)
{
printf(“Hello, CSCI 230!\n”);
}

Try it!
17

You might also like