Title: Why we choose UNIX
1Why we choose UNIX
- Powerful
- Multi-user operating system
- Good programming tools
- Most heavy-duty database management systems
started out on Unix - Flexible
- Thousands of tools that can be combined and
recombined. - Reliable
- Unix is hard to crash.
2How to Access a UNIX Machine
telnet / ftp
telnet allows you to connect to other computers
and use softwares there ftp
allows you to retrieve files from other
computers.
3Telnet
- TELetype NETwork
- A network protocol used on the Internet / LAN
- By extension, refers to the program which
provides the client part of the protocol - Once connected
- Log on as a regular user with access to
- application / software
- data
- A Telnet command request looks like this
- telnet rain.cise.ufl.edu
4FTP
- File Transfer Protocol
- A network protocol used on the Internet / LAN
- Allow to transfer files to and from remote
computers - A ftp command request looks like this
- ftp rain.cise.ufl.edu
5SSH
- Download SSH
- http//www.openssh.org/
Figures from http//www.suso.org/docs/shell/ssh.sd
f
6More about SSH
- Recommendation for Windows
- Putty as telnet tool
- http//www.chiark.greenend.org.uk/sgtatham/putty/
download.html - WinSCP as ftp tool
- http//winscp.net/eng/download.php
- Other choices
- ftp, telnet using command line in windows
- Other softwares
- Core FTP
- http//www.coreftp.com/download.html
7Unix Commands
- man manual (man gcc)
- ls list directory contents (ls)
- pwd prints working directory (pwd)
- cd change directory (cd ltsubdirectorygt)
- mkdir create directory (mkdir ltnew directorygt
- rm remove a file (rm ltfile to removegt)
- Use r if removing a directory
8Unix Commands(cont)
- cpcopy a file (cp ltsourcegtltdestinationgt)
- Use r if copying a directory
- mvmove or rename files (mv ltsourcegt
ltdestinationgt) - jpico text editor (jpico ltfile to editgt)
- gcc compiler (gcc sourceFile.c)
- -o option
- Directory shortcuts
- home directory
- .. parent directory
- . sub directory
9Your First Program
Preprocessor interact with input/output of your
computer
- include ltstdio.hgt
- int main()
-
- printf("Hello World\n")
- return 0
-
You will see this at the beginning of nearly all
programs Tells computer to load file named
ltstdio.hgt ltstdio.hgt allows standard input/output
operations
10Your First Program
Preprocessor interact with input/output of your
computer
- include ltstdio.hgt
- int main()
-
- printf("Hello World\n")
- return 0
-
Start point of the program
C programs contain one or more functions, exactly
one of which must be main int means that the
function main will "return" an integer value
11Your First Program
Preprocessor interact with input/output of your
computer
- include ltstdio.hgt
- int main()
-
- printf("Hello World\n")
- return 0
-
Start point of the program
Start and finish of function
12Your First Program
Preprocessor interact with input/output of your
computer
- include ltstdio.hgt
- int main()
-
- printf("Hello World\n")
- return 0
-
Start point of the program
Start and finish of function
Printing a line of Text
13Your First Program
Preprocessor interact with input/output of your
computer
- include ltstdio.hgt
- int main()
-
- printf("Hello World\n")
- return 0
-
Start point of the program
Start and finish of function
Printing a line of Text
14Your First Program
Preprocessor interact with input/output of your
computer
- include ltstdio.hgt
- int main()
-
- printf("Hello World\n")
- return 0
-
Start point of the program
Start and finish of function
Printing a line of Text
Finish and return value 0
A way to exit a function It means that the
program terminated normally in this case
15Comments for programs
- Why need comments
- Good habit
- Readable to others
- Remind yourself
- How to comment
- / /
- //
- Effects on compiler
- Examples
16Compiler
- What is compiler
- A computer program (or set of programs) that
translates text written in a computer language (
the source code) into another computer language
(most time the executable file) - Why we need a compiler
- Available C compiler in UNIX system gcc
- gcc sourcefile.c o exefile.exe
17Text Editors
- Edit your code Using wordpad, or some text editor
on your personal computer - Need to transfer your program to UNIX machine
using ftp - Edit your code in UNIX using
- vi
- pico (jpico)
- emacs
18Procedure
This is your C program. Type the code in any
standard text editor, and save it as
helloworld.c. Transfer it to rain.cise.ufl.edu if
necessary
Type gcc helloworld.c o helloworld.exe to
compile helloworld.c into helloworld.exe using
the gcc compiler
The gcc compiler generates corresponding
executable code named helloworld.exe. The
computer can execute this machine readable code
if you type ./helloworld.exe