LAB 8 (Aug 4/5) Unix Utilities

Size: px
Start display at page:

Download "LAB 8 (Aug 4/5) Unix Utilities"

Transcription

1 Aug 4/5 Due: Aug 11 in class Name: CSE number: LAB 8 (Aug 4/5) Unix Utilities The purpose of this lab exercise is for you to get some hands-on experience on using some fundamental Unix utilities (commands). After this lab, you are expected to be able to accomplish lots tasks using command line utilities, without resorting to your GUI based utilities such as JEditors or File Manager. In some systems such GUI tools are not available and thus using command line utilities is your only option. We covered in class the following basic utilities/commands: man, pwd, ls, cd, mkdi, rmdir, cat, more, head, tail, cp, mv, rm, wc, chmod, grep/egrep. We will also cover uniq, sort, cut, find and tr etc this week. You are also expected to explore some advanced utilities such as tr, awk, sed. You can get the details of each utility by 1) going through the class slides. 2) going through the provided Guided Lab Tour for CSE ) using utility man. E.g., man sort Go through the following 95 (small) practices. Write down your answers besides the questions. Hand in this sheet. Note: Each solution should only involve one entry of utility (e.g., mv file1 file2) or a pipeline of utilities (e.g., cat file1 sort wc). 0. Login to your home directory, and change to Bourne shell by issuing sh.the prompt should change from % to $ 1. There is a file called xxx in directory /cs/dept/course/ /s/2031/ Copy this file to your current directory with the same name, using one entry of utility (command). 2. Check that the file is copied here. sh-4.1$ your_command xxx sh-4.1$ 3. There are two files named xfile2 and xfile3 in directory /cs/dept/course/ /s/2031/ copy these two files to your home directory using one entry of utility, and using absolute path. Assume these two files are the only files whose names begin with xfile. Hint: so you can use xfile* or File? to match these two files. (If you don t understand * and?, look for page 10 of the Guided Lab Tour for CSE1020). Note, don t confuse that with * and? that are used in (extended) regular expression.. 4. Verify that the 2 files are copied successfully to the current directory. sh-4.1$ your_command xfile2 xfile3 sh-4.1$ 5. Rename file xxx to xfile1 6. Verify that the renaming is successful. sh-4.1$ your_command xfile1 xfile2 xfile3 7. Create a sub-directory named lab8a under the current (home) directory 1

2 8. Verify the existence of directory lab8a by listing the directory itself. sh-4.1$ your_command drwx your_name ugrad 4096 Jul 31 17:00 lab8a sh-4.1$ (Note, if the creation was unsuccessful, then you will get ls: cannot access lab8working: No such file or directory ) 9. Move all the 3 files (together) into lab8a (using one entry of utility) 10. Verify that the move is successful by listing files in directory lab8a (without going into that directory) total 12 -rwx yourname yourgroup 140 July 31 16:58 xfile1 -rwx yourname yourgroup 140 July 31 16:58 xfile2 -rwx yourname yourgroup 86 July 31 16:58 xfile3 11. Copy directory lab8a to a new directory named lab8b (using one). 12. Verify that lab8b was created successfully total 8 drwx yourname yourgroup 4096 July 31 17:00 lab8a drwx yourname yourgroup 4096 July 31 17:02 lab8b sh-4.1$ 13. Verify that the two directories are identical lab8a: xfile1 xfile2 xfile3 lab8b: xfile1 xfile2 xfile3 14. Remove the whole directory lab8a using rmdir. What happened? 15. Remove the whole directory lab8a using a different (more effective) utility. 16. Verify that directory lab8a has been removed ls: cannot access lab8a: No such file or directory sh-4.1$ 17. Move xfile1 in lab8b to current (parent) directory, using relative directory. 18. Verify that the above move was successful. Lets do this by searching for the files sh-4.1$ find. name xfile*./lab8b/xfile2./lab8b/xfile3./xfile1 2

3 19. Change the name of directory lab8b to lab8working 20. Verify that the renaming was successful. ls: cannot access lab8b: No such file or directory 21. Navigate to directory lab8working 22. Verify that you are in lab8working /cs/home/your_account/lab8working 23. Move xfile1 (in the parent directory) to the current directory using relative path. 24. Verify that the move was successful by listing all the files currently in lab8working. total 12 -rwx yourname yourgroup 140 Jul 31 16:58 xfile1 -rwx yourname yourgroup 140 Jul 31 16:58 xfile2 -rwx yourname yourgroup 86 Jul 31 16:58 xfile3 25. Display on stdout the contents of the three files with one command (Try more xfile1 xfile2 xfile3 or more xfile?) 26. Check how many lines xfile1 contains. You should get Display the first line of xfile1 28. Display the first two lines of xfile2 29. Display the last 3 lines of xfile2 30. Confirm that xfile1 and xfile2 are identical, using an utility, which should return silently (Hint: cmp or diff). 31. Confirm that xfile1 and xfile2 are identical, using another utility, which return silently (diff or cmp) 32. Show that xfile2 and xfile3 are not identical, using one utility, which will not be silent this time. Try to understand the message but don t spend too much time on it. 33. Show that xfile2 and xfile3 are not identical, using another utility, which will not be silent this time. Try to understand the message but don t spend too much time on it. Note: these two utilities are used by some professors to judge your labtest output with their solutions: gcc yourcode.c; a.out > youroutputfile; cmp youroutputfile professorsoutputfile; A student gets 0 if the last command does not return silently. 34. Concatenate the contents of the three files into a new file xfile123, in the order of xfile1,xfile2 and xfile3. Hint: use cat and redirection >. After that, show on stdout the content of xfile123. 3

