Systems Software
C Programaming and Introduction to Linux
(counts as Program 12)
- Read C Programming Chapters 1-4. Sign and date here when
complete._________________
- Double-Click VMWare Server and the Desktop and start Fedora Linux
- The user name and password are student/student
- Bring a USB drive to every class to save your work on because
anything left on a machine will disappear.
I promise to bring a key drive to every class. Sign and
date._____________________
- Select Application/System Tools/Terminal to create a window
running the Bash command interpreter (shell). Type "help" to
learn more.
- Two of the editors are gedit and vi. Enter the following program
using both editors in file hello.c.
You may need to google "Linux vi tutorial".
vi Sign&Date__________________ gedit
Sign&Date______________________
#include <stdio.h>
int main(int argc, char *argv[]) { printf("hello world\n"); return 0;}
- Use pwd to print the current directory path. What is it?
___________________________
- Type man mkdir. Type q to quit. Note vi is used for display.
What is displayed on the first line of
output?____________________________________
- Type mkdir. What is displayed on line 1 of output?
_____________________________
- Type mkdir --help. What is displayed on line 1 of output?
________________________
- Create a directory named test using the mkdir command.
- Use the mv command to move hello.c to directory test.
- Use the cd command to set the current directory to test.
- Type the ls -l command. What is the output
___________________________________
- Type gcc -c hello.c.
Once you have fixed all compile errors, type the ls command.
What new file did the compiler generate?
_______________________________________
- Type gcc -S hello.c. What new file did the compiler generate?
_______________________
Type the cat command on the new file. What is line
1?_____________________________
- Type gcc -E hello.c. What is line 1 of the
output?_____________________________
- Type gcc hello.c. What new file did the compiler generate?
_______________________
The new file is the executable for the program. Type its name to
execute it.
What did you type to make it execute and what is the
output?______________________
- Use >flip.txt to redirect the output to file flip.txt. List
your comman line._______________
- Type od -c flip.txt. List the
output._____________________________________________
- Use the rm command to delete all files EXCEPT hello.c.
- Type the set command. What is the 1st directory in the search
path?___________________
- Use cat | and sort on the command line to print the 2 lines of
hello.c in int/# order.
What command line was successful? ___________________________________
- Place an & at the end of the previous command line. What's
the output? ________________
- Run Program 1 in the text.
Sign&Date.__________________________________________
- Run the printf sample program in the text.
Sign&Date.______________________________
- Run the formatted square/cube sample program in the text.
Sign&Date._________________
- Run the CtoF argv Pattern sample program in the text.
Sign&Date._____________________
- Run the assert sample program in the text.
Sign&Date.______________________________
- Run the goto sample program in the text.
Sign&Date.______________________________
- Run Program 5 in the text.
Sign&Date.______________________________
- Modify the numerical integration sample program to calculate the
integral from 0 to 3 of sqrt(x).
What is the answer? ________________