Title Slide CSS 404/504 The UNIX Operating System (2) By Ralph B. Bisland, Jr.

Slides:



Advertisements
Similar presentations
Utilizing the GDB debugger to analyze programs Background and application.
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.
NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
CS 497C – Introduction to UNIX Lecture 22: - The Shell Chin-Chih Chang
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.
File Security. Viewing Permissions ls –l Permission Values.
Linux+ Guide to Linux Certification, Second Edition
Linux+ Guide to Linux Certification, Second Edition
UNIX Chapter 00 A “ Quick Start ” into UNIX Operating System Mr. Mohammad Smirat.
T UTORIAL OF U NIX C OMMAND & SHELL SCRIPT S 5027 Professor: Dr. Shu-Ching Chen TA: Samira Pouyanfar Spring 2015.
Lecture 02CS311 – Operating Systems 1 1 CS311 – Lecture 02 Outline UNIX/Linux features – Redirection – pipes – Terminating a command – Running program.
UNIX By Darcy Tatlock. 1. Successful Log Into Unix To actively manipulate your website you need to be logged in. Without being logged in you cannot enter.
1 Some basic Unix commands u Understand the concept of loggin into and out of a Unix shell u Interact with the system in a basic way through keyboard and.
Linux Commands LINUX COMMANDS.
Chapter 4: UNIX File Processing Input and Output.
BILKENT UNIVERSITY DEPARTMENT OF COMPUTER TECHNOLOGY AND INFORMATION SYSTEMS CTIS156 INFORMATION TECHNOLOGIES II CHAPTER 10: ADVANCED FILE PROCESSING.
COMP1070/2002/lec4/H.Melikian COMP1070 Lecture #5  Files and directories in UNIX  Various types of files  File attributes  Notion of pathname  Commands.
Filesystem Hierarchy Standard (FHS) –Standard of outlining the location of set files and directories on a Linux system –Gives Linux software developers.
Va-scanCopyright 2002, Marchany Unit 6 – Solaris File Security Randy Marchany VA Tech Computing Center.
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.
CHAPTER 1 UNIX FOR NONPROGRAMMERS By U ğ ur Halıcı.
Linux environment ● Graphical interface – X-window + window manager ● Text interface – terminal + shell.
3 File Processing Mauro Jaskelioff. Introduction More UNIX commands for handling files Regular Expressions and Searching files Redirection and pipes Bash.
Agenda User Profile File (.profile) –Keyword Shell Variables Linux (Unix) filters –Purpose –Commands: grep, sort, awk cut, tr, wc, spell.
File Processing. Introduction More UNIX commands for handling files Regular Expressions and Searching files Redirection and pipes Bash facilities.
Unix Basics Chapter 4.
– Introduction to the Shell 10/1/2015 Introduction to the Shell – Session Introduction to the Shell – Session 2 · Permissions · Users.
LIN Unix Lecture 3 Hana Filip. LIN UNIX Resources UNIX Tutorials UNIX help for.
Agenda Chapter 1: Linux (Unix) Features Commands (Chapters 2 & 3) Command Structure / Command line editing man, passwd, cal, date, whereis, which Working.
Linux+ Guide to Linux Certification, Second Edition
Introduction to Unix – CS 21 Lecture 9. Lecture Overview Shell description Shell choices History Aliases Topic review.
System Administration Introduction to Unix Session 2 – Fri 02 Nov 2007 Reference:  chapter 1, The Unix Programming Environment, Kernighan & Pike, ISBN.
Chapter Five Advanced File Processing. 2 Objectives Use the pipe operator to redirect the output of one command to another command Use the grep command.
Lesson 9-Setting and Using Permissions. Overview Describing file permissions. Using execute permissions with a file. Changing file permissions using mnemonics.
Agenda Regular Expressions (Appendix A in Text) –Definition / Purpose –Commands that Use Regular Expressions –Using Regular Expressions –Using the Replacement.
Lesson 2-Touring Essential Programs. Overview Development of UNIX and Linux. Commands to execute utilities. Communicating instructions to the shell. Navigating.
File Security and Permissions. File Permissions (1) u With respect to a particular file, Unix divides the set of all users on a system into three categories:
Log-in to the Unix Server A successful log-in allows access to the server through the Secure Shell. SSH, also known as Secure Shocket Shell, is a Unix.
Chapter Five Advanced File Processing. 2 Lesson A Selecting, Manipulating, and Formatting Information.
Chapter 4: File Security & Permissions Also: Hard and Soft Links, see p77-80 &
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Third Edition
Introduction to Programming Using C An Introduction to Operating Systems.
Week 9 - Nov 7, Week 9 Agenda I/O redirection I/O redirection pipe pipe tee tee.
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
Linux Commands C151 Multi-User Operating Systems.
2 Manual & Filestore Mauro Jaskelioff. Introduction Using the manual The UNIX filestore File permissions.
1 Lecture 2 Working with Files and Directories COP 3353 Introduction to UNIX.
Linux+ Guide to Linux Certification, Second Edition Chapter 4 Exploring Linux Filesystems.
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.
A Brief Overview of Unix Brandon Bohrer. Topics What is Unix? – Quick introduction Documentation – Where to get it, how to use it Text Editors – Know.
Agenda The Linux File System (chapter 4 in text) Setting Access Permissions Directory vs File Permissions chmod Utility Symbolic Method Absolute Method.
File Processing. Introduction More UNIX commands for handling files Regular Expressions and Searching files Redirection and pipes Bash facilities.
Linux Administration Working with the BASH Shell.
Login Being logged into a command line prompt allows a user to easily and simply execute multiple commands (one-by-one or at the same time) that would.
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.
Tutorial of Unix Command & shell scriptS 5027
Lesson 5-Exploring Utilities
C151 Multi-User Operating Systems
CS314 – Section 5 Recitation 1
INTRODUCTION TO UNIX: The Shell Command Interface
Tutorial of Unix Command & shell scriptS 5027
Basic UNIX OLC Training.
Introduction to UNIX.
Tutorial of Unix Command & shell scriptS 5027
Using Linux Commands Lab 3.
Web Programming Essentials:
Tutorial of Unix Command & shell scriptS 5027
Agenda The Linux File System (chapter 4 in text)
Linux Commands LINUX COMMANDS.
Presentation transcript:

Title Slide CSS 404/504 The UNIX Operating System (2) By Ralph B. Bisland, Jr.

2Internet Concepts Copyright Ralph Bisland 2004 File Permissions The creator of a file/directory controls what other users can do with the file/directory. There are three types of permissions: –Read permission ( r) - User can "read" (or access) your file –Write permission (w) - User can "write" (or change) your file –Execute permission (x) - User can "execute" (for programs only) your file Note: There are both file and directory permissions.

3Internet Concepts Copyright Ralph Bisland 2004 Categories Of Users There are three categories of users that can access your files: –Other (o) - all system users –Group (g) - All users within your group –User (u) - You only The default file permissions are for all three groups to have all three permissions To display the permissions of a file, use the ls -l (list long) command.

4Internet Concepts Copyright Ralph Bisland 2004 Setting File Permissions If you do not set your file/directory permissions correctly, others will not be able to access your web pages. There are two methods of setting permissions on a file: –Unmask: (umask) There is a system default (all permissions to all users) for file permissions that you may adjust. –Change mode: (chmod) Used to change the mode for individual files

5Internet Concepts Copyright Ralph Bisland 2004 File Permission Settings  File permissions are generally specified using a binary digits as on/off switches:  Binary 0 = off, binary 1 = on  First binary digit = Read permission  Second binary digit = Write permission  Third binary = Execute permission

6Internet Concepts Copyright Ralph Bisland 2004 Using Octal Digits Use an octal digit to indicate the privilege for each category: Bin Oct Permission = 0 = No permission 001 = 1 = Execute permission only 010 = 2 = Write permission only 011 = 3 = Write and execute permissions only 100 = 4 = Read permission only 101 = 5 = Read and execute permissions only 110 = 6 = Read and write permissions only 111 = 7 = Read, write, and execute permissions File permissions are generally specified with three digits: owner, group, world

7Internet Concepts Copyright Ralph Bisland 2004 Using umask The system default for permissions is 777 (all permissions to all categories) This can be altered (and is) via the unmask (umask) command orca% umask 077 This command unmasks or turns off the default permissions for group and world.

8Internet Concepts Copyright Ralph Bisland 2004 Using umask (ctd) Text editors create files with permissions = 600 This can be altered with the umask command orca% umask 333 orca% umask 222 The umask command affects all files created when the mask is in effect. Any editing changes to the file do not affect the permissions. To see the current umask, enter umask without any parameters. orca% umask

9Internet Concepts Copyright Ralph Bisland 2004 Changing Permissions On A File Once a file has been created, permissions can be altered with the change mode (chmod) command: Format: chmod permission-mask file-name(s) Remember this command turns on permissions, it does not turn them off like umask. Example: orca% chmod 644 my-file.dat