4 sh-4.1$ more xfile Sort file xfile123 so the identical lines are adjacent now 36. Show on the stdout the count of identical lines (hint: use pipe involving sort and uniq -c) Remove the identical lines and save the result into a file xfile123compact, without the counts (as show below). 38. Show on the stdout the content of xfile123compact 4

5 39. Issue chmod 775 xfile1, see the resulting permission mode of the file. Can you understand what we are doing here? 40. Issue chmod 777 xfile1, see the resulting permission mode of the file. Can you understand what we are doing here? 41. Change the permission of xfile123compact using octal numbers so that the permission becomes -rwxr--r-- 1 yourname yourgroup 140 Jul 31 17:23 xfile123compact 42. Change the permission of file123compact by giving group an execute permission. Then show the result: -rwxr-xr-- 1 yourname yourgroup 140 Jul 31 17:23 xfile123compact 43. change the permission of xfile123compact by giving group a write permission, and remove write permission of the owner of the file. You should do chmod only once. Then show the result: -r-xrwxr-- 1 yourname yourgroup 140 Jul 31 17:23 xfile123compact 44. Change the permission of xfile123compact by removing write permission from the group, and giving execution permission to the others. You should do chmod only once. Then show the result: r-xr-xr-x 1 yourname yourgroup 140 Jul 31 17:23 xfile123compact 45. Change the permission of xfile123compact by adding the write permission of user, group and other. You should do chmod only once. Then show the result: rwxrwxrwx 1 yourname yourgroup 140 Jul 31 17:23 xfile123compact 46. Modify xfile1 by adding a new line at the end of the file. This can be done by echo this is a xxx new line >> xfile1 cat >> xfile1 and then enter a new line followed by Ctrl-D. or 47. List the files in the current directory, sorted by the modification time. xfile1 should be the first file in the list and other files are also sorted according to the modification time. 48. List the files, sorted by the modification time, in reverse order. 49. List the files, sorted by the size of the files. xfile123 should be the first file in the list and other files are also sorted according to the sizes. 50. List the files, sorted by the size of the files, in reverse order. 51. Try to get the type of the file xfile123compact (Hint: use file utility) xfile123compact: ASCII text 52. Try to get the type of one of your c source files. hello.c: ASCII C program text 53. Try to get the type of one of your a.out files. a.out: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux , not stripped 5

6 54. Check that the link count of xfile123compact is 1, which means that entry xfile123compact is the only link to the physical file, which resides in the disk. -rwxrwxrwx 1 yourname yourgroup Jul 31 17:23 xfile123compact link count 55. Generate a hard link of xfile123compact called hardlink123 (Hint: use ln utility) Now both xfile123compact and hardlink123 'point' to the same physical file, which resides somewhere in the disk. 56. Verify that the link counts of both the two files are 2 now. This means that two pointers point to the same physical file. -rwxrw-r-- 2 yourname yourgroup 140 Jul 31 17:50 hardlink123 -rw yourname yourgroup 140 Jul 31 17:48 xfile1 -rw yourname yourgroup 366 Jul 31 17:10 xfile123 -rwxrwxrwx 2 yourname yourgroup 140 Jul 31 17:20 xfile123compact -rw yourname yourgroup 140 Jul 31 16:58 xfile2 -rw yourname yourgroup 86 Jul 31 16:58 xfile3 57. Remove file hardlink Verify that hardlink123 is gone, but xfile123compact is still there, and its link count becomes 1. -rw yourname yourgroup 140 Jul 31 17:48 xfile1 -rw yourname yourgroup 366 Jul 31 17:10 xfile123 -rwxrwxrwx 1 yourname yourgroup 140 Jul 31 17:20 xfile123compact -rw yourname yourgroup 140 Jul 31 16:58 xfile2 -rw yourname yourgroup 86 Jul 31 16:58 xfile3 59. Since the newly added line of xfile1 is the only line that contains xxx in the file, we can remove the (last) line from xfile1 by issuing two utilities:, on a single line: sh-4.1$ egrep v xxx xfile1 > tmp sh-4.1$ mv tmp xfile1 Do you understand what I am doing here? Briefly explain here: 60. Sort xfile123compact according to the numerical value of the 3rd field 61. Sort xfile123compact according to the numerical value of the 3rd field, in reverse order 6

7 62. In exercise 59 and 60, John Smith and Lisa Sue, who have the same 3 rd field value, did not get further sorted according to the 4 th field. Sort xfile123compact according to the numerical value of the 3rd field, and then based on this, further sort according to the 4th field. You just need one command, don t sort twice. 63. Sort xfile123compact according to the year (the last field) 64. Sort xfile123compact according to the year (the last field), in reverse order. 65. Use cut utility to extract the first names in the file xfile123compact. That is, display the 1 st column/field of the file. Use man or look into the slides for the cut utility. Hint: cut fx -d" " file123compact, where x is an integer. This command means treat " " as column/field delimiter, and display column/field x. John John Larry Lisa Tony 66. Use cut utility to extract the month and year in the file xfile123compact. Hint: cut fx,y -d" " or cut fx-y -d" " Jan 1966 Apr 1956 Dec 1946 Jul 1980 Mar

