Review of Fundamentals (cont’d) Todd Kelley CST8207 – Todd Kelley1.

Slides:



Advertisements
Similar presentations
CIS 240 Introduction to UNIX Instructor: Sue Sampson.
Advertisements

MORE FILE ATTRIBUTES. ls –l to display file attributes (properties) Listing of a specific directory Ownership and group ownership Different file permissions.
The Unix File System. What are the three parts of every file on a Unix filesystem? And where is each stored? Filename - stored in directories Inode -
Inodes. Filesystems Each partition has a filesystem –This filesystem will usually support a directory hierarchy Every file on a disk partition is allocated.
CS Lecture 03 Outline Sed and awk from previous lecture Writing simple bash script Assignment 1 discussion 1CS 311 Operating SystemsLecture 03.
File Security. Viewing Permissions ls –l Permission Values.
Linux+ Guide to Linux Certification, Second Edition
6/24/2015B.RamamurthyPage 1 File System B. Ramamurthy.
More Shell Basics CS465 - Unix. Unix shells User’s default shell - specified in /etc/passwd file To show which shell you are currently using: $ echo $SHELL.
Linux Linux File System.
UNIX Files and Security Software Tools. Slide 2 File Systems l What is a file system? A means of organizing information on the computer. A file system.
7/15/2015B.RamamurthyPage 1 File System B. Ramamurthy.
Getting Started with Linux Linux System Administration Permissions.
Introduction to Linux and Shell Scripting Jacob Chan.
Filesystem Hierarchy Standard (FHS) –Standard of outlining the location of set files and directories on a Linux system –Gives Linux software developers.
UNIX command line. In this module you will learn: What is the computer shell What is the command line interface (or Terminal) What is the filesystem tree.
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
Files & Directories Objectives –to be able to describe and use the Unix file system model and concepts Contents –directory structure –file system concepts.
1 Lecture 2 Working with Files and Directories COP 3344 Introduction to UNIX.
More Scripting Techniques Scripting Process Example Script
1 Operating Systems Lecture 3 Shell Scripts. 2 Shell Programming 1.Shell scripts must be marked as executable: chmod a+x myScript 2. Use # to start a.
Writing Shell Scripts ─ part 1 CSE 2031 Fall September 2015.
1 Operating Systems Lecture 3 Shell Scripts. 2 Brief review of unix1.txt n Glob Construct (metacharacters) and other special characters F ?, *, [] F Ex.
8 Shell Programming Mauro Jaskelioff. Introduction Environment variables –How to use and assign them –Your PATH variable Introduction to shell programming.
An Introduction to Unix Shell Scripting
The UNIX Shell. The Shell Program that constantly runs at terminal after a user has logged in. Prompts the user and waits for user input. Interprets command.
Shell Scripting Todd Kelley CST8207 – Todd Kelley1.
Linux+ Guide to Linux Certification, Second Edition
CST8177 bash Scripting Chapters 13 and 14 in Quigley's "UNIX Shells by Example"
More Scripting Todd Kelley CST8207 – Todd Kelley1.
Linux Operations and Administration
Keyword Shell Variables The shell sets keyword shell variables. You can use (and change) them. HOME The path to your home directory PATH Directories where.
Shell Programming Any command or a sequence of UNIX commands stored in a text file is called a shell program. It is common to call this file a command.
Lesson 9-Setting and Using Permissions. Overview Describing file permissions. Using execute permissions with a file. Changing file permissions using mnemonics.
1 Operating Systems Lecture 2 UNIX and Shell Scripts.
Unix/Linux cs3353. The Shell The shell is a program that acts as the interface between the user and the kernel. –The shell is fully programmable and will.
Managing Files. Module 5 Managing Files ♦ Introduction “On a Linux system, everything is a file; if something is not a file, it is a process.” ♦ Topics.
Linux file system "On a UNIX system, everything is a file; if something is not a file, it is a process." Sorts of files (on a Linux system) Directories:
Chapter 10: BASH Shell Scripting Fun with fi. In this chapter … Control structures File descriptors Variables.
Shell Advanced Features. Module 8 Shell Advanced Features ♦ Introduction In Linux systems, the shells are often referred to as command line interfaces.
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Third Edition
PacNOG 6: Nadi, Fiji UNIX ™/ /Linux Permissions Hervey Allen Network Startup Resource Center.
©Colin Jamison 2004 Shell scripting in Linux Colin Jamison.
CIT 140: Introduction to ITSlide #1 CIT 140: Introduction to IT Shell Programming.
User Environments Objectives –to provide appropriate environments for different types of users Contents –different login programs –user profiles –restricted.
Privileges: who can control what Introduction to Unix May 24, 2008 Rabat, Morocco Hervey Allen.
Managing Files CSCI N321 – System and Network Administration Copyright © 2000, 2007 by the Trustees of Indiana University except as noted.
Λειτουργικά Συστήματα – Lab2 Γιάννης Πετράκης. Directory Navigation and Control  The Unix file system is set up like a tree branching out from the root.
1 Day 18 Bash and the.files. 2 The.files ls shows you the files in your directory –Or at least most of them. –Some files are hidden. Try: ls –a –This.
Compunet Corporation Introduction to Unix (CA263) Your Environment By Tariq Ibn Aziz Dammam Community College.
1 Lecture 2 Working with Files and Directories COP 3353 Introduction to UNIX.
Agenda The Bourne Shell – Part II Special Characters Ambiguous File Reference Variable Names and Values User Created Variables Read-only Variables (Positional.
Flow Control. The order in which commands execute in a shell script is called the flow of the script. When you change the commands that execute based.
UNIX filesystem CS 2204 Class meeting 2 *Notes by Doug Bowman and other members of the CS faculty at Virginia Tech. Copyright
Lecture 02 File and File system. Topics Describe the layout of a Linux file system Display and set paths Describe the most important files, including.
Regular Expressions Todd Kelley CST8207 – Todd Kelley1.
Various 2. readonly readonly x=4 x=44 #this will give an error (like what in java?)
Introduction to UNIX (part 2) CSE 2031 Fall March 2016.
Linux Filesystem Management
CS306 Lab Workout 2 Fall 2017.
LINUX FOR BEGINNERS Because everyone needs Fundamentals
System Programming and administration CS 308
CIRC Summer School 2017 Baowei Liu
Stop Using ./ as in ./scriptname
LINUX FOR BEGINNERS Because everyone needs Fundamentals
Agenda Control Flow Statements Purpose test statement
File System B. Ramamurthy B.Ramamurthy 11/27/2018.
Module 4 Command Line Skills
Module 6 Working with Files and Directories
Presentation transcript:

Review of Fundamentals (cont’d) Todd Kelley CST8207 – Todd Kelley1

 change your password on CLS if you haven’t already  the filesystem  access permissions  symbolic links  hard links 2

 Variables for general use (variables that are not environment variables) have lower case names  Environment variables are indicated by their UPPER CASE names: SHELL, VISUAL, etc  It's usually best to put variable expansions inside double quotes, to protect any special characters that might be inside the variable: echo "$somevar" ◦ if somevar contained the * character, the double quotes stop the shell from globbing it CST8177 – Todd Kelley3

 set the variable myvar to have value value myvar=value  Note, to make this variable setting visible in sub processes we use export export myvar=value or myvar=value export myvar CST8177 – Todd Kelley4

◦ set the myvar variable to have a null value, then run the value command with that variable setting in effect myvar= command  Notice that if you try mistakenly use this to try to set the value of myvar to value myvar= value in this case you are actually trying to run a command called value CST8177 – Todd Kelley5

The usual way to use this mechanism is something like VISUAL=nano vipw  This means to set the value of the environment VISUAL variable to nano, and use that while the vipw command runs CST8177 – Todd Kelley6

◦ set the myvar variable to have a null value, then run the value command with that variable setting in effect myvar= value ◦ run the myvar command with one argument, namely =value myvar =value  run the myvar command with two arguments, namely = and value myvar = value CST8177 – Todd Kelley7

8

9 inode drwxr-xr-x access time modification time change time …etc….inode inode examples.desktopinode Assignmentsinode …etc… inode rw-r--r-- access time modification time change time …etc… data blocks for the file there is no filename here the filename(s) (at least one) are stored in directories

CST8177 – Todd Kelley10 inode drwxr-xr-x access time modification time change time …etc….inode inode examples.desktopinode Assignmentsinode …etc… Need read (r) on directory to read this column Need search (x) on directory to access this column Need write (w) and search (x) on directory to change first column

CST8177 – Todd Kelley11 inode rw-r--r-- access time modification time change time …etc… data blocks for the file there is no filename here the filename(s) (at least one) are stored in directories Need search (x) on directory this file is in to access this info on the file’s inode Need read (r) / write (w) / execute (x) on file to read / write / execute this file (contents)

CST8177 – Todd Kelley12

 create a command with basic scripting ◦ put “#!/bin/sh –u” at very beginning of file ◦ put commands in file ◦ make file executable  put the file in a directory that is in $PATH   Not a good idea to put “.” in PATH  Security implications of putting “current directory”, “.” in PATH  PATH=.:$PATH  demonstration of how the bad guy can arrange for you to inadvertently run their malicious commands as you CST8177 – Todd Kelley13