What is Unix? A multi-user networked operating system –“Operating System” Handles files, running other programs, input/output Just like DOS or Windows.

Slides:



Advertisements
Similar presentations
Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
Advertisements

Jump to first page Unix Commands Monica Stoica Jump to first page Introduction to Unix n Unix was born in 1969 at Bell Laboratories, a research subdivision.
Working with Files How to create, view, copy, rename and print files.
Cosc 4750 Getting Started in UNIX Don’t be afraid of the prompt, in linux it can be your best friend. In some cases, the only way to do certain things.
Introducing the Command Line CMSC 121 Introduction to UNIX Much of the material in these slides was taken from Dan Hood’s CMSC 121 Lecture Notes.
There are 4 Unix servers, fiji, sumatra, tahiti and ceylon Remote Access: telnet (bad!!!) ssh (Teraterm/putty) \\ \ (eg. \\fiji\awong) XDMCP “XWindows.
Linux+ Guide to Linux Certification, Second Edition
IWS (Instructional Work Servers) There are 4 instructional Unix servers: –ceylon, fiji, sumatra, and tahiti Accessing the servers: –Terminal Programs:
CS1020: Intro Workshop. Topics CS1020Intro Workshop Login to UNIX operating system 2. …………………………………… 3. …………………………………… 4. …………………………………… 5. ……………………………………
Unix Basics. Systems Programming: Unix Basics 2 Unix Basics  Unix directories  Important Unix file commands  File and Directory Access Rights through.
What is Unix? A multi-user networked operating system –“Operating System” Handles files, running other programs, input/output Looks like DOS…but more powerful.
A Mini UNIX Tutorial. What’s UNIX?  An operating system run on many servers/workstations  Invented by AT&T Bell Labs in late 60’s  Currently there.
L INUX C OMMAND L INE I NTERFACE G UNAANBAN.G
Systems Programming Concepts
Overview of Linux CS3530 Spring 2014 Dr. José M. Garrido Department of Computer Science.
Help session: Unix basics Keith 9/9/2011. Login in Unix lab  User name: ug0xx Password: ece321 (initial)  The password will not be displayed on the.
Unix Primer. Unix Shell The shell is a command programming language that provides an interface to the UNIX operating system. The shell is a “regular”
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
Chapter 9 Part II Linux Command Line Access to Linux Authenticated login using a Linux account is required to access a Linux system. The Linux prompt will.
Working with Files Chapter 5. Display a Calendar Display a calendar for a specific month – cal Display a calendar for a specific year – cal 2000.
Introduction to Unix Bent Thomsen Institut for Datalogi Aalborg Universitet.
Linux environment ● Graphical interface – X-window + window manager ● Text interface – terminal + shell.
Introduction to Unix Bent Thomsen Institut for Datalogi Aalborg Universitet.
Unix Basics Chapter 4.
Basic unix commands that everyone should know (Even if you have a mac) Slightly more advanced:
Linux+ Guide to Linux Certification, Second Edition
AN INTRO TO UNIX/LINUX COMMANDS BY: JIAYANG WANG.
Carnegie Mellon Linux Boot Camp Jenna MacCarley, Peter Pearson, Shashank Goyal 9/19/2015.
PROGRAMMING PROJECT POLICIES AND UNIX INTRO Sal LaMarca CSCI 1302, Fall 2009.
1 Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux Commands Reading None.
BIF713 Basic Unix/Linux Commands Getting Help with Commands.
Basic Unix Commands CGS 3460, Lecture 6 Jan 23, 2006 Zhen Yang.
Unix and Samba By: IC Labs (Raj Kidambi). What is Unix?  Unix stands for UNiplexed Information and Computing System. (It was originally spelled "Unics.")
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: whereis, which, whoami, finger, passwd, cal, date Working with Files: cat, more, less.
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Third Edition
Introduction to Programming Using C An Introduction to Operating Systems.
Λειτουργικά Συστήματα – Lab2 Γιάννης Πετράκης. Directory Navigation and Control  The Unix file system is set up like a tree branching out from the root.
1 Lecture 2 Working with Files and Directories COP 3353 Introduction to UNIX.
1 Day 2 Logging in, Passwords, Man, talk, write. 2 Logging in Unix is a multi user system –Many people can be using it at the same time. –Connections.
Unix Servers Used in This Class  Two Unix servers set up in CS department will be used for some programming projects  Machine name: eustis.eecs.ucf.edu.
AN INTRO TO UNIX/LINUX COMMANDS BY: JIAYANG WANG.
UNIX filesystem CS 2204 Class meeting 2 *Notes by Doug Bowman and other members of the CS faculty at Virginia Tech. Copyright
Linux A practical introduction. 1)Background and Getting Started Linux is an operating system with multiple providers Red Hat/CentOS (our version) Ubuntu.
1 Introduction to Unix. 2 What is UNIX?  UNIX is an Operating System (OS).  An operating system is a control program that helps the user communicate.
The Kernel At a high level, the kernel in an operating system serves as the bridge between applications and the actual data processing of the hardware.
 Last lesson, the Windows Operating System was discussed along with the Windows command shell  Unix is a computer operating system, that similarly manages.