8 67. [Bonus]. Extract the first name, month and year in the file xfile123compact, and output the results sorted by month. John Jan 1966 Tony Mar 1950 John Apr 1956 Lisa Jul 1980 Larry Dec Suppose that we want to change all the lower case letters in xfile123compact to upper case letters. This can be accomplished by a utility called tr. Try tr [a-z] [A-Z] < xfile123compact and observe the following output. JOHN DUNCAN JAN 1966 JOHN SMITH APR 1956 LARRY JONES DEC 1946 LISA SUE JUL 1980 TONY JONES MAR Use the same utility to change every digit in the file into character +. John Duncan Jan ++++ John Smith Apr ++++ Larry Jones Dec ++++ Lisa Sue Jul ++++ Tony Jones Mar ++++ The following exercises involve filtering files. Use egrep or grep E (which guarantee to accept the extended regular expression) and make sure you are in sh. 70. Display the records of people in file xfile123compact who were born in 1950s 71. Pipe egrep or grep E and another utility to get the number of peoples in xfile123compact who were born in 1950s. You should get The EECS department maintains the records of all the students, stuff and faculty members in a file /etc/passwd, one person per line. Issue a utility to find out how many students are in the list. You should get about Retrieve your information in the file /etc/passwd, using your cse login account. 74. The (modified) class list of our class can be found at /cs/dept/course/ /s/2031/2031cl. Each line of the file contains one student information. Get the number of students currently enrolled in the course. 8

9 You should get 44. You can use the file directly (by giving the path), or, copy the file to your current directory. If you are wondering how I modified the file, here is the single command: tr [0-9] * < original2031cl > 2031cl 75. Retrieve your record from the class list. 76. Look for the student(s) whose name contain Wang. 77. Pipe egrep and another utility to get the number of students whose name contain Wang. You should get Look for the student(s) whose name contains Wang or Wong. 79. Pipe egrep and another utility to get the number of students whose name contain Wang or Wong. You should get 2. There is a file lyrics in directory /cs/dept/course/ /s/2031. Use the file directly (by giving the path), or, copy the file to your current directory, and then use grep E or egrep utility to find the lines in lyrics that: 80. does not contain the Well you know it's your bedtime, Oh you sleepy young 1970 heads dream of wonderful things, 81. contains digits #So turn off the light, 1980 Oh you sleepy young 1970 heads dream of wonderful things, sea 1980 I got there by chance. 82. contains 1980 #So turn off the light, 1980 sea 1980 I got there by chance. 83. end with 1980 #So turn off the light, contains sea Beautiful mermaids will swim through the sea, sea 1980 I got there by chance. 85. begins with sea sea 1980 I got there by chance. 86. contains one (any) character followed by nd Say all your prayers and then, Oh you sleepy young 1970 heads dream of wonderful things, 87. contains one (any) character followed by nd, but as a whole world only (so wonderful does not match) Say all your prayers and then, 9

10 88. begins with one (any) character followed by nd 89. contains letter A or B or C or D Beautiful mermaids will swim through the sea, 90. begins with a capital letter Well you know it's your bedtime, Say all your prayers and then, Oh you sleepy young 1970 heads dream of wonderful things, Beautiful mermaids will swim through the sea, 91. begins with a non capital letter (lower case letter or any other characters) #So turn off the light, 1980 sea 1980 I got there by chance. 92. ends with a and one other character. Beautiful mermaids will swim through the sea, 93. contains a character that is either a or b or c, followed by nd Say all your prayers and then, 94. contains a character that is not a nor b nor c, followed by nd Oh you sleepy young 1970 heads dream of wonderful things, 95. Go back to your home directory, and issue the utility find. -name xfile* What do you get? 96. Issue find. -name xfile* -exec mv {} {}.2015 \; What we intend to do here? List directory lab8working and examine what happens to the files in lab8working? Submission Print out this pdf, write your solutions on this sheet. Hand in the sheet in next class. Or, write the question numbers and your answers in a file, and submit the file submit lab8 your_file_name End of lab8 10

LAB 8 (Aug 4/5) Unix Utilities

LAB 8 (Aug 4/5) Unix Utilities Aug 4/5 Due: Aug 11 in class Name: CSE number: LAB 8 (Aug 4/5) Unix Utilities The purpose of this lab exercise is for you to get some hands-on experience on using some fundamental Unix utilities (commands).

More information

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

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 Summer 2010 Department of Computer Science and Engineering York University Toronto June 29, 2010 1 / 36 Table of contents 1 2 3 4 2 / 36 Our goal Our goal is to see how we can use Unix as a tool for developing

More information

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

Linux Essentials. Programming and Data Structures Lab M Tech CS First Year, First Semester Linux Essentials Programming and Data Structures Lab M Tech CS First Year, First Semester Adapted from PDS Lab 2014 and 2015 Login, Logout, Password $ ssh mtc16xx@192.168.---.--- $ ssh X mtc16xx@192.168.---.---

More information

Chapter-3. Introduction to Unix: Fundamental Commands

Chapter-3. Introduction to Unix: Fundamental Commands Chapter-3 Introduction to Unix: Fundamental Commands What You Will Learn The fundamental commands of the Unix operating system. Everything told for Unix here is applicable to the Linux operating system

More information

Introduction to Linux

Introduction to Linux Introduction to Linux M Tech CS I 2015-16 Arijit Bishnu Debapriyo Majumdar Sourav Sengupta Mandar Mitra Login, Logout, Change password $ ssh, ssh X secure shell $ ssh www.isical.ac.in $ ssh 192.168 $ logout,

More information

Files and Directories

Files and Directories CSCI 2132: Software Development Files and Directories Norbert Zeh Faculty of Computer Science Dalhousie University Winter 2019 Files and Directories Much of the operation of Unix and programs running on

More information

On successful completion of the course, the students will be able to attain CO: Experiment linked. 2 to 4. 5 to 8. 9 to 12.

On successful completion of the course, the students will be able to attain CO: Experiment linked. 2 to 4. 5 to 8. 9 to 12. CIE- 25 Marks Government of Karnataka Department of Technical Education Bengaluru Course Title: Linux Lab Scheme (L:T:P) : 0:2:4 Total Contact Hours: 78 Type of Course: Tutorial, Practical s & Student

More information

Files

Files http://www.cs.fsu.edu/~langley/cop3353-2013-1/reveal.js-2013-02-11/02.html?print-pdf 02/11/2013 10:55 AM Files A normal "flat" file is a collection of information. It's usually stored somewhere reasonably

