Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software.

Similar presentations


Presentation on theme: "1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software."— Presentation transcript:

1 1 SEEM3460 Tutorial Unix Introduction

2 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software Ever Written!! http://www.informationweek.com/shared/printabl eArticle.jhtml?articleID=191901844 http://www.informationweek.com/shared/printabl eArticle.jhtml?articleID=191901844 Freely available clone/distributions are under rapid development (e.g. Linux & FreeBSD)

3 3 Using Unix Shell: a program that acts as a middleman between you and the UNIX OS Terms similar to shell: Terminal / virtual terminal Console A shell allows users to Run programs Manage I/O of processes easily A Unix shell interprets a programming language (sometimes called the shell script)

4 A shell command ls -lp ~ ls: program name “ls” is the utility to list files -lp: options/switches, starting with a hyphen “l” means list in long format “p” means putting a slash after directory names ~: remaining parameters actual meaning depends on the program used for ls, the remaining parameters are the files or directories to be listed “~” means the home directory of the current user 4

5 Utilities Unix utilities are the basic programs supporting the user to control the system Examples: date: shows the system date man -s 1 ls: shows help on ls from the built-in manual section 1 pwd: prints the working directory echo: prints a message 5

6 6 Unix file system in brief A hierarchy of directories To locate a file in the system, a pathname is needed Command: pwd print your current working directory Pathnames Absolute pathnames Starting from the root (with a beginning “/”) Relative pathnames Starting from the current working directory

7 Managing Files on Unix (1) Creating an empty file touch Creating (making) a directory mkdir Moving (renaming) a file mv 7

8 Managing Files on Unix (2) Change working directory cd List files in a directory or fits the pattern ls View the content of a file cat more less head tail 8

9 Managing Files on Unix (3) Copying a file cp Remove a file rm Remove a non-empty directory rm –r Remove a whole directory without prompt rm –rf 9

10 10 Editing a file nano Adv: simple, easy to learn and use Dis: no GUI emacs Adv: has GUI, easy for beginners Dis: relatively slow vi/vim (vim stands for Vi Improved) Adv: fast for advance users Dis: text-version is quite difficult to learn GUI version: gvim, rgvim To learn, type “vitutor” in console Check their “man” page for detail usages

11 11 Compiling C programs in Unix Compiler: cc – the native C compiler under Unix gcc – C compiler under GNU project Usage is the same, gcc is more popular To compile a C source code file, say example.c, type in: cc example.c gcc example.c The output of both compilers (i.e. the executable) would be “a.out” by default To override the default executable name, use “-o” flag cc example.c –o example gcc example.c –o example You can name the executable as.exe or.bin file to remind yourself the nature of the file One more tip, use “-Wall” to get some warning messages Warning message usually indicate hidden bugs Try to understand the error messages and warning messages. For other flags, “man cc” or “man gcc”

12 12 Compiling C programs in Unix If there are so many compilation errors that it cannot fit into one screen. One way is to compile by the following command: cc example.c |& more It means that the compilation errors will be displayed screen by screen. That is, it will display the first screen of errors and wait. After the user examines the errors, he/she can choose to display the next screen of errors by hitting RETURN or quit by hitting Control-C. Then, the user can go back to modify the source code.


Download ppt "1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software."

Similar presentations


Ads by Google