Self-test Linux/UNIX fundamentals

Similar documents
Introduction: What is Unix?

Unix Handouts. Shantanu N Kulkarni

3/8/2017. Unix/Linux Introduction. In this part, we introduce. What does an OS do? Examples

ACS Unix (Winter Term, ) Page 92

Linux Tutorial #6. -rw-r csce_user csce_user 20 Jan 4 09:15 list1.txt -rw-r csce_user csce_user 26 Jan 4 09:16 list2.

Introduction to Linux

Introduction to UNIX Shell Exercises

Operating Systems. Copyleft 2005, Binnur Kurt

Operating Systems 3. Operating Systems. Content. What is an Operating System? What is an Operating System? Resource Abstraction and Sharing

Unix Basics. Systems Programming Concepts

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

EECS 2031E. Software Tools Prof. Mokhtar Aboelaze

Lecture 3. Unix. Question? b. The world s best restaurant. c. Being in the top three happiest countries in the world.

Introduction to Unix: Fundamental Commands

Lab 2: Linux/Unix shell

5/20/2007. Touring Essential Programs

Introduction to Linux. Roman Cheplyaka

Table of contents. Our goal. Notes. Notes. Notes. Summer June 29, Our goal is to see how we can use Unix as a tool for developing programs

Lezione 8. Shell command language Introduction. Sommario. Bioinformatica. Mauro Ceccanti e Alberto Paoluzzi

Introduction to the Linux Command Line January Presentation Topics

First of all, these notes will cover only a small subset of the available commands and utilities, and will cover most of those in a shallow fashion.

CISC 220 fall 2011, set 1: Linux basics

The Unix Shell & Shell Scripts

Name: Tej. D. Shah Subject:CC-304 Linux Uni. Practical programme College :L.J. College Of Computer Application. Questions:

The UNIX Shells. Computer Center, CS, NCTU. How shell works. Unix shells. Fetch command Analyze Execute

Introduction to the UNIX command line

Lezione 8. Shell command language Introduction. Sommario. Bioinformatica. Esercitazione Introduzione al linguaggio di shell

Lecture # 2 Introduction to UNIX (Part 2)

Shell. SSE2034: System Software Experiment 3, Fall 2018, Jinkyu Jeong

Files

Part 1: Basic Commands/U3li3es

Linux & Shell Programming 2014

Linux Command Line Interface. December 27, 2017

Getting started with Hugs on Linux

Mills HPC Tutorial Series. Linux Basics I

CSC UNIX System, Spring 2015

Chapter-3. Introduction to Unix: Fundamental Commands

Computer Systems and Architecture

Introduction to UNIX. Introduction EECS l UNIX is an operating system (OS). l Our goals:

Course 144 Supplementary Materials. UNIX Fundamentals

Introduction to Linux

Exercise Sheet 2. (Classifications of Operating Systems)

Introduction to Linux

acmteam/unix.pdf How to manage your account (user ID, password, shell); How to compile C, C++, and Java programs;

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

Hitchhiker s Guide to VLSI Design with Cadence & Synopsys

Some useful UNIX Commands written down by Razor for newbies to get a start in UNIX

Introduction to Linux

File system Security (Access Rights)

Perl and R Scripting for Biologists

UNIX. The Very 10 Short Howto for beginners. Soon-Hyung Yook. March 27, Soon-Hyung Yook UNIX March 27, / 29

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

CSC209H Lecture 1. Dan Zingaro. January 7, 2015

Chap2: Operating-System Structures

CS246 Spring14 Programming Paradigm Notes on Linux

Getting your department account

(a) About Unix. History

Unix Introduction to UNIX

Getting started with Hugs on Linux

Unix L555. Dept. of Linguistics, Indiana University Fall Unix. Unix. Directories. Files. Useful Commands. Permissions. tar.

UNIX Tutorial Five

BIOINFORMATICS POST-DIPLOMA PROGRAM SUBJECT OUTLINE Subject Title: OPERATING SYSTEMS AND PROJECT MANAGEMENT Subject Code: BIF713 Subject Description:

EECS2301. Lab 1 Winter 2016

Week 2 Lecture 3. Unix

Introduction p. 1 Who Should Read This Book? p. 1 What You Need to Know Before Reading This Book p. 2 How This Book Is Organized p.

Please choose the best answer. More than one answer might be true, but choose the one that is best.

Exploring UNIX: Session 3

CSCE 212H, Spring 2008, Matthews Lab Assignment 1: Representation of Integers Assigned: January 17 Due: January 22

UNIX Quick Reference

LOG ON TO LINUX AND LOG OFF

CS 307: UNIX PROGRAMMING ENVIRONMENT KATAS FOR EXAM 1

CENG 334 Computer Networks. Laboratory I Linux Tutorial

Working with Basic Linux. Daniel Balagué

Introduction to Linux. Woo-Yeong Jeong Computer Systems Laboratory Sungkyunkwan University

Introduction to Linux

Welcome to Linux. Lecture 1.1

Unix Basics. Benjamin S. Skrainka University College London. July 17, 2010

CS 307: UNIX PROGRAMMING ENVIRONMENT KATAS FOR EXAM 2

S E C T I O N O V E R V I E W

Set 1 MCQ Which command is used to sort the lines of data in a file in reverse order A) sort B) sh C) st D) sort -r

Computer Systems and Architecture

M2PGER FORTRAN programming. General introduction. Virginie DURAND and Jean VIRIEUX 10/13/2013 M2PGER - ALGORITHME SCIENTIFIQUE

CS197U: A Hands on Introduction to Unix

CMU MSP 36602: Intro to UNIX and Scripting: Part 1

CRUK cluster practical sessions (SLURM) Part I processes & scripts

Useful Unix Commands Cheat Sheet

First of all, these notes will cover only a small subset of the available commands and utilities, and will cover most of those in a shallow fashion.

Multiple Choice - 58 Questions - 10 of 15%

Linux environment. Graphical interface X-window + window manager. Text interface terminal + shell

Introduction to Linux

Introduction to Linux

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

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

Assume that username is cse. The user s home directory will be /home/cse. You may remember what the relative pathname for users home directory is: ~

The Unix Shell. Permissions

LAB 8 (Aug 4/5) Unix Utilities

CS370 Operating Systems

Linux Shell Script. J. K. Mandal

Unix Filesystem. January 26 th, 2004 Class Meeting 2

Practical 4. Linux Commands: Working with Directories

Transcription:

Self-test Linux/UNIX fundamentals Document: e0829test.fm 16 January 2018 ABIS Training & Consulting Diestsevest 32 / 4b B-3000 Leuven Belgium TRAINING & CONSULTING

INTRODUCTION TO THE SELF-TEST LINUX/UNIX FUNDAMENTALS The following questionnaire might help to check your personal knowledge of the various topics discussed in the Linux/UNIX fundamentals course, in order to find out whether it is useful for you to follow this course. In this test, 20 questions are asked. For some questions, there is more than one correct answer. In such cases this will be clearly indicated. A question is answered correctly only if all correct answers are given. You can find the right answers and guidelines for the evaluation at the end of this document. Good luck! 16/01/2018 Self-test Linux/UNIX fundamentals 2

SELF-TEST LINUX/UNIX FUNDAMENTALS 1. Find the intruder. hsh csh ksh bash 2. Indicate which commands are syntactically correct. (2 answers) [_][a] ls -ld a* b* [_][b] ls -l-d a* b* [_][c] ls -l -d a* b* [_][d] ls -l a* -d b* 3. Consider the following commands which have been entered one after the other, and indicate which output is generated by the last command. $ mkdir a $ cd a $ ps > a $ ls > b $ cat b a cat: a: is a directory PID TTY TIME CMD 29362 pts/3 0:00 -ksh 92598 pts/3 0:00 ps a b a b PID TTY TIME CMD 29362 pts/3 0:00 -ksh 92598 pts/3 0:00 ps a PID TTY TIME CMD 29362 pts/3 0:00 -ksh 92598 pts/3 0:00 ps O (e) PID TTY TIME CMD 29362 pts/3 0:00 -ksh 92598 pts/3 0:00 ps a 16/01/2018 Self-test Linux/UNIX fundamentals 3