More information

CSE 303 Lecture 2. Introduction to bash shell. read Linux Pocket Guide pp , 58-59, 60, 65-70, 71-72, 77-80

CSE 303 Lecture 2. Introduction to bash shell. read Linux Pocket Guide pp , 58-59, 60, 65-70, 71-72, 77-80 CSE 303 Lecture 2 Introduction to bash shell read Linux Pocket Guide pp. 37-46, 58-59, 60, 65-70, 71-72, 77-80 slides created by Marty Stepp http://www.cs.washington.edu/303/ 1 Unix file system structure

More information

Introduction to Unix: Fundamental Commands

Introduction to Unix: Fundamental Commands Introduction to Unix: Fundamental Commands Ricky Patterson UVA Library Based on slides from Turgut Yilmaz Istanbul Teknik University 1 What We Will Learn The fundamental commands of the Unix operating

More information

CSC209. Software Tools and Systems Programming. https://mcs.utm.utoronto.ca/~209

CSC209. Software Tools and Systems Programming. https://mcs.utm.utoronto.ca/~209 CSC209 Software Tools and Systems Programming https://mcs.utm.utoronto.ca/~209 What is this Course About? Software Tools Using them Building them Systems Programming Quirks of C The file system System

More information

EECS2301. Lab 1 Winter 2016

EECS2301. Lab 1 Winter 2016 EECS2301 Lab 1 Winter 2016 Lab Objectives In this lab, you will be introduced to the Linux operating system. The basic commands will be presented in this lab. By the end of you alb, you will be asked to

More information

A Brief Introduction to Unix

A Brief Introduction to Unix A Brief Introduction to Unix Sean Barag Drexel University March 30, 2011 Sean Barag (Drexel University) CS 265 - A Brief Introduction to Unix March 30, 2011 1 / 17 Outline 1 Directories

More information

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

Unix as a Platform Exercises. Course Code: OS-01-UNXPLAT Unix as a Platform Exercises Course Code: OS-01-UNXPLAT Working with Unix 1. Use the on-line manual page to determine the option for cat, which causes nonprintable characters to be displayed. Run the command

More information

UNIX File Hierarchy: Structure and Commands

UNIX File Hierarchy: Structure and Commands UNIX File Hierarchy: Structure and Commands The UNIX operating system organizes files into a tree structure with a root named by the character /. An example of the directory tree is shown below. / bin

More information

CS246 Spring14 Programming Paradigm Notes on Linux

CS246 Spring14 Programming Paradigm Notes on Linux 1 Unix History 1965: Researchers from Bell Labs and other organizations begin work on Multics, a state-of-the-art interactive, multi-user operating system. 1969: Bell Labs researchers, losing hope for

More information

Consider the following program.

Consider the following program. Consider the following program. #include int do_sth (char *s); main(){ char arr [] = "We are the World"; printf ("%d\n", do_sth(arr)); } int do_sth(char *s) { char *p = s; while ( *s++!= \0 )

More information

Commands are in black

Commands are in black Starting From the Shell Prompt (Terminal) Commands are in black / +--------+---------+-------+---------+---------+------ +------ +------ +------ +------ +------ +-- Bin boot dev etc home media sbin bin

More information

Practical Session 0 Introduction to Linux

Practical Session 0 Introduction to Linux School of Computer Science and Software Engineering Clayton Campus, Monash University CSE2303 and CSE2304 Semester I, 2001 Practical Session 0 Introduction to Linux Novell accounts. Every Monash student

More information

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

Unix/Linux Basics. Cpt S 223, Fall 2007 Copyright: Washington State University Unix/Linux Basics 1 Some basics to remember Everything is case sensitive Eg., you can have two different files of the same name but different case in the same folder Console-driven (same as terminal )

More information

2) clear :- It clears the terminal screen. Syntax :- clear

2) clear :- It clears the terminal screen. Syntax :- clear 1) cal :- Displays a calendar Syntax:- cal [options] [ month ] [year] cal displays a simple calendar. If arguments are not specified, the current month is displayed. In addition to cal, the ncal command

More information

CSCI 2132 Software Development. Lecture 4: Files and Directories

CSCI 2132 Software Development. Lecture 4: Files and Directories CSCI 2132 Software Development Lecture 4: Files and Directories Instructor: Vlado Keselj Faculty of Computer Science Dalhousie University 12-Sep-2018 (4) CSCI 2132 1 Previous Lecture Some hardware concepts

More information

Introduction to Linux Basics

Introduction to Linux Basics Introduction to Linux Basics Part-I Georgia Advanced Computing Resource Center University of Georgia Zhuofei Hou, HPC Trainer zhuofei@uga.edu Outline What is GACRC? What is Linux? Linux Command, Shell

More information

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

Lecture 3. Unix. Question? b. The world s best restaurant. c. Being in the top three happiest countries in the world. Lecture 3 Unix Question? Denmark is famous for? a. LEGO. b. The world s best restaurant. c. Being in the top three happiest countries in the world. d. Having the highest taxes in Europe (57%). e. All of

More information

Crash Course in Unix. For more info check out the Unix man pages -orhttp://www.cs.rpi.edu/~hollingd/unix. -or- Unix in a Nutshell (an O Reilly book).

Crash Course in Unix. For more info check out the Unix man pages -orhttp://www.cs.rpi.edu/~hollingd/unix. -or- Unix in a Nutshell (an O Reilly book). Crash Course in Unix For more info check out the Unix man pages -orhttp://www.cs.rpi.edu/~hollingd/unix -or- Unix in a Nutshell (an O Reilly book). 1 Unix Accounts To access a Unix system you need to have

More information

Practical 02. Bash & shell scripting