10Internet Concepts Copyright Ralph Bisland 2004 Changing File Permissions (ctd) Another way to specify permissions: Specify which privilege ( rwx ) you wish to add or delete with a + or - orca% chmod +w my-file.dat orca% chmod -x+r my-file.dat Can even alter permissions to a file by preceding privilege with u, g, or o. orca% chmod o+r my-file.dat

11Internet Concepts Copyright Ralph Bisland 2004 Accessing Files From Other Users If a file exists in another user’s account and you wish to access it, you can copy it to your directory. This is only allowed if the user gives you the directory and file privileges of accessing it. Assume that the other user's account is abc and the subdirectory is xyz and you wish to copy the file called foo.dat into your directory. orca% cp ~abc/xyz/foo.dat bar.dat orca% cp ~abc/xyz/foo.dat.

12Internet Concepts Copyright Ralph Bisland 2004 Online Help Most UNIX commands have on-line help. To get to the help, use the manual (as in reference manual) command (man) followed by the command name you wish help on. Example: orca% man ls

13Internet Concepts Copyright Ralph Bisland 2004 Searching Files Text files can be searched for strings. To search a file for a string use the global regular expression print command Commonly known as grep Format: grep [parameter(s)] string filename Example: orca% grep ralph my-file.dat Each line containing the string "ralph" is displayed

14Internet Concepts Copyright Ralph Bisland 2004 Searching Files (ctd) If the string contains a blank, the string must be enclosed in double quotes. orca grep "ralph bisland" my-file.dat Parameters: –i = Ignore case –v = display lines that do not match the string

15Internet Concepts Copyright Ralph Bisland 2004 Piping Pipe: A connection between two processes that passes the output of the first process as input to the second process. Very useful feature. The symbol used for piping is the vertical bar (|). Format: | Example: orca% ls | more

16Internet Concepts Copyright Ralph Bisland 2004 Redirecting Input & Output Redirection: A shell construct for causing a program to take its standard input from a specified file or to send its standard output to a specified file. The symbols used for redirecting are >, >> and < Use the < symbol to redirect input files (use the file specified as input to the process)

17Internet Concepts Copyright Ralph Bisland 2004 Redirecting Input & Output Format: process < filename orca% cat < my-file.dat Use the > symbol to direct the output of a process into a file Format: process > filename orca% ls -l > outfile.dat The >> symbol appends the output on to a currently existing file.

18Internet Concepts Copyright Ralph Bisland 2004 Searching For A File The locate command helps you find where a file is located. Format: locate string where string is a subset of a file name Warning: This command searches the entire computer for the file string. This may lead to lots of output.

19Internet Concepts Copyright Ralph Bisland 2004 Examples orca% locate rbb /orca/faculty/bisland/public_html/rbb.save /orca/faculty/jrodgers/public_html/rbb.cgi /orca/faculty/jrodgers/public_html/rbb.dat You may want to consider piping the output to the grep utility orca% locate rbb | grep bisland

20Internet Concepts Copyright Ralph Bisland 2004 Spelling Of A Word UNIX has a file containing approximately 45,000 words stored in its spelling dictionary. orca% wc /usr/dict/linux.words /usr/dict/linux.words You may search this dictionary for the spelling of words. To search the dictionary use the look command. Format: look string orca% look pneu

21Internet Concepts Copyright Ralph Bisland 2004 Who Is Currently Using The System To find out the login names of the users currently using the system, use the who command. Format: who orca% who

22Internet Concepts Copyright Ralph Bisland 2004 Aliasing Any command can be aliased by using the alias command. Use aliasing to make commands shorter or easier to remember for you. Format: alias = Note: The = is used in the Korn shell only. Examples: $ alias q=logout $ alias lo=logout $ alias lls='ls -al' Note the use of quotes if there are embedded spaces in the alias string

23Internet Concepts Copyright Ralph Bisland 2004 Nifty Neat UNIX Utilities Calendar cal Ex. cal cal Ex. cal 1995 Leave leave Ex: leave leave Ex: leave 1030 leave Ex: leave +30 Calculator bc Ex: bc {then enter expressions } Note: all calculations are done in integer

24Internet Concepts Copyright Ralph Bisland 2004 More Nifty Neat UNIX Utilities Who Am I? orca% whoami Hostname: o rca% hostname Disk quota: orca% quota Date: orca% date Random Sayings: orca% fortune orca % fortune –o