Presentation is loading. Please wait.

Presentation is loading. Please wait.

Laboratory: Mechatronics Workshop, Room# E2-2-13.12.

Similar presentations


Presentation on theme: "Laboratory: Mechatronics Workshop, Room# E2-2-13.12."— Presentation transcript:

1

2 Laboratory: Mechatronics Workshop, Room# E2-2-13.12

3 Every computer uses an operating system. The operating system forms a platform for other system software and application software. The most popular operating systems in use today are: Windows from Microsoft Mac OS from Apple UNIX / LINUX 3

4 Multitasking & Multi-user OS. Unix has user interfaces called Shells (Terminals) that is more controlled, more flexible and powerful than the standard operating system text-based interface. Main purpose is to make it easier for the user to manipulate the functions of the operating system 4

5 Unix is more flexible and can be installed on many different types of machines, main-frame computers, Supercomputers micro-computers. Unix is more stable, which means, does not go down as often as Windows, so, Needs less administration and maintenance. Unix has comparably greater built-in security and permissions features. Unix possesses much greater processing power. 5

6 Unix is the leader in serving the Web. About 90% of the Internet relies on Unix operating systems running Apache, most widely used Web server. Mostly free or inexpensive open-source operating systems. Unix also inspires novel approaches to software design, such as, solving problems by interconnecting simpler tools instead of creating large monolithic application programs. 6

7 Need to Remember One single type of Operating System (OS) can not provide universal answers to all your computing needs. 7

8 Developed in 1969 by a group of AT&T employees at Bell Labs. The Unix operating system was first developed in Assembly Language. By 1973 had been almost entirely recoded in C. Today's Unix systems are split into various branches, developed over time by AT&T as well as various commercial vendors and non-profit organizations. As of 2007, the owner of the trademark is The Open Group, an industry standards consortium. Only systems fully compliant with and certified according to the Single UNIX Specification are qualified to use the trademark; others are called, "Unix system-like" or "Unix-like“ Ex: MINIX, Linux, and BSD. 8

9 Outlined by The Open Group, a consortium that holds the UNIX trademark. Only system that complies with the specification can use the trademark. Those that not complies are classified as UNIX-like. Registered UNIX products - Digital ® UNIX, Hewlett Packard HP-UX ®, IBM AIX ®, SCO UnixWare ®, SGI IRIX ®, Sun Solaris ® Linux is a product that mimics the form and function of a UNIX system, but is not derived from original UNIX licensed source code and is classified as UNIX- like. 9

10 o Kernel Master control of all computer operations. Controls access to files, Allocates resources, Controls input/output (I/O), Manages memory. o Shell Command interpreter: transfers information between user and the Kernel Common shells: “C” shell, Bourne Shell, Korn Shell. Shell uses prompt (% or $) to indicate readiness to accept next command. 10 Shell Kernel Applications

11 commands SHELL OR TERMINAL 11 Shell or Terminal

12 Everything in UNIX is either a file or a process. A process is an executing program identified by a unique Process Identifier (PID). A file is a collection of data. They are created by users using text editors, running compilers etc. Examples of files: a document (report, essay etc.) the text of a program written in some high-level programming language instructions comprehensible directly to the machine and incomprehensible to a casual user, for example, a collection of binary digits (an executable or binary file); a directory (or folder in Windows), containing information about its contents, which may be a mixture of other directories (subdirectories) and ordinary files. 12

13 Unix file-store is divided into a tree of directories and sub-directories. At the very top-level (or bottom level depending on how you look at it) is the root directory, represented by the ‘/’ character. Users can sub-divide their own directory into a number of sub-directories, so that they may group their files according to the different areas of their work. Pathname: “directions” to a file through directories and subdirectories 13

14 Below are a number of system directories (such as /bin, /lib, /dev) together with the directories for user files. 14

15 Main login directory (the home directory) for the user Fred who has been allocated to the u1 directory would be /u1/fred. The full filename or pathname for Fred's file results1 in the subdirectory plants would be /u1/Fred/plants/results1. If user Fred is working in the default, home directory, then only plants/results1 need be used to refer to the file. 15

16 Absolute: Every file has 1 and only 1 absolute address. Usually starts with a “/” as first character. Starts at root directory and moves through directories/subdirectories to file. Can use “~” to start the path at the user level. Relative: Describe path to file from current working directory. Relative addresses are not unique. Do not need to begin with a “/”. 16

17 Single dot (.) used to signify current working directory. Double dot (..) used to describe parent (1 step up) directory. Relative address starts at current level and moves through subdirectories. Each step (directory/subdirectory) is separated by a “/”. 17

18 Up to 256 characters in length. Can start with/be all numbers. Can use: period (.) underscore (_) dash (-) comma (,) Case sensitive (PC usually not). Do not include spaces in file name. 18

19 Characters that can be used to match a number of different character combinations are called WILD CHARACTERS. ( ? ) - represents 1 character ex.: Lab?.c could describe Lab3.c, Lab8.c, LabK.c (*) - represents more than 1 character ex.: Lab*.c could describe Lab223.c, LabA1155.c 19

20 Relative Address:“.” = current directory “..” = dir. 1 step up “/” = separates steps 20 Examples

21 Absolute Address of file ex7.c /home/lookout/a/fred/c/hmwks/ex7.c Using “~” shortcut to “users” level: ~/c/hmwks/ex7.c 21 Examples (Con.)

22 If working dir. is fred, relative address of ex7.c is c/hmwks/ex7.c 22 Examples (Con.)

23 Relative Address of fred to file “data”:../../../boreas/b/eric/chm/lab1/data 23 Examples (Con.)