Practical 02. Bash & shell scripting Practical 02 Bash & shell scripting 1 imac lab login: maclab password: 10khem 1.use the Finder to visually browse the file system (single click opens) 2.find the /Applications folder 3.open the Utilities

More information

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

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 1. Which symbol will be used with grep command to match the pattern pat at the beginning of a line? A) ^pat B) $pat C) pat$ D) pat^ 2. Which command is used to sort the lines of data in a file in reverse

More information

QUESTION BANK ON UNIX & SHELL PROGRAMMING-502 (CORE PAPER-2)

QUESTION BANK ON UNIX & SHELL PROGRAMMING-502 (CORE PAPER-2) BANK ON & SHELL PROGRAMMING-502 (CORE PAPER-2) TOPIC 1: VI-EDITOR MARKS YEAR 1. Explain set command of vi editor 2 2011oct 2. Explain the modes of vi editor. 7 2013mar/ 2013 oct 3. Explain vi editor 5

More information

CSE 390a Lecture 2. Exploring Shell Commands, Streams, and Redirection

CSE 390a Lecture 2. Exploring Shell Commands, Streams, and Redirection 1 CSE 390a Lecture 2 Exploring Shell Commands, Streams, and Redirection slides created by Marty Stepp, modified by Jessica Miller & Ruth Anderson http://www.cs.washington.edu/390a/ 2 Lecture summary Unix

More information

Introduction to UNIX. Introduction. Processes. ps command. The File System. Directory Structure. UNIX is an operating system (OS).

Introduction to UNIX. Introduction. Processes. ps command. The File System. Directory Structure. UNIX is an operating system (OS). Introduction Introduction to UNIX CSE 2031 Fall 2012 UNIX is an operating system (OS). Our goals: Learn how to use UNIX OS. Use UNIX tools for developing programs/ software, specifically shell programming.

More information

Introduction to UNIX. CSE 2031 Fall November 5, 2012

Introduction to UNIX. CSE 2031 Fall November 5, 2012 Introduction to UNIX CSE 2031 Fall 2012 November 5, 2012 Introduction UNIX is an operating system (OS). Our goals: Learn how to use UNIX OS. Use UNIX tools for developing programs/ software, specifically

More information

Linux Shell Script. J. K. Mandal

Linux Shell Script. J. K. Mandal Linux Shell Script J. K. Mandal Professor, Department of Computer Science & Engineering, Faculty of Engineering, Technology & Management University of Kalyani Kalyani, Nadia, West Bengal E-mail: jkmandal@klyuniv.ac.in,

More information

Operating Systems. Copyleft 2005, Binnur Kurt

Operating Systems. Copyleft 2005, Binnur Kurt 3 Operating Systems Copyleft 2005, Binnur Kurt Content The concept of an operating system. The internal architecture of an operating system. The architecture of the Linux operating system in more detail.

More information

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

