File System Overview and Interview Questions About Unix



Similar documents
Linux command line. An introduction to the Linux command line for genomics. Susan Fairley

Linux Overview. Local facilities. Linux commands. The vi (gvim) editor

sftp - secure file transfer program - how to transfer files to and from nrs-labs

Tutorial Guide to the IS Unix Service

OPERATING SYSTEM SERVICES

Linux Labs: mini survival guide

Lab 1 Beginning C Program

Remote Access to Unix Machines

University of Toronto

Computer Systems II. Unix system calls. fork( ) wait( ) exit( ) How To Create New Processes? Creating and Executing Processes

INASP: Effective Network Management Workshops

1 Basic commands. 2 Terminology. CS61B, Fall 2009 Simple UNIX Commands P. N. Hilfinger

CS 103 Lab Linux and Virtual Machines

Tutorial 0A Programming on the command line

Secure Shell. The Protocol

PuTTY/Cygwin Tutorial. By Ben Meister Written for CS 23, Winter 2007

Introduction to UNIX and SFTP

SSH Connections MACs the MAC XTerm application can be used to create an ssh connection, no utility is needed.

TEL2821/IS2150: INTRODUCTION TO SECURITY Lab: Operating Systems and Access Control

Cisco Networking Academy Program Curriculum Scope & Sequence. Fundamentals of UNIX version 2.0 (July, 2002)

MobaXTerm: A good gnome-terminal like tabbed SSH client for Windows / Windows Putty Tabs Alternative

VCL Access. VCL provides access to Linux and Windows 7 Virtual Machines. Users will only see those images that they are authorized to access.

Introduction to Unix Tutorial

Recommended File System Ownership and Privileges

Unix Guide. Logo Reproduction. School of Computing & Information Systems. Colours red and black on white backgroun

Editing Locally and Using SFTP: the FileZilla-Sublime-Terminal Flow

UOG User Guide. Windows

Cloud Server powered by Mac OS X. Getting Started Guide. Cloud Server. powered by Mac OS X. AKJZNAzsqknsxxkjnsjx Getting Started Guide Page 1

Getting the most out of your new Aalto workstation An Aalto IT guide for personnel migrating to the new Aalto workstation environment

CS10110 Introduction to personal computer equipment

CPSC 226 Lab Nine Fall 2015

Installing IBM Websphere Application Server 7 and 8 on OS4 Enterprise Linux

LSN 10 Linux Overview

CS 2112 Lab: Version Control

File Transfer Protocol. What is Anonymous FTP? What is FTP?

Version control. with git and GitHub. Karl Broman. Biostatistics & Medical Informatics, UW Madison

WinSCP PuTTY as an alternative to F-Secure July 11, 2006

CS197U: A Hands on Introduction to Unix

Chapter 8 Objectives. Chapter 8 Operating Systems and Utility Programs. Operating Systems. Operating Systems. Operating Systems.

How To Run Linux On Windows 7 (For A Non-Privileged User) On A Windows 7 Computer (For Non-Patty) On Your Computer (Windows) On An Unix Computer (Unix) On Windows) On The Same

Command Line - Part 1

Introduction to the UNIX Operating System and Open Windows Desktop Environment

RECOVER ( 8 ) Maintenance Procedures RECOVER ( 8 )

CONNECTING TO DEPARTMENT OF COMPUTER SCIENCE SERVERS BOTH FROM ON AND OFF CAMPUS USING TUNNELING, PuTTY, AND VNC Client Utilities

Setting up Radmind For an OSX Public Lab

After studying this lesson, you will have a clear understanding of, what an Operating System is. functions of an Operating System

File Management Where did it go? Teachers College Summer Workshop

UNIX Basics. Ian Darwin TCP Informatics January, Presented from a Mac using Apple s Keynote presentation software

SSH and Basic Commands

XFTP 5 User Guide. The Powerful SFTP/FTP File Transfer Program. NetSarang Computer Inc.