1 CS3695 – Network Vulnerability Assessment & Risk Mitigation – Introduction to Unix & Linux.
A Mini UNIX Tutorial. What’s UNIX?  An operating system run on many servers/workstations  Invented by AT&T Bell Labs in late 60’s  There are many different.
What is Unix? A multi-user networked operating system –“Operating System” Handles files, running other programs, input/output Just like DOS or Windows.
Learning basic Unix command It 325 operating system.
Linux Tutorial Lesson Two *Getting Help in Linux *Data movement and manipulation *Relative and Absolute path *Processes Note: see chapter 1,2,3 from Linux.
CMSC 104, Version 8/061L03OperatingSystems.ppt Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux.
CS 120 Extra: The CS1 Server Tarik Booker CS 120.
UNIX Basics Matt Hayward October 18, 2016 LS560 – Information Technology for information professionals.
UNIX To do work for the class, you will be using the Unix operating system. Once connected to the system, you will be presented with a login screen. Once.
CS1010: Intro Workshop.
Commands Basic syntax of shell commands UNIX or shell commands have a basic structure command -options target command comes first (such as cd or ls) any.
UNIX The Basics Source:
Andy Wang Object Oriented Programming in C++ COP 3330
The Command Prompt Commands are the way to “do things” in Unix
Part 3 – Remote Connection, File Transfer, Remote Environments
IWS (Instructional Work Servers)
Operating Systems and Using Linux
IWS (Instructional Work Servers)
Web Programming Essentials:
Introduction Paul Flynn
UNIX/LINUX Commands Using BASH Copyright © 2017 – Curt Hill.
What is Unix? A multi-user networked operating system
Presentation transcript:

What is Unix? A multi-user networked operating system –“Operating System” Handles files, running other programs, input/output Just like DOS or Windows –“Networked” Designed for server use Networking is an intrinsic part of the system –“Multi-user” Every user has different settings and permissions Multiple users can be logged in simultaneously Tons of fun!!! This tutorial provided by UW ACM Questions to

IWS (Instructional Work Servers) There are 4 instructional Unix servers: –attu1, attu2, attu3 and attu4. –They can be accessed through attu.cs Accessing the servers: –Terminal Programs: telnet (insecure; cannot be used) ssh (via the TeraTerm, Putty, or official SSH programs) –Start -> Program Files -> Unix Connectivity -> Ssh -> SSH-x attu –File Transfer Programs ftp (insercure; cannot be used at UW) O:\unix\iws\ Secure file transfer (from C&C) software/uwick/contents.html

Logging In Which server you use (almost) doesn’t matter – all four allows access to your files Although your Windows and Unix usernames (and passwords) are the same, they are two separate accounts –Your z: drive is not your Unix account Connecting: –We’ll connect to the Unix machines via ssh –After connection, you are presented with a login prompt –After logging in, you’re placed in your home directory (where your personal files are located)

