CEG 333 Introduction to UNIX Wright State University Midterm Examination #1

Similar documents
Week 2 Lecture 3. Unix

CSCI 2132 Software Development. Lecture 4: Files and Directories

Lecture 2b. Pathnames, files, special characters in filenames, and file permissions. COP 3353 Introduction to UNIX, FALL 2013

Linux Training. for New Users of Cluster. Georgia Advanced Computing Resource Center University of Georgia Suchitra Pakala

Introduction to the Linux Command Line

Exploring UNIX: Session 3

Files

Introduction to Linux

Linux Essentials. Programming and Data Structures Lab M Tech CS First Year, First Semester

CISC 220 fall 2011, set 1: Linux basics

CHAPTER 1 UNIX FOR NONPROGRAMMERS

commandname flags arguments

UNIX File Hierarchy: Structure and Commands

CS246 Spring14 Programming Paradigm Notes on Linux

AN INTRODUCTION TO UNIX

Outline. Structure of a UNIX command

CSCI 2132 Software Development. Lecture 5: File Permissions

Files and Directories

Mills HPC Tutorial Series. Linux Basics I

The Unix Shell. Permissions

Basic Unix Command. It is used to see the manual of the various command. It helps in selecting the correct options

SECTION -C. Getting Started with UNIX

CS Unix Tools. Lecture 2 Fall Hussam Abu-Libdeh based on slides by David Slater. September 10, 2010

Unix Filesystem. January 26 th, 2004 Class Meeting 2

Unix/Linux Basics. Cpt S 223, Fall 2007 Copyright: Washington State University

Practical 4. Linux Commands: Working with Directories

Chapter Two. Lesson A. Objectives. Exploring the UNIX File System and File Security. Understanding Files and Directories

1. What statistic did the wc -l command show? (do man wc to get the answer) A. The number of bytes B. The number of lines C. The number of words

Basic File Attributes

CSE 303 Lecture 4. users/groups; permissions; intro to shell scripting. read Linux Pocket Guide pp , 25-27, 61-65, , 176

-1- csh cd. cd alias!! ; set prompt=" pwd % " 16 cd. 17 cd.. 18 his /home% set prompt. alias. yasuoka : root :

Unix File System. Class Meeting 2. * Notes adapted by Joy Mukherjee from previous work by other members of the CS faculty at Virginia Tech

Unix as a Platform Exercises. Course Code: OS-01-UNXPLAT

Introduction to Linux

CSC209H Lecture 1. Dan Zingaro. January 7, 2015

LING 408/508: Computational Techniques for Linguists. Lecture 5

Exercise Sheet 2. (Classifications of Operating Systems)

Introduction to Linux Workshop 1

Introduction to Linux Part I: The Filesystem Luca Heltai

Introduction to Unix May 24, 2008

Permission and Ownership

CS4350 Unix Programming. Outline

System Administration

CST Lab 2 Review #1

5/8/2012. Encryption-based Protection. Protection based on Access Permission (Contd) File Security, Setting and Using Permissions Chapter 9

Basic Unix Commands. CGS 3460, Lecture 6 Jan 23, 2006 Zhen Yang

Hitchhiker s Guide to VLSI Design with Cadence & Synopsys

Unix as a Platform Exercises + Solutions. Course Code: OS 01 UNXPLAT

Working with Basic Linux. Daniel Balagué

Getting started with Hugs on Linux

A Brief Introduction to Unix

Introduction to the UNIX command line

A Big Step. Shell Scripts, I/O Redirection, Ownership and Permission Concepts, and Binary Numbers

UNIX Quick Reference

You will automatically be in your user (home) directory when you login.

CSC209. Software Tools and Systems Programming.

THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering

Getting started with Hugs on Linux

Scripting. Shell Scripts, I/O Redirection, Ownership and Permission Concepts, and Binary Numbers

Introduction to Linux

Introduction: What is Unix?

CSN08101 Digital Forensics. Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Introduction to Linux

Getting Started With UNIX Lab Exercises

Student Remote Login Procedure (see picture below): 1. Start SSH Secure Shell 2. Click the computer icon (4 th on the toolbar) 3.

Unix Handouts. Shantanu N Kulkarni

CS 2505 Computer Organization I Test 1

National University of Computer and Emerging Sciences Operating System Lab - 02 Lab Manual

UNIX COMMANDS AND SHELLS. UNIX Programming 2015 Fall by Euiseong Seo

Unix. 1 tblgrant projects 0 Jun 17 15:40 doc1.txt. documents]$ touch doc2.txt documents]$ ls -l total 0