4. Which are the four navigation keys in vi? h - j - k - l l - u - d - r h - u - n - j a - q - s - d 5. Give the name of the command which would compare two files and show its result in the following layout: 3c3 < Linux --- > Unix diff Answer:... 6. I am in vi in command mode and I want to see the file list of a directory. For this I use the following command: (Select the most efficient solution) <esc> :! ls -l <enter> :!ls <enter> :ls <enter> This is not possible without closing vi Look at the result below and answer the following three questions. total 4 -rw-r--r-- 2 tb00029 staff 74 Dec 26 16:50 a -rw-r--r-- 1 tb00029 staff 0 Dec 26 16:50 b drwxr-xr-x 2 tb00029 staff 512 Dec 26 16:50 c -rw-r--r-- 2 tb00029 staff 74 Dec 26 16:50 d lrwxrwxrwx 1 tb00029 staff 1 Dec 26 16:51 e -> c 7. Which command may have produced these lines? ls -l ls -al ls -pl ls -pe 16/01/2018 Self-test Linux/UNIX fundamentals 4

8. In the same situation, which commands may have created file b? (2 answers) [_][a] >b [_][b] cat < b [_][c] cat b [_][d] touch b 9. In the same situation, how has file d possibly been created? >d O (e) O (f) touch d cat < d cp a d ln a d ln -s a d 10. Starting from any directory, which command must be entered to return immediately to one s home directory? cd. <enter> cd - <enter> cd <enter> cd HOME <enter> 11. To copy all files with names starting with a into the subdirectory c, I enter the following command: cp a* c cp a? c/ O (e) cp a[*] c mv a? /c/a cp a* /c/a O (f) mv a* c/ 16/01/2018 Self-test Linux/UNIX fundamentals 5

12. Which command was entered to change the file permissions of a from the first to the second form? (2 answers). -rw-r--r-- 2 tb00029 staff 74 Dec 26 16:50 a... -rwxrw---x 2 tb00029 staff 74 Dec 26 16:50 a [_][a] chmod 761 a [_][b] chmod 167 [_][c] chmod +124 a [_][d] chmod ou+x,g+w,o-r a [_][e] chmod u+x a; chmod o+x; [_] [f] [_] [g] none of the above. This is impossible with a single command. One needs a command to remove permissions and one to add permissions back. 13. Which command may give the following result? PID TTY TIME CMD 35622 pts/0 0:01 -ksh 46828 pts/0 0:00 ps Tue Nov 27 14:38:26 NFT 2005 Socrates O (e) ps#date#hostname ps date hostname ps>date>hostname ps;date;hostname ps/date/hostname 16/01/2018 Self-test Linux/UNIX fundamentals 6

14. For the following situation: $ ls <enter> abc abc1 abc11 abc13 abc2 abc3 What will be the output of the following command? $ ls abc[135]<enter> abc1 abc3 abc1 abc13 abc2 abc3 abc1 abc3 abc5 abc1 abc13 abc3 O (e) abc1 abc2 abc3 O (f) abc abc1 abc13 abc3 15. Which command permits to know how many login connections (result in digits only) are currently being used by user root? who grep root wc -l who > grep root wc -l who grep root>wc -l who grep >/dev/null wc -l O (e) grep root who wc -l O (f) O (g) wc -l grep root who wc -l<grep root<who 16. Knowing the following result: echo $abc <enter> Tue Dec 27 15:15:57 NFT 2005 Which command was used to initialise the variable abc with bash or Korn shell? O (e) O (f) O (g) set abc=date abc=date abc="date" $abc=$date abc=$(date) abc=exec(date) $abc=(date) 16/01/2018 Self-test Linux/UNIX fundamentals 7