Kernel. What is an Operating System? Systems Software and Application Software. The core of an OS is called kernel, which. Module 9: Operating Systems

Shellshock Security Patch for X86

Lab 1: Introduction to the network lab

CS420: Operating Systems OS Services & System Calls

An Introduction to Using the Command Line Interface (CLI) to Work with Files and Directories

Operating System Software

15 AFS File Sharing. Client/Server Computing. Distributed File Systems

There s a variety of software that can be used, but the approach described here uses freely available Cygwin software: (1) Cygwin/X (2) Cygwin/openssh

SUNY New Paltz Terminal Services Guidebook

Raspberry Pi Setup Tutorial

The System Monitor Handbook. Chris Schlaeger John Tapsell Chris Schlaeger Tobias Koenig

2 Advanced Session... Properties 3 Session profile... wizard. 5 Application... preferences. 3 ASCII / Binary... Transfer

10 steps to better secure your Mac laptop from physical data theft

New Lab Intro to KDE Terminal Konsole

Chapter Contents. Operating System Activities. Operating System Basics. Operating System Activities. Operating System Activities 25/03/2014

HP-UX Essentials and Shell Programming Course Summary

Introduction to Macromedia Dreamweaver MX

Operating Systems. Notice that, before you can run programs that you write in JavaScript, you need to jump through a few hoops first

Connecting to the School of Computing Servers and Transferring Files

CSIL MiniCourses. Introduction To Unix (I) John Lekberg Sean Hogan Cannon Matthews Graham Smith. Updated on:

Week Overview. Running Live Linux Sending from command line scp and sftp utilities

QUIT MACSCHOOL AND DRAG YOUR SERVER ICONS TO THE TRASH OR HIT THE DISCONNECT BUTTON BESIDE THE SERVER ICON IN THE TOP SIDEBAR

MATLAB on EC2 Instructions Guide

A Crash Course on UNIX

CSE331: Introduction to Networks and Security. Lecture 34 Fall 2006

Mac OS X. A Brief Introduction for New Radiance Users. Andrew McNeil & Giulio Antonutto

Unit 10 : An Introduction to Linux OS

User's Manual. Intego Remote Management Console User's Manual Page 1

Original brief explanation

Reflection X Advantage Help. Date

Using Virtual Machines

Computing Service G72. File Transfer Using SCP, SFTP or FTP. many leaflets can be found at:

Introduction to Operating Systems

Using Network Attached Storage with Linux. by Andy Pepperdine

Running your first Linux Program

RETRIEVING NMR DATA JB Stothers NMR Facility Materials Science Addition 0216 Department of Chemistry Western University

Setting Up Dreamweaver for FTP and Site Management

Overview. Remote access and file transfer. SSH clients by platform. Logging in remotely

ARP and DNS. ARP entries are cached by network devices to save time, these cached entries make up a table

Lab Exercise Part II: Git: A distributed version control system

How to Tunnel Remote Desktop using SSH (Cygwin) for Windows XP (SP2)

How Do I Recover infiniti Remotes and Line Cards?

Introductory Note 711 & 811. Remote Access to Computer Science Linux Files Using Secure Shell Protocols

Understanding and Using NetInfo. Includes information on setting up Mac OS X Server and NetInfo to increase the power of your Mac OS X network

Using Keil software with Linux via VirtualBox

Transcription:

Unix (for those who know Windows) dag@ifi.uio.no

What happens? Outline What is Unix? A short history Why should you learn it? The OS structure The file system File protection Unix at Ifi Questions and answers

In the beginning A short history of Unix How Unix was created has influenced it: Unix was created at the AT&T s Bell Labs in 1969. It was designed by programmers to use themselves. At that time computers were small and slow. There were very few of them. The user had no graphic screen and no mouse; they had a slow teletype. In the beginning, AT&T saw no commercial future for Unix.