read: permitted to read the contents of directory ( view files and sub-directories in that directory ).

Files (review) and Regular Expressions. Todd Kelley CST8207 Todd Kelley 1

Aliases are set manually or in a login script. Aliases that were set manually will be gone the next time you login.

EECS2301. Lab 1 Winter 2016

Essential Linux Shell Commands

CS CS Tutorial 2 2 Winter 2018

Basic File Attributes

Read the relevant material in Sobell! If you want to follow along with the examples that follow, and you do, open a Linux terminal.

bash startup files Linux/Unix files stty Todd Kelley CST8207 Todd Kelley 1

Contents. Note: pay attention to where you are. Note: Plaintext version. Note: pay attention to where you are... 1 Note: Plaintext version...

CS 2505 Computer Organization I Test 1

This section reviews UNIX file, directory, and system commands, and is organized as follows:

Course 144 Supplementary Materials. UNIX Fundamentals

d. 1 e. test: $a: integer expression expected

CENG 334 Computer Networks. Laboratory I Linux Tutorial

A Brief Introduction to the Linux Shell for Data Science

MTU Computer Structure

CSE II-Sem)

The Unix Shell & Shell Scripts

Filesystem and common commands

Introduction to Linux Basics Part I. Georgia Advanced Computing Resource Center University of Georgia Suchitra Pakala

File Security Lock Down Your Data. Brian Reames January 22, 2012

Getting your department account

CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX

Introduction to Linux Basics

Introduction to Unix CHAPTER 6. File Systems. Permissions

: the User (owner) for this file (your cruzid, when you do it) Position: directory flag. read Group.

Unix background. COMP9021, Session 2, Using the Terminal application, open an x-term window. You type your commands in an x-term window.

Lab Working with Linux Command Line

Using UNIX. -rwxr--r-- 1 root sys Sep 5 14:15 good_program

Transcription:

CEG 333 Introduction to UNIX Wright State University Midterm Examination #1 Fall Quarter, 2005 Name: Student Number: READ THESE INSTRUCTIONS This is an open-book exam. The use of the notes contained in your class portfolio is permitted. The questions on this examination require you to provide answers similar to those you have seen in lecture, used in the course homework assignments, or presented in the course textbook. Answer all questions in the spaces indicated and only in the spaces indicated. Read each question carefully and work as rapidly as you can without being careless. Academic Honesty At the end of the examination, please sign: In recognition of and in the spirit of the Wright State University policies of academic honesty, I certify that I have neither given nor received unpermitted aid in this examination. Signature: Only questions about these instructions, typing, or copying errors will be answered during the exam. If you are not sure what a question means, state your interpretation and proceed. Use the most direct interpretation and select the best answer for that interpretation. DO NOT BEGIN UNTIL INSTRUCTED TO DO SO

Dr. Doom Page 2 of 6 Consider the following typescript when answering the questions on this page. Do not assume that any other commands are executed between the creation of this typescript and the command answering the question. <w001ted@unixapps1:~ > echo $HOME /common/users2/cse/w001ted <w001ted@unixapps1:~ > pwd /common/users2/cse/w001ted <w001ted@unixapps1:~ > ls l drwx------ 4 w001ted users 512 Sep 15 2004 bin drwx------ 4 w001ted users 512 Sep 25 21:34 reddwarf drwx------ 2 w001ted users 512 Sep 25 21:34 tmp <w001ted@unixapps1:~ > ls l reddwarf/ drwx------ 2 w001ted users 512 Sep 25 21:34 starbug1 drwx------ 2 w001ted users 512 Sep 25 21:33 starbug2 <w001ted@unixapps1:~ > ls l reddwarf/starbug1 -rw------- 1 w001ted users 0 Sep 25 21:10 lister -rw------- 1 w001ted users 0 Sep 25 21:10 thecat <w001ted@unixapps1:~ > ls l reddwarf/starbug2 -rw------- 1 w001ted users 0 Sep 25 21:33 holly -rw------- 1 w001ted users 0 Sep 25 21:30 kryten -rw------- 1 w001ted users 0 Sep 25 21:30 rimmer 1. Which of the following will move kryten from starbug2 into starbug1? a. mv ~/reddwarf/starbug2/kryten reddwarf/starbug1 b. mv reddwarf/starbug2/kryten ~/reddwarf/starbug1/kryten c. mv starbug2/kryten starbug1/kryten e. a. b. and c. 2. Which of the following commands would change your current directory to starbug2? a. cd starbug2 b. cd ~/reddwarf/starbug2 c. cd /common/users2/cse/w001ted/reddwarf/starbug2 3. Which of the following are absolute paths to the file holly? a. /reddwarf/starbug2/holly b. ~/reddwarf/starbug2/holly c. /common/users2/cse/w001ted/reddwarf/starbug2/holly 4. Which of the following commands will create a directory named ace in reddwarf? a. makedir reddwarf/ace b. newdir ace c. nwdir reddwarf/ace d. nwdir ace e. mkdir reddwarf/ace 5. Which of the following commands would remove the file named rimmer? a. rm rimmer b. rm starbug2/rimmer c. rm reddwarf/starbug2/rimmer d. none of the above e. all of the above