Operating Systems 3. Operating Systems. Content. What is an Operating System? What is an Operating System? Resource Abstraction and Sharing Content 3 Operating Systems The concept of an operating system. The internal architecture of an operating system. The architecture of the Linux operating system in more detail. How to log into (and out

More information

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

Unix as a Platform Exercises + Solutions. Course Code: OS 01 UNXPLAT Unix as a Platform Exercises + Solutions Course Code: OS 01 UNXPLAT Working with Unix Most if not all of these will require some investigation in the man pages. That's the idea, to get them used to looking

More information

The Unix Shell & Shell Scripts

The Unix Shell & Shell Scripts The Unix Shell & Shell Scripts You should do steps 1 to 7 before going to the lab. Use the Linux system you installed in the previous lab. In the lab do step 8, the TA may give you additional exercises

More information

CISC 220 fall 2011, set 1: Linux basics

CISC 220 fall 2011, set 1: Linux basics CISC 220: System-Level Programming instructor: Margaret Lamb e-mail: malamb@cs.queensu.ca office: Goodwin 554 office phone: 533-6059 (internal extension 36059) office hours: Tues/Wed/Thurs 2-3 (this week

More information

Laboratory 1 Semester 1 11/12

Laboratory 1 Semester 1 11/12 CS2106 National University of Singapore School of Computing Laboratory 1 Semester 1 11/12 MATRICULATION NUMBER: In this lab exercise, you will get familiarize with some basic UNIX commands, editing and

More information

Unix Tools / Command Line

Unix Tools / Command Line Unix Tools / Command Line An Intro 1 Basic Commands / Utilities I expect you already know most of these: ls list directories common options: -l, -F, -a mkdir, rmdir make or remove a directory mv move/rename

More information

Perl and R Scripting for Biologists

Perl and R Scripting for Biologists Perl and R Scripting for Biologists Lukas Mueller PLBR 4092 Course overview Linux basics (today) Linux advanced (Aure, next week) Why Linux? Free open source operating system based on UNIX specifications

More information

Week 2 Lecture 3. Unix

Week 2 Lecture 3. Unix Lecture 3 Unix Terminal and Shell 2 Terminal Prompt Command Argument Result 3 Shell Intro A system program that allows a user to execute: shell functions (e.g., ls -la) other programs (e.g., eclipse) shell

More information

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

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 More Linux Commands 1 wc The Linux command for acquiring size statistics on a file is wc. This command provides the line count, word count and number of bytes in a file. Open up a terminal, make sure you

More information

EECS 2031E. Software Tools Prof. Mokhtar Aboelaze

EECS 2031E. Software Tools Prof. Mokhtar Aboelaze EECS 2031 Software Tools Prof. Mokhtar Aboelaze Footer Text 1 EECS 2031E Instructor: Mokhtar Aboelaze Room 2026 CSEB lastname@cse.yorku.ca x40607 Office hours TTH 12:00-3:00 or by appointment 1 Grading

More information

18-Sep CSCI 2132 Software Development Lecture 6: Links and Inodes. Faculty of Computer Science, Dalhousie University. Lecture 6 p.

18-Sep CSCI 2132 Software Development Lecture 6: Links and Inodes. Faculty of Computer Science, Dalhousie University. Lecture 6 p. Lecture 6 p.1 Faculty of Computer Science, Dalhousie University CSCI 2132 Software Development Lecture 6: Links and s 18-Sep-2017 Location: Goldberg CS 127 Time: 14:35 15:25 Instructor: Vlado Keselj Previous

More information

CSE 390a Lecture 2. Exploring Shell Commands, Streams, Redirection, and Processes

CSE 390a Lecture 2. Exploring Shell Commands, Streams, Redirection, and Processes CSE 390a Lecture 2 Exploring Shell Commands, Streams, Redirection, and Processes slides created by Marty Stepp, modified by Jessica Miller & Ruth Anderson http://www.cs.washington.edu/390a/ 1 2 Lecture

More information

Introduction to UNIX command-line

Introduction to UNIX command-line Introduction to UNIX command-line Boyce Thompson Institute March 17, 2015 Lukas Mueller & Noe Fernandez Class Content Terminal file system navigation Wildcards, shortcuts and special characters File permissions

More information

CSC209H Lecture 1. Dan Zingaro. January 7, 2015

CSC209H Lecture 1. Dan Zingaro. January 7, 2015 CSC209H Lecture 1 Dan Zingaro January 7, 2015 Welcome! Welcome to CSC209 Comments or questions during class? Let me know! Topics: shell and Unix, pipes and filters, C programming, processes, system calls,

More information

CHAPTER 1 UNIX FOR NONPROGRAMMERS

CHAPTER 1 UNIX FOR NONPROGRAMMERS CHAPTER 1 UNIX FOR NONPROGRAMMERS The man command is used to display the manual entry associated with word entered as argument. The -k option is used displays a list of manual entries that contain entered

More information

A Brief Introduction to the Linux Shell for Data Science

A Brief Introduction to the Linux Shell for Data Science A Brief Introduction to the Linux Shell for Data Science Aris Anagnostopoulos 1 Introduction Here we will see a brief introduction of the Linux command line or shell as it is called. Linux is a Unix-like

More information

5/20/2007. Touring Essential Programs

5/20/2007. Touring Essential Programs Touring Essential Programs Employing fundamental utilities. Managing input and output. Using special characters in the command-line. Managing user environment. Surveying elements of a functioning system.

More information

Unix Filesystem. January 26 th, 2004 Class Meeting 2

Unix Filesystem. January 26 th, 2004 Class Meeting 2 Unix Filesystem January 26 th, 2004 Class Meeting 2 * Notes adapted by Christian Allgood from previous work by other members of the CS faculty at Virginia Tech Unix Filesystem! The filesystem is your interface

More information

Linux & Shell Programming 2014

Linux & Shell Programming 2014 Practical No : 1 Enrollment No: Group : A Practical Problem Write a date command to display date in following format: (Consider current date as 4 th January 2014) 1. dd/mm/yy hh:mm:ss 2. Today's date is:

More information

Unix Handouts. Shantanu N Kulkarni

Unix Handouts. Shantanu N Kulkarni Unix Handouts Shantanu N Kulkarni Abstract These handouts are meant to be used as a study aid during my class. They are neither complete nor sincerely accurate. The idea is that the participants should

More information

Introduction to UNIX command-line II

Introduction to UNIX command-line II Introduction to UNIX command-line II Boyce Thompson Institute 2017 Prashant Hosmani Class Content Terminal file system navigation Wildcards, shortcuts and special characters File permissions Compression

More information

This lab exercise is to be submitted at the end of the lab session! passwd [That is the command to change your current password to a new one]

This lab exercise is to be submitted at the end of the lab session! passwd [That is the command to change your current password to a new one] Data and Computer Security (CMPD414) Lab II Topics: secure login, moving into HOME-directory, navigation on Unix, basic commands for vi, Message Digest This lab exercise is to be submitted at the end of

More information

CS Fundamentals of Programming II Fall Very Basic UNIX

CS Fundamentals of Programming II Fall Very Basic UNIX CS 215 - Fundamentals of Programming II Fall 2012 - Very Basic UNIX This handout very briefly describes how to use Unix and how to use the Linux server and client machines in the CS (Project) Lab (KC-265)

More information

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

Introduction to Linux. Woo-Yeong Jeong Computer Systems Laboratory Sungkyunkwan University Introduction to Linux Woo-Yeong Jeong (wooyeong@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu What is Linux? A Unix-like operating system of a computer What is an

More information

Introduction to the Linux Command Line

Introduction to the Linux Command Line Introduction to the Linux Command Line May, 2015 How to Connect (securely) ssh sftp scp Basic Unix or Linux Commands Files & directories Environment variables Not necessarily in this order.? Getting Connected

More information

Introduction: What is Unix?

Introduction: What is Unix? Introduction Introduction: What is Unix? An operating system Developed at AT&T Bell Labs in the 1960 s Command Line Interpreter GUIs (Window systems) are now available Introduction: Unix vs. Linux Unix

More information

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 File System. Class Meeting 2. * Notes adapted by Joy Mukherjee from previous work by other members of the CS faculty at Virginia Tech 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 File System The file system is your interface to: physical

More information

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

The UNIX Shells. Computer Center, CS, NCTU. How shell works. Unix shells. Fetch command Analyze Execute Shells The UNIX Shells How shell works Fetch command Analyze Execute Unix shells Shell Originator System Name Prompt Bourne Shell S. R. Bourne /bin/sh $ Csh Bill Joy /bin/csh % Tcsh Ken Greer /bin/tcsh

More information

CENG 334 Computer Networks. Laboratory I Linux Tutorial

CENG 334 Computer Networks. Laboratory I Linux Tutorial CENG 334 Computer Networks Laboratory I Linux Tutorial Contents 1. Logging In and Starting Session 2. Using Commands 1. Basic Commands 2. Working With Files and Directories 3. Permission Bits 3. Introduction

More information

File permission u owner of file/directory (user) g group of the file/directory o other a all

File permission u owner of file/directory (user) g group of the file/directory o other a all File permission u owner of file/directory (user) g group of the file/directory o other a all Permission Types: permission octal value Meaning Read (r) 4 The file can is read only, for directory it's contain

More information

The Unix Shell. Pipes and Filters

The Unix Shell. Pipes and Filters The Unix Shell Copyright Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See http://software-carpentry.org/license.html for more information. shell shell pwd

More information

The Unix Shell. Permissions

The Unix Shell. Permissions The Unix Shell Copyright Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See http://software-carpentry.org/license.html for more information. shell shell pwd,

More information

GNU/Linux 101. Casey McLaughlin. Research Computing Center Spring Workshop Series 2018

GNU/Linux 101. Casey McLaughlin. Research Computing Center Spring Workshop Series 2018 GNU/Linux 101 Casey McLaughlin Research Computing Center Spring Workshop Series 2018 rccworkshop IC;3df4mu bash-2.1~# man workshop Linux101 RCC Workshop L101 OBJECTIVES - Operating system concepts - Linux

More information

PESIT Bangalore South Campus

PESIT Bangalore South Campus INTERNAL ASSESSMENT TEST - 2 Date : 20/09/2016 Max Marks : 0 Subject & Code : Unix Shell Programming (15CS36) Section : 3 rd Sem ISE/CSE Name of faculty : Prof Ajoy Time : 11:30am to 1:00pm SOLUTIONS 1

More information

UNIX files searching, and other interrogation techniques

UNIX files searching, and other interrogation techniques UNIX files searching, and other interrogation techniques Ways to examine the contents of files. How to find files when you don't know how their exact location. Ways of searching files for text patterns.

More information

5/8/2012. Exploring Utilities Chapter 5

5/8/2012. Exploring Utilities Chapter 5 Exploring Utilities Chapter 5 Examining the contents of files. Working with the cut and paste feature. Formatting output with the column utility. Searching for lines containing a target string with grep.

More information

CST8207: GNU/Linux Operating Systems I Lab Six Linux File System Permissions. Linux File System Permissions (modes) - Part 1

CST8207: GNU/Linux Operating Systems I Lab Six Linux File System Permissions. Linux File System Permissions (modes) - Part 1 Student Name: Lab Section: Linux File System Permissions (modes) - Part 1 Due Date - Upload to Blackboard by 8:30am Monday March 12, 2012 Submit the completed lab to Blackboard following the Rules for

More information

Welcome to Linux. Lecture 1.1

Welcome to Linux. Lecture 1.1 Welcome to Linux Lecture 1.1 Some history 1969 - the Unix operating system by Ken Thompson and Dennis Ritchie Unix became widely adopted by academics and businesses 1977 - the Berkeley Software Distribution

More information

CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX

CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX This handout very briefly describes how to use Unix and how to use the Linux server and client machines in the EECS labs that dual boot

More information

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

3/8/2017. Unix/Linux Introduction. In this part, we introduce. What does an OS do? Examples EECS2301 Title Unix/Linux Introduction These slides are based on slides by Prof. Wolfgang Stuerzlinger at York University Warning: These notes are not complete, it is a Skelton that will be modified/add-to

More information

Introduction to Linux

Introduction to Linux Introduction to Linux January 2011 Don Bahls User Consultant (Group Leader) bahls@arsc.edu (907) 450-8674 Overview The shell Common Commands File System Organization Permissions Environment Variables I/O

More information

UNIX. Contents. Overview of UNIX Structures File systems

UNIX. Contents. Overview of UNIX Structures File systems UNIX Contents Overview of UNIX Structures File systems o Pathname o Security Process: o Exit code o IPC: Pipes Shells UNIX Philosophy UNIX s H11istory. Utilities/commands Basic: cp, rm, mkdir, mv, file,

More information

Unix Guide. Meher Krishna Patel. Created on : Octorber, 2017 Last updated : December, More documents are freely available at PythonDSP

Unix Guide. Meher Krishna Patel. Created on : Octorber, 2017 Last updated : December, More documents are freely available at PythonDSP Unix Guide Meher Krishna Patel Created on : Octorber, 2017 Last updated : December, 2017 More documents are freely available at PythonDSP Table of contents Table of contents i 1 Unix commands 1 1.1 Unix

More information

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

Shell. SSE2034: System Software Experiment 3, Fall 2018, Jinkyu Jeong Shell Prof. Jinkyu Jeong (Jinkyu@skku.edu) TA -- Minwoo Ahn (minwoo.ahn@csl.skku.edu) TA -- Donghyun Kim (donghyun.kim@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu

More information

Introduction to Linux

Introduction to Linux Introduction to Linux Prof. Jin-Soo Kim( jinsookim@skku.edu) TA - Dong-Yun Lee (dylee@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu What is Linux? A Unix-like operating

More information

Unix Introduction to UNIX

Unix Introduction to UNIX Unix Introduction to UNIX Get Started Introduction The UNIX operating system Set of programs that act as a link between the computer and the user. Developed in 1969 by a group of AT&T employees Various

More information

Mills HPC Tutorial Series. Linux Basics I

Mills HPC Tutorial Series. Linux Basics I Mills HPC Tutorial Series Linux Basics I Objectives Command Line Window Anatomy Command Structure Command Examples Help Files and Directories Permissions Wildcards and Home (~) Redirection and Pipe Create

More information

commandname flags arguments

commandname flags arguments Unix Review, additional Unix commands CS101, Mock Introduction This handout/lecture reviews some basic UNIX commands that you should know how to use. A more detailed description of this and other commands

More information

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

CSN08101 Digital Forensics. Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak CSN08101 Digital Forensics Lecture 2: Essential Linux for Forensics Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak Essential Linux for Forensics You will learn in this lecture: Essential

More information

Computer Systems and Architecture

Computer Systems and Architecture Computer Systems and Architecture Introduction to UNIX Stephen Pauwels University of Antwerp October 2, 2015 Outline What is Unix? Getting started Streams Exercises UNIX Operating system Servers, desktops,

More information

Lab #2 Physics 91SI Spring 2013

Lab #2 Physics 91SI Spring 2013 Lab #2 Physics 91SI Spring 2013 Objective: Some more experience with advanced UNIX concepts, such as redirecting and piping. You will also explore the usefulness of Mercurial version control and how to

More information

Exercise Sheet 2. (Classifications of Operating Systems)

Exercise Sheet 2. (Classifications of Operating Systems) Exercise Sheet 2 Exercise 1 (Classifications of Operating Systems) 1. At any given moment, only a single program can be executed. What is the technical term for this operation mode? 2. What are half multi-user

More information

Unix Internal Assessment-2 solution. Ans:There are two ways of starting a job in the background with the shell s & operator and the nohup command.

Unix Internal Assessment-2 solution. Ans:There are two ways of starting a job in the background with the shell s & operator and the nohup command. Unix Internal Assessment-2 solution 1 a.explain the mechanism of process creation. Ans: There are three distinct phases in the creation of a process and uses three important system calls viz., fork, exec,

More information

Find out where you currently are in the path Change directories to be at the root of your home directory (/home/username) cd ~

Find out where you currently are in the path Change directories to be at the root of your home directory (/home/username) cd ~ CIS 105 Working with directories You have using directories in a Windows environment extensively. Often in Windows we are calling them folders. They are important in order to organize our files. It is

More information

Working with Basic Linux. Daniel Balagué

Working with Basic Linux. Daniel Balagué Working with Basic Linux Daniel Balagué How Linux Works? Everything in Linux is either a file or a process. A process is an executing program identified with a PID number. It runs in short or long duration

More information

Introduction to Linux

Introduction to Linux Introduction to Linux Prof. Jin-Soo Kim( jinsookim@skku.edu) TA - Kisik Jeong (kisik@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu What is Linux? A Unix-like operating

More information

The input can also be taken from a file and similarly the output can be redirected to another file.

The input can also be taken from a file and similarly the output can be redirected to another file. Filter A filter is defined as a special program, which takes input from standard input device and sends output to standard output device. The input can also be taken from a file and similarly the output

More information

SECTION -C. Getting Started with UNIX

SECTION -C. Getting Started with UNIX Lecture 15 SECTION -C Getting Started with UNIX Introduction Changing permission modes Absolute & Relative Permissions Changing file permissions : chmod A file or directory is created with a default set

More information

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

Read the relevant material in Sobell! If you want to follow along with the examples that follow, and you do, open a Linux terminal. Warnings 1 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. Read the relevant material in Sobell! If

More information

Outline. Structure of a UNIX command

Outline. Structure of a UNIX command Outline Structure of Unix Commands Command help (man) Log on (terminal vs. graphical) System information (utility) File and directory structure (path) Permission (owner, group, rwx) File and directory

More information

Open up a terminal, make sure you are in your home directory, and run the command.

Open up a terminal, make sure you are in your home directory, and run the command. More Linux Commands 0.1 wc The Linux command for acquiring size statistics on a file is wc. This command can provide information from line count, to bytes in a file. Open up a terminal, make sure you are

More information

Unix Basics. UNIX Introduction. Lecture 14

Unix Basics. UNIX Introduction. Lecture 14 Unix Basics Lecture 14 UNIX Introduction The UNIX operating system is made up of three parts; the kernel, the shell and the programs. The kernel of UNIX is the hub of the operating system: it allocates

More information

CENG393 Computer Networks Labwork 1

CENG393 Computer Networks Labwork 1 CENG393 Computer Networks Labwork 1 Linux is the common name given to a large family of operating systems. All Linux-based operating systems are essentially a large set of computer software that are bound

More information

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

S E C T I O N O V E R V I E W FILES AND DIRECTORIES: ADVANCED CONCEPTS S E C T I O N O V E R V I E W In this section, we will learn about: understanding soft (symbolic) links; understanding hard links; working with soft and hard links;

More information

Introduc)on to Linux Session 2 Files/Filesystems/Data. Pete Ruprecht Research Compu)ng Group University of Colorado Boulder

Introduc)on to Linux Session 2 Files/Filesystems/Data. Pete Ruprecht Research Compu)ng Group University of Colorado Boulder Introduc)on to Linux Session 2 Files/Filesystems/Data Pete Ruprecht Research Compu)ng Group University of Colorado Boulder www.rc.colorado.edu Outline LeHover from last week redirec)on Filesystem layout

More information

Introduction to Linux Workshop 1

Introduction to Linux Workshop 1 Introduction to Linux Workshop 1 The George Washington University SEAS Computing Facility Created by Jason Hurlburt, Hadi Mohammadi, Marco Suarez hurlburj@gwu.edu Logging In The lab computers will authenticate

More information

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

Introduction to UNIX. Introduction EECS l UNIX is an operating system (OS). l Our goals: Introduction to UNIX EECS 2031 13 November 2017 Introduction l UNIX is an operating system (OS). l Our goals: Learn how to use UNIX OS. Use UNIX tools for developing programs/ software, specifically shell

More information