1 seem3460 tutorial unix introduction. 2 introduction what is unix? an operation system (os),...
TRANSCRIPT
![Page 1: 1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software](https://reader035.vdocuments.mx/reader035/viewer/2022071806/56649dc35503460f94ab5403/html5/thumbnails/1.jpg)
1
SEEM3460 Tutorial
Unix Introduction
![Page 2: 1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software](https://reader035.vdocuments.mx/reader035/viewer/2022071806/56649dc35503460f94ab5403/html5/thumbnails/2.jpg)
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/printableArticle.jhtml?articleID=191901844
Freely available clone/distributions are under rapid development (e.g. Linux & FreeBSD)
![Page 3: 1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software](https://reader035.vdocuments.mx/reader035/viewer/2022071806/56649dc35503460f94ab5403/html5/thumbnails/3.jpg)
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)
![Page 4: 1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software](https://reader035.vdocuments.mx/reader035/viewer/2022071806/56649dc35503460f94ab5403/html5/thumbnails/4.jpg)
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
![Page 5: 1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software](https://reader035.vdocuments.mx/reader035/viewer/2022071806/56649dc35503460f94ab5403/html5/thumbnails/5.jpg)
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
![Page 6: 1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software](https://reader035.vdocuments.mx/reader035/viewer/2022071806/56649dc35503460f94ab5403/html5/thumbnails/6.jpg)
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
![Page 7: 1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software](https://reader035.vdocuments.mx/reader035/viewer/2022071806/56649dc35503460f94ab5403/html5/thumbnails/7.jpg)
7
Managing Files on Unix (1)
Creating an empty file touch <newFileName>
Creating (making) a directory mkdir <newDirName>
Moving (renaming) a file mv <aFileName> <aDirectoryName> mv <oldFileName> <newFileName>
![Page 8: 1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software](https://reader035.vdocuments.mx/reader035/viewer/2022071806/56649dc35503460f94ab5403/html5/thumbnails/8.jpg)
8
Managing Files on Unix (2) Change working directory
cd <aDirName> List files in a directory or fits the pattern
ls <directories/filename patterns> View the content of a file
cat <file paths> more <file paths> less <file paths> head <file path> tail <file path>
![Page 9: 1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software](https://reader035.vdocuments.mx/reader035/viewer/2022071806/56649dc35503460f94ab5403/html5/thumbnails/9.jpg)
9
Managing Files on Unix (3)
Copying a file cp <oldFileName> <newFileName>
Remove a file rm <aFileName>
Remove a non-empty directory rm –r <aDirName>
Remove a whole directory without prompt rm –rf <aDirName>
![Page 10: 1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software](https://reader035.vdocuments.mx/reader035/viewer/2022071806/56649dc35503460f94ab5403/html5/thumbnails/10.jpg)
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
![Page 11: 1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software](https://reader035.vdocuments.mx/reader035/viewer/2022071806/56649dc35503460f94ab5403/html5/thumbnails/11.jpg)
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”
![Page 12: 1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software](https://reader035.vdocuments.mx/reader035/viewer/2022071806/56649dc35503460f94ab5403/html5/thumbnails/12.jpg)
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.