Dr. Doom Page 3 of 6 Consider the following typescript when answering questions 6-10 on this page. <w001ted@unixapps1:~ > /bin/pwd /common/users2/cse/w001ted <w001ted@unixapps1:~ > echo $PATH /bin:/usr/bin:/usr/ucb:/usr/xpg4/bin:. <w001ted@unixapps1:~ > alias script /bin/who <w001ted@unixapps1:~ > 6. If an executable shell script called runme exists in all of the directories of the path, which command will be executed by this command: $ runme a. /bin/runme b. /usr/bin/runme c. /usr/ucb/runme d. /usr/xpg4/runme e. runme in your current directory 7. If an executable shell script called script exists in all of the directories of the path, which command will be executed by this command: $ script a. /bin/script b. /usr/bin/script c. script in your current directory d. /bin/who e. /bin/ls 8. For the questions above, which of the following commands could you have used to determine which command would be executed? a. findcommand b. ls c. path d. which 9. If you d like to execute the command poweroff that is only available in /usr/sbin/, which of the following commands would work (assuming that you have appropriate permissions)? a. poweroff b. /usr/sbin/poweroff c. ~/poweroff e. none of the above 10. Which command would remove an alias that you had previously defined for who? a. rmalias who b. delalias who c. alias who d. unalias who e. c. and d. 11. Which of the following commands would list ALL of the files in a directory, including dot files? a. ls a b. ls d c. ls l d. ls x e. ls F 12. The pwd command will return the name of your current directory. What is pwd an acronym for? a. print which directory b. push working directory c. print working directory d. path of which directory e. process which directory

Dr. Doom Page 4 of 6 Consider the following typescript when answering questions 13-18 on this page. heartofgold@gandalf:~/hitchhikers> /bin/ls -l total 64 dr-xr--r-- 2 heartofgold hitchhikers 24 Sep 24 13:11 dir1 -rw----r-- 1 heartofgold hitchhikers 2938 Sep 24 13:51 arthur drwxr--r-- 2 heartofgold hitchhikers 8216 Sep 24 13:59 marvin -r-------- 1 heartofgold hitchhikers 18 Sep 24 13:37 trillian -rwxr-xr-x 1 heartofgold hitchhikers 176 Sep 24 13:51 zaphod 13. Which elements of the file listing above are directories? a. arthur b. marvin c. trillian d. zaphod e. a. and b. 14. Who is able to read the contents of the file arthur? a. user heartofgold b. anyone in group hitchhikers c. everyone (all) d. a. and c. e. a. and b. 15. What actions could you execute if you were currently in the directory dir1? a. create a new file b. read an existing file c. delete an existing file d. b. and c. 16. Currently, the file trillian is only readable by heartofgold. Which of the following commands would make it also readable by the group hitchhikers? a. chmod 444 trillian b. chmod g+r trillian c. chmod 404 trillian e. a and c. 17. If all of the elements of the listing that are not directories are files that contain shell scripts, which are shell scripts that could be executed by heartofgold? a. arthur b. marvin c. zaphod d. a. and c. 18. Which of the following commands would remove group read permission from file zaphod? a. chmod g-r zaphod b. chgrp zaphod c. chgrp read zaphod d. chmod g-x zaphod e. chgrp g-r zaphod 19. Which of the following commands would execute a file listing of your current directory and write that listing into a file named output. a. ls; output b. ls output c. ls > output d. ls && output e. c. and d. 20. Which of the following commands would tell you your current terminal emulation? a. echo TERM b. echo $TERM c. echo $TERM