24 Files are grouped in the directory structure. The file-system is arranged like hierarchical tree (inverted) structure. The top of the tree is called “root” which usually contains several sub-directories. In UNIX “/” (forward slash) is used to present the “root”. 24

25 Home directory might contain a public_html directory. public_html directory might contain an “index.html” file. public_html home_directory index.html 25

26 A file cannot hold a directory or a file! public_html home_directory index.html New_file_or_directory 26

27 Directories can hold files and other directories / binetc users tmp backup user1 user2 … usern public_html file1 index.html 27

28 Absolute Pathnames In the previous tree /users/usern/file1 is an absolute pathname. Relative pathnames If you are already in the users directory, the relative pathname for file1 is usern/file1.

29 What is the absolute path to index.html? / binetc users tmp backup user1 user2 … usern public_html file1 index.html Answer: /users/usern/public_html/index.html 29

30 What is the relative path to index.html (assuming that usern is your working directory) / binetc users tmp backup user1 user2 … usern public_html file1 index.html Answer: public_html/index.html 30

31 ls [names] – list files contained in a directory name or that match a file name. If no name is given list those files in current directory. ls –a list all files including hidden files ls –l list in long format (including details like permissions, owner, size, etc.), works very much like dir ls –al list all files (including hidden files) in long format ls –dl dir_name lists information about the directory, “dir_name”. 31

32 pwd –let you know the absolute pathname of your current working directory (Print Working Directory) cd [dir] – change directory cd.. –go back to parent directory. “..” is the relative pathname to the parent directory. “.” stands for current (working) directory. “~” – the tilde character can refer to your home directory. 32

33 mkdir directories – create one or more directories. You can specify them by absolute or relative pathnames. cp cp file1 file2 – copy file1 to file2. If there’s already a file2, the old one will be overwritten. cp file(s) directory – file(s) will be copied to the directory. 33

34 mv sourcefile targetfile – basically mv renames sourcefile to targetfile. If there’s a file with the same name as targetfile, it will be overwritten. mv works for directories in a similar fashion. 34

35 rm file(s) – delete file(s). rmdir directories – delete one or more empty directories. rm –r directories – can be used to delete non empty directories. WARNING!!! This will DELETE EVERYTHING in that directory!!! You can not recover your files after you removed them (unlike Windows OS). 35

36 There are three types of file access supported by UNIX. r – read, view the contents of a file or a directory w –write, edit file/directory contents x –execute, run executable file 36

37 User – the person who created the file. Group – the group owns the file. Other – the rest of the world. “754” is a decimal number. But you can represent each digit with a binary number. 4 => r ead permission, 2 => w rite permission, 1 => e x ecute permission 37

38 rwx r-x r-- 4 +2 +1 7 5 4 4 +0 +14 +0 +0 USER ACCESSGROUP ACCESSOTHER’S ACCESS 38 read=4; write= 2; execute=1, ‘-’ = 0

39 {rwx r-x r--} is a symbolic way to specify file modes, while {754} is a numeric way. 7  111, 5  101, 4  100. How to represent file mode numerically? --x --x –wx How to represent bit string symbolically? 6 1 4 1 1 31 1 3 Change it to binary numbers 39 110 001 100 rw- --x r--

40 chmod mode file(s) – another UNIX command! Change the access mode of one or more files. Examples: chmod 751 my_file – the owner of my_file has rwx(7) permission, the group has r-x(5) permission, others have --x permission. What the following command will do? chmod u=rwx,g=r,o=wr my_file Set Permisson as: Owner to have ‘rwx’ Group to have ‘r’ Other to have ‘rw ‘ Answer: chmod 746 my_file 40

41 Create a new directory in your grove account named public_html by using the following command, $ mkdir public_html Go to this directory $ cd public_html Create a new file named $ cat >index.html -- create a file This is an html file.-- content of the file ^D -- closing the file 41

42 Viewing the content of the file $ cat index.html This is an html file. Adding content of the file $ cat >>index.html Adding second line to the html file. ^D Viewing the content of the file $ cat index.html This is an html file. Adding second line to the html file. 42

43 OR Use pico to create a new file named index.htm Note: Pico is a simple, display-oriented text editor for UNIX. 43

44 After you save the file index.html, change the mode of this file by using the following command, chmod 644 index.html (u=rw-, g=r--, o=r--) Check whether you did it right ls –l or dir (What result should be displayed?) -rwx r-x r-- 1 hans doc 858 Aug 22 22:28 index Unix file types, permissions, number of hard links, owner, group, size, date, filename 44

45 Then go back to parent directory cd.. Change the mode of public_html directory chmod 755 public_html ( What’s the meaning of this command?) Ans: u=rwx, g= r-x, o=r-x Check if you got the mode set right ls –dl public_html 45

46 Some short cuts for the pico editor ^G Get Help ^O WriteOut ^R Read File ^Y Prev Pg ^K Cut Text ^C Cur Pos ^X Exit ^J Justify ^W Where is ^V Next Pg ^U UnCut Text ^T To Spell 46

47 47 http://www.cygwin.com Clear screen: $ ^L For Help:$ help To exit/close:$ exit Help on command:$ command_name --help

48 Listing files and directories Making Directories Changing to a different directory The directories. and.. Pathnames home directories 48

49 Copying Files Moving Files Removing Files and directories Displaying the contents of a file on the screen Searching the contents of a file 49

50 Wildcards Filename Conventions Getting Help 50

51 File system security (access rights) Changing access rights Processes and Jobs Listing suspended and background processes Killing a process 51

52 52


Download ppt "Laboratory: Mechatronics Workshop, Room# E2-2-13.12."

Similar presentations


Ads by Google