How do Unix and Windows compare? Unix vs Windows In Windows, the graphical user interface is the basis in Unix, it is a command window (but a GUI has since been added). Windows is Program/Data oriented Unix is file oriented. Windows was designed for One user one computer while Unix was multi-user from the start. Under Windows one uses a few big programs under Unix one uses many small, specialized programs.

How do Unix and Windows compare? For example: I want a nicely formatted sorted list of who use the computer that I am using: dag@diamant ~$ who awk {print $1} sort uniq column -x aasmunds andersmo bjarnej cristi dag eivinah elien endreak ernstgr eskil fredrihl fredrw haakonks hilia jae jimrj juanle larsg larsha mariusno martbo martinwa martiso mshaugla nikolahl oleiul oysteint per siri sivertkh svenar sveniu vegardno viet

How do Unix and Windows compare? Each little program has its specific task: who produces a list of all users logged onto the computer: dag@diamant ~$ who larsha pts/9 2014-08-01 19:16 (c4baf5bc1.dhcp) martiso pts/25 2014-08-16 07:23 (193.71.175.103) : awk picks column 1. sort sorts the names. uniq removed duplicates. column formats the answer in nice columns.

How do Unix and Windows compare? In Windows, uppercase and lowercase letters are most often regarded as identical in Unix, they are always different. Windows uses CR+LF as line separators in text files Unix uses just LF. Conclusion Windows is the dominant OS today, so many programs exist only for Windows. Many exist for both systems, and some only for Unix. My opinion Windows is easier for computer novices Unix is better suited for programmers.

Is Unix alive today? Why has Unix been successful? Free versions have always been available. The source code of these versions has always been open. The basic concepts are very simple. Unix can run on quite small and simple computers. It is very easy to modify or extend it. The Internet was developed on Unix computers.

Does this concern you? Why you should learn about Unix? It is the second most used OS (since Mac OS X and Linux are Unix-es). It is perhaps the most common OS in computer science education and research. Some programs you need in your master project may only be available in Unix. Unix knowledge may be required in your future job.

Keep it simple! Structure of Unix kernel The basic structure of the Unix kernel is very simple: Kernel D D D Mouse Network card Graphics card

Keep it simple! The user processes all lie outside the kernel and communicate through system calls. P P P Kernel D D D Mouse Network card Graphics card

What is a process? Processes A Process is an essential concept in Unix. A process is an executing program (usually written in C but this is not required). Every user has at least one process and can create as many as s/he likes. Each process has a unique number called a PID. The user has complete control over his/her processes and can pause them or kill them at will. The processes communicate with the operating system using system calls.

A program is worth a thousand pictures Examples This little program asks the OS to know its PID: dag@padme Unix$ more pid.c #include <stdio.h> #include <sys/types.h> #include <unistd.h> int main () { printf("this process has PID=%d.\n", getpid()); return 0; } dag@padme Unix$./pid This process has PID=1764. dag@padme Unix$

A program is worth a thousand pictures One more The next program starts a child process (which is a clone of itself) using the fork call. The child asks (using the execl call) to be replaced by the date program. (This is the normal Unix way to start new processes.)

A program is worth a thousand pictures dag@padme Unix$ more run-date.c #include <stdio.h> #include <sys/types.h> #include <unistd.h> int main () { printf("this is the original process with PID=%d.\n", getpid()); if (fork()) { printf("this is still the original process with PID=%d.\n", getpid()); wait(); /* Wait until the child dies. */ } else { printf("this is the child process with PID=%d.\n", getpid()); execl("/local/gnu/bin/date", NULL); } return 0; } dag@padme Unix$./run-date This is the original process with PID=3250. This is the child process with PID=3251. This is still the original process with PID=3250. Sun Aug 22 13:38:29 CEST 2010 dag@padme Unix$

Is it Unix or not? The POSIX standard Unix is really defined by the system calls. Systems that adhere to the Portable Operating System Interface for Unix (POSIX), may be called Unix. There exist dozens of systems today that more or less follow POSIX. The best known is Linux.