Dr. Doom Page 5 of 6 Consider the following typescript when answering the questions on this page. serenity@paladin:~/firefly> /bin/ls -l total 64 -rw-r--r--1 serenity firefly 821 Sep 24 13:54 book -rw-r--r--1 serenity firefly 2938 Sep 24 17:51 inara -rw-r--r--1 serenity firefly 288 Sep 24 17:51 jayne -rw-r--r--1 serenity firefly 2918 Sep 24 17:51 kaylee -rwxr-xr-x1 serenity firefly 176 Sep 24 08:31 mal -rwxr-xr-x1 serenity firefly 143 Sep 24 08:31 river -rwxr-xr-x1 serenity firefly 189 Sep 24 08:31 simon -rw-------1 serenity firefly 45 Sep 24 12:32 wash -rw-rw-r--1 serenity firefly 841 Sep 24 13:54 zoe 21. Which of the following commands will produce a listing that includes the file mal? a. ls b. ls m* c. ls?a* d. ls mal* e. all of the above 22. Which of the following commands will produce a listing that includes the files inara and jayne? a. ls??a* b. ls [ij]???[a-g] c. ls *a* d. a. and c. 23. Which of the following commands will list ONLY the files jayne and kaylee? a. ls *y* b. ls?ay*e c. ls *e 24. How many files will be listed by this command: /bin/ls?a*l* a. 1 b. 2 c. 3 d. 4 e. 5 25. Which files will be listed by this command: /bin/ls??*o* a. book b. simon c. zoe 26. Which files will be listed by this command: /bin/ls {s,r,}i* a. simon b. inara c. river d. all of the above e. a. and b.

Dr. Doom Page 6 of 6 Consider this typescript and man page when answering the questions on this page. babylon5@paladin:~/b5> /bin/ls -l -rw-r--r--1 babylon5 b5 821 Sep 24 13:54 ivanova -rw-------1 babylon5 b5 2938 Sep 24 17:51 marcus -rw-r--r--1 babylon5 b5 288 Sep 24 17:51 sinclair babylon5@paladin:~/b5> umask 77 User Commands NAME cp - copy files cp(1) SYNOPSIS /usr/bin/cp [ -ip ] source_file target_file /usr/bin/cp -r -R [ -fip ] source_dir... target In the first synopsis form, neither source_file nor target_file are directory files, nor can they have the same name. The cp utility will copy the contents of source_file to the destination path named by target_file. If target_file exists, cp will overwrite its contents, but the mode (and ACL if applicable), owner, and group associated with it are not changed. The last modification time of target_file and the last access time of source_file are set to the time the copy was made. If target_file does not exist, cp creates a new file named target_file that has the same mode as source_file except that the sticky bit is not set unless the user is superuser; the owner and group of target_file are those of the user. If target_file is a link to another file, cp will overwrite the link destination with the contents of source_file; the link(s) from target_file will remain. In the second synopsis form, one or more directories speci fied by source_dir are copied to the directory specified by target. Either -r or -R must be specified. For each source_dir, cp will copy all files and subdirectories. -i Interactive. cp will prompt for confirmation whenever the copy would overwrite an existing target. A y answer means that the copy should proceed. Any other answer prevents cp from overwriting target. -r Recursive. cp will copy the directory and all its files, including any subdirectories and their files to target. -R Same as -r, except pipes are replicated, not read from. -p Preserve. cp duplicates not only the contents of source_file, but also preserves the owner and group id, permissions modes, modification and access time, and ACLs if applicable. The command will not fail if unable to preserve modification and access time or permission modes. If unable to preserve owner and group id, cp will not fail, and it will clear S_ISUID and S_ISGID bits in the target. cp will print a diagnostic message to stderr and return a non-zero exit status if unable to clear these bits. In order to preserve the owner and group id, permission modes, and modification and access times, users must have the appropriate file access permissions; this includes being superuser or the same owner id as the destination file. 27. Which of the following commands will copy the contents of one entire directory dir1 into a new identical directory dir2 (both in your current directory)? a. cp dir1 dir2 b. cp R dir1 dir2 c. cp r dir1 dir2 d. cp f dir1 dir2 28. Which of the following will copy ivanova onto sinclair without asking for confirmation? a. cp -i ivanova sinclair b. cp -I ivanova sinclair c. cp ivanova sinclair d. cp -p ivanova sinclair e. c. and d. 29. If the command $ cp -p sinclair valen is executed, which of the following shows the permissions of the new file valen? a. ---------- b. -rw-r--r-- c. -rwx------ d. -rw-r--rwe. unknown 30. If the command $ /bin/touch delenn is used to create a new file called delenn, which of the following shows the permissions of the new file delenn? a. ---------- b. -rw-r--r-- c. -rwx------ d. -rw-r--r-- e. unknown