17. Give the sequence of key presses and commands needed to run the script named s in background, then bring it to foreground, and finally interrupt and then kill it. O (e) s&<enter> ctrl-z fg %1<enter> stop %1<enter> s&<enter> ctrl-z<enter> fg %1<enter> stop %1<enter> kill %1<enter> s&<enter> fg %1<enter> ctrl-z stop %1<enter> kill %1<enter> s&<enter> ctrl-z<enter> fg %1<enter> kill %1<enter> s&<enter> fg %1<enter> ctrl-z kill %1<enter> 18. Which variant of the command find corresponds to the following search? Content of the directory: -rw-r--r-- 1 tb00029 staff 0 Dec 27 14:48 abc -rw-r--r-- 1 tb00029 staff 0 Dec 27 14:48 abc1 -rw-r--r-- 1 tb00029 staff 0 Dec 27 14:48 abc11 -rw-r--r-- 1 tb00029 staff 0 Dec 27 14:54 abc13 -rw-r--r-- 1 tb00029 staff 0 Dec 27 14:48 abc2 -rw-r--r-- 1 tb00029 staff 0 Dec 27 14:49 abc3 drwxr-xr-x 2 tb00029 staff 512 Dec 27 16:10 abc4 drwxr-xr-x 2 tb00029 staff 512 Dec 27 16:11 abc5 Wanted result of the find command: drwxr-xr-x 2 tb00029 staff 512 Dec 27 16:10./abc4 drwxr-xr-x 2 tb00029 staff 512 Dec 27 16:11./abc5 find. -name "abc[345]" -type d find. -name "abc[345]" -type d ls -ltr find abc[345] -type d -exec ls -l {} \; find. -name 'abc[345]' -type d -exec ls -ld {} ';' O (e) find. -name -type d -exec ls -ld {} ";" O (f) find. -name abc\[345\] -type d -exec ls -l {} \; 16/01/2018 Self-test Linux/UNIX fundamentals 8

19. Which command permits to select from the file of users, those working in either ksh or csh? Make use of the following file content. > cat /etc/passwd root:!:0:0:root:/root:/usr/bin/sh tb00804:!:202:1:koen:/home/tb00804:/usr/bin/ksh tb00041:!:448:1:peter:/home/tb00041:/usr/bin/bash student1:!:297:103:student 1:/opt/bmc/pem/u/student1:/usr/bin/csh student2:!:298:103:student 2:/opt/bmc/pem/u/student2:/usr/bin/bash team00:!:203:205:student 00:/home/curaix/team00:/usr/bin/ksh team01:!:204:205:student 01:/home/curaix/team01:/usr/bin/ksh... result of the command... tb00029:!:202:1:koen:/home/tb00029:/usr/bin/ksh student1:!:297:103:student 1:/opt/bmc/pem/u/student1:/usr/bin/csh team00:!:203:205:student 00:/home/curaix/team00:/usr/bin/ksh team01:!:204:205:student 01:/home/curaix/team01:/usr/bin/ksh grep '/ksh' /etc/passwd ; grep '/csh' /etc/passwd grep '/ksh' /etc/passwd grep '/csh' grep '/[kc]sh$' /etc/passwd grep '/(k c)sh' /etc/passwd O (e) grep '[kc]sh^' /etc/passwd 20. Give the name of the command that displays the documentation of an other command. man Answer:... 16/01/2018 Self-test Linux/UNIX fundamentals 9

EVALUATION. Here are the correct answers to all questions: 1. a 2. a c 3. c 4. a 5. diff 6. b 7. a 8. a d 9. e 10. c 11. a 12. a d 13. d 14. a 15. a 16. e 17. e 18. d 19. c 20. man Give 1 point per correctly answered question, also for questions with multiple correct answers. If your score is more than 80%, you do not have to follow this course. You have sufficient background to follow one of the courses Linux/UNIX for advanced users, Linux/UNIX shell programming, or one of the other courses in our UNIX course programme. When you have a score between 50% and 80%, following the course can improve your knowledge. When your score is less than 50%, we strongly suggest you follow the Linux/UNIX fundamentals course. 16/01/2018 Self-test Linux/UNIX fundamentals 10