The Command Prompt Commands are the way to “do things” in Unix A command consists of a command name and options called “flags” Commands are typed at the command prompt In Unix, everything (including commands) is case-sensitive [prompt]$ attu1:/u15/awong$ ls –l -a unix-tutorial Command Prompt Command (Optional) flags (Optional) arguments Note: In Unix, you’re expected to know what you’re doing. Many commands will print a message only if something went wrong.

Two Basic Commands The most useful commands you’ll ever learn: –man (short for “manual”) –info They help you find information about other commands –man or info retrieves detailed information about –man –k searches the man page summaries (faster, and will probably give better results) –man –K searches the full text of the man pages fiji:/u15/awong$ man –k password passwd(5) - password file xlock(1) - Locks the local X display until a password is entered fiji:/u15/awong$ passwd

Two Basic Commands (info) Info, as opposed to man, is category based Documents are hyperlinked –info retrieves detailed information about –info by itself will give instructions on its usage –Type q to quit. –Type h for help.

Directories In Unix, files are grouped together in other files called directories, which are analogous to folders in Windows Directory paths are separated by a forward slash: / –Example: /u10/hctang/classes/cse326 The hierarchical structure of directories (the directory tree) begins at a special directory called the root, or / –Absolute paths start at / Example: /u10/hctang/classes/cse326 –Relative paths start in the current directory Example: classes/cse326 (if you’re currently in /u10/hctang ) Your home directory is where your personal files are located, and where you start when you log in. –Example: /u10/hctang

Directories (cont’d) Handy directories to know ~ Your home directory.. The parent directory. The current directory ls –LiSts the contents of the specified directories (or the current directory if no files are specified) –Syntax: ls [ … ] –Example: ls backups pwd –Print Working Directory

Directories (cont’d further) cd –Change Directory (or your home directory if unspecified) –Syntax: cd –Examples: cd backups/unix-tutorial cd../class-notes mkdir –MaKe DIRectory –Syntax: mkdir –Example: mkdir backups class-notes rmdir –ReMove DIRectory, which must be empty –Syntax: rmdir –Example: rmdir backups class-notes

Files Unlike Windows, in Unix file types (e.g. “executable files, ” “data files,” “text files”) are not determined by file extension (e.g. “foo.exe”, “foo.dat”, “foo.txt”) Thus, the file-manipulation commands are few and simple … Many commands only use 2 letters rm –ReMoves a file, without a possibility of “undelete!” –Syntax: rm [options] –Example: rm tutorial.txt backups/old.txt –-r option: recursive (delete directories) –-f option: force. Do no matter what

Files (cont’d) cp –CoPies a file, preserving the original –Syntax: cp [options] –Example: cp tutorial.txt tutorial.txt.bak –-r option: recursive (copies directories) mv –MoVes (renames) a file or directory, destroying the original –Syntax: mv [options] –Examples: mv tutorial.txt tutorial.txt.bak mv tutorial.txt tutorial-slides.ppt backups/ Note: Both of these commands will over-write existing files without warning you!

Permissions for files Files are owned by both a user and a group You will either belong to ugrad_cs or ugrad_ce Each file has 3 sets of permissions –Permissions for the user who owns it (user permissions) –Permissions for the group that owns it (group permissions) –Permissions for everyone else (‘other’ or ‘world’ permissions) There are 3 types of permissions –Read -- controls ability to read a file –Write -- controls ability to write or change a file –Executable -- controls whether or not a file can be executed as a program

To see the permissions on a file, do a ‘ ls –l ’ attu4:/u15/awong$ ls –l -r--r--r-- 1 awong ugrad_ce Apr rgb.txt -rw-r--r-- 1 awong ugrad_ce Apr 5 02:57 set10.csv drwxr-xr-- 1 awong ugrad_ce 1024 Jan 19 19:39 tests Permissions for files (example) Changing Permissions chmod [ugo]+[rxw] e.g. chmod u+w rgb.txt  gives me permission to change rgb.txt Changing Ownership chown. e.g. chmod awong.iuns rgb.txt  iuns group now owns rgb.txt Note: You cannot change which user owns file, unless you are an administrator, for security reasons.

Permissions on directories Directories can also be thought of as a file that lists all the files it contains. They also belong to a user and a group They have the same 3 sets of permissions For directories, this is what the permissions mean –Read -- You can read the list of files (eg. You can use “ls” and get the directory contents) –Write -- You can change the list of files (eg. You can add or remove files from the directory) –Executable -- You can use the directory list to let the operating system “find” the file. This means, you have access to the file. All directories generally have execute permission.

Permissions Quiz Given the following output for ‘ ls –la ~ ’ for user awong.ugrad_ce attu4:/u15/awong$ ls –la ~ drwxr----x 1 awong ugrad_ce 1024 Jan 19 19:39. drwxr-xr-x 1 root root Apr rw-r--r-- 1 awong ugrad_ce Apr 5 02:57 readme.txt -rw-rwxr-x 1 awong ugrad_ce Apr 5 02:57 myprog For users ethel.ugrad_ce, and awong.ugrad_ce: Who can create files in this directory? Who can get the list of files in this directory? Who can read the contents of the files readme.txt? How about myprog? Who can run the program “myprog”? What is dangerous about the permissions on myprog? Especially the ‘.’ directory had g+w access? Can you think of a reason why you would give someone execute, but not read permissions on a directory? How read but not execute?

Shell Shortcuts Tab completion –Type part of a file/directory name, hit, and the shell will finish as much of the name as it can –Works if you’re running tcsh or bash Command history –Don’t re-type previous commands – use the up-arrow to access them Wildcards –Special character(s) which can be expanded to match other file/directory names * Zero or more characters ? Zero or one character –Examples: ls *.txt rm may-?-notes.txt

Editing Text Which text editor is “the best” is a holy war. Pick one and get comfortable with it. Three text editors you should be aware of: –pico – Comes with pine ( Dante ’s program) To quit: Ctrl-q –emacs/xemacs – A heavily-featured editor commonly used in programming To quit: Ctrl-x Ctrl-c –vim/vi – Another editor, also used in programming To quit: : q (or QQ -- capitals matter) Knowing the basics of emacs and vim will help with the rest of Unix; many programs have similar key sequences.

Printing READ THE MORE UPDATED PRINTING TUTORIAL: – Printing: lpr : print Use –h (no header) and –Zduplex (double-sided) to save paper –lpq : check the print queue (including Windows print jobs!) –lprm : remove print jobs (including Windows print jobs) –For the above commands, you will need to specify the printer with the option: –P Check out enscript (quizlet: how do you find information about commands?) to print text files nicely! –WARNING: Do NOT use enscript with postscript files!

Programs and Compilation (C++) To compile a program: –g++ –Recommended: g++ -Wall –ansi –o *.cpp -Wall – Warnings: ALL -ansi – Strict ANSI compliance Quizlet: what does *.cpp mean? What’s an “executable”? –In Windows, double-clicking on an icon runs a program E.g. double-click on C:\Windows\notepad.exe –In Unix, you can run your executable from the command line! Type the executable name at the prompt, just like a command –In fact, commands are actually executables However, you may need to specify the path to your executables –./ runs in the current directory Example: attu4:ehsu% g++ -Wall –ansi –o hello hello.cpp attu4:ehsu%./hello

Programs and Compilation (Java) To compile a program: –javac fileName1.java filename2.java... –Errors will be printed to the screen with their line numbers –Remember that the class name must have the same capitalization as the file name –To compile all the.java files in the current folder: javac *.java To run : –java classname (remember, no.java or.class) –This will run the main method for that class.

X-Windows X-Windows is the most common graphical interface for Unix It allows graphics to be sent over the network (Windows Remote Desktop is similar to this) If you login via the ssh-x shortcuts, you will start and “X-server” on your machine and you will be able to get graphics from your unix commands If you log into a linux box, you will automatically have X-windows setup in that login.

Linux Machines, iuns Linux Machines: There are 6 linux machines in each lab The graphics work smoother on those machines Be sure to get a good “Window Manager” setup Ask one of the other people using the linux boxes for help setting up your window manager. Iuns: Iuns is the “instruction unsupported” software group Student volunteers maintain cutting edge software for unix and windows for more