A window or two is a good idea The window system The window system X is also a user process. It can communicate across the network: P P Xserver P P xeyes Kernel Kernel D D D D D D Mouse Network card Mouse Network card Graphics card Graphics card

At the outermost level... User interface And, outside the kernel and X, one can build a user interface, not unlike what is encountered in Windows; at Ifi, we use Gnome:

Various useful programs preview will display almost any file on the computer screen. Example: preview myfile print will print most kinds of files. Example: print -booklet -Pnimbus myfile windows will connect to a Windows server. Example: windows &

How do you store a file? File system overview In Unix, all files are placed in one file tree; the root is called /. / bin dev ifi local chmod sh null tty midgard utgard bin man a02 dag Kurs Privat www docs

Where is my file? File notation All files are accessible by going from the root: dag@padme Unix$ ls /ifi/midgard/a02/dag/kurs/inf2100/uke-35 PS2.eps.bb eniac.eps nexta.rask uke-35-4x.pdf uke-35.pdf PS2.eps.gz mips.eps nexta.raskas uke-35.aux uke-35.snm PS2.png mips.jpg nexta.raskas~ uke-35.log uke-35.tex beregnere.eps nexta.list nexta.rask~ uke-35.nav uke-35.tex~ beregnere.jpg nexta.list~ system-3.eps uke-35.out uke-35.toc The command ls ( list files ) shows us which files we have got.

Where is my file? Always starting from the root is long and tedious. ~ goes directly to my personal file sub-tree. dag@padme Unix$ ls ~/Kurs/INF2100/Forelesninger/uke-35 PS2.eps.bb eniac.eps nexta.rask uke-35-4x.pdf uke-35.pdf PS2.eps.gz mips.eps nexta.raskas uke-35.aux uke-35.snm PS2.png mips.jpg nexta.raskas~ uke-35.log uke-35.tex beregnere.eps nexta.list nexta.rask~ uke-35.nav uke-35.tex~ beregnere.jpg nexta.list~ system-3.eps uke-35.out uke-35.toc

Where is my file? I can also access the files belonging to other users: ~name goes directly to name s personal file sub-tree; /hom/name does the same. dag@padme Unix$ ls ~dag2 Desktop RMAIL brev huskeliste mail workspace Ifi-mail RMAIL~ brev-anne inf1000.info pc secret Oblig2 WINDOWS brev~ inf2100 screen.eps.bb tmp dag@padme Unix$ ls /hom/dag2 Desktop RMAIL brev huskeliste mail workspace Ifi-mail RMAIL~ brev-anne inf1000.info pc secret Oblig2 WINDOWS brev~ inf2100 screen.eps.bb tmp

Where is my file? Whenever I give commands in a command window, I am positioned somewhere in the tree and can access files from there. pwd tells me where I am. cd moves me to somewhere else. Note that all folders contain these two files:. is the folder itself... is the parent folder. (Files whose name start with a. are not shown by ls, unless you use the -a option).

Where is my file? dag@padme Unix$ pwd /hom/dag/ifi/master/unix dag@padme Unix$ cd.. dag@padme Master$ pwd /hom/dag/ifi/master dag@padme Master$ ls P9.jpg kort.kurs~ lang.eps lang.mps welcome.aux P9c.jpg kort.log lang.kurs lang.mpx welcome.log Unix kort.mp lang.kurs~ new-master.text welcome.nav kort.eps kort.mps lang.log new-master.text~ welcome.out kort.kurs kort.mpx lang.mp welcome-handout.pdf welcome.pdf dag@padme Master$ ls Unix #unix.tex# hjemme.mps kernel-3.mps kernel.5 run-date Gnome.eps hjemme.mpx kernel-4.eps kernel.log run-date.c Gnome.png hjemme.tre kernel-4.mps kernel.mp run-date.c Makefile hjemme.tre~ kernel-5.eps kernel.mpx standardbruker.eps Makefile~ kernel-1.eps kernel-5.mps kernel.mp~ standardbruker.jpg demo.tre kernel-1.mps kernel.1 mpxerr.tex unix.aux hjemme.eps kernel-2.eps kernel.2 pid unix.log hjemme.log kernel-2.mps kernel.3 pid.c unix.nav hjemme.mp kernel-3.eps kernel.4 pid.c~ unix.out

File protection Protection information The command ls tells us more if we give it the option -l: $ ls -l total 0 -rw------- 1 dag 52 Jan 12 11:34 note -rw------- 1 dag 52 Jan 12 11:46 note-anne -rw------- 1 dag 0 Jan 12 11:13 note~ -rw-r--r-- 1 dag 0 Jan 12 11:13 inf1000.info In this example, only I can read note but everybody can read inf1000.info.

File protection To understand the file protection mechanism in Unix, you must know that Unix recognizes three different categories of users: user ( u ) is the file s owner, i.e., whoever created it. group ( g ) is the group associated with the file. other ( o ) is everybody else.

File protection There are three privileges for files: read ( r ) is the right to read the file. write ( w ) is the right to modify the file. execute ( x ) is the right to execute the file, i.e., to use it as a program.

File protection The privileges are given in groups of 3 3 letters: u g o {}}{ {}}{ {}}{ rwx r-x r-- A letter means that the user has the specified priviledge; a - shows that s/he has not.

File protection If I want to let everybody read note but keep inf1000.info secret, I should write $ chmod go+r note $ chmod go-r inf1000.info The protection is now: $ ls -l total 0 -rw-r--r-- 1 dag 52 Jan 12 11:34 note -rw------- 1 dag 52 Jan 12 11:46 note-anne -rw------- 1 dag 0 Jan 12 11:13 note~ -rw------- 1 dag 0 Jan 12 11:13 inf1000.info

File protection Folder protection This protection mechanism is quite similar to the one for ordinary files, but there are differences: r gives the right to see the names of the files in the folder. w gives the right to create and delete files in the folder. x gives the right to access the files in the folder. Note! To access a file, a user must have access (i.e., x-priviledge) to every folder on the way down (as well as r for the file itself).

How do we do it at Ifi Unix at Ifi Ifi has decided to support both Unix and Windows, 1 with particular emphasis on cross-platform cooperation. User name and password is the same. The user files are available on both systems: Unix All files are directly available; ~/pc/ contains specific Windows files like Desktop and MyDocuments. Windows User files are available in M: (with an icon on the desktop). 1 Mac support is small but growing.

How do we do it at Ifi On any Unix computer at Ifi, the windows command will open a window running on a Windows server. On any Windows computer, the Linux icon will start a remote desktop connection to a Linux server.

Even from your own home Working from home If you have a broadband connection, you can access Ifi s computers from home: Using ssh (f ex Putty from the Ifi start package; see http://www.mn.uio.no/ifi/tjenester/it/hjelp/startpakke/), you can connect to login.ifi.uio.no. Using sftp (f ex WinSCP from the Ifi start package), you can transfer files back and forth. Note This will not give access to X facilities!

Or, you can try this: An alternative way From any modern Windows computer, you can start Start All Programs Accessories Remote desktop connection and connect to windows.ifi.uio.no. From this Windows server, you may connect to a Linux server. From a Mac, XQuartz will connect you. Note These will give you X facilities.

Where can I get help? Learning to use Unix There is a lot of information available: There are hundreds of books about different aspects of Unix; for free books, see http://www.onlineprogrammingbooks.com/linux/. The Ifi laptop help can help you get your portable computer to work properly. See web page IT-tjenester (in Norwegian) in http://www.mn.uio.no/ifi/tjenester/it/. Web page IT services (in English) in http://www.uio.no/english/services/it/. All Unix commands are documented; try man print.

Where can I get help? Assistance If you need help with a Unix (or Windows) problem, you can ask your supervisor send an e-mail til ifidrift@ifi.uio.no visit the IT support group (4th floor of the Ole-Johan Dahl building)

Perhaps I can help you? Any questions?