LAB 8 (Aug 4/5) Unix Utilities
|
|
- Nicholas Lawrence
- 5 years ago
- Views:
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. your_command xxx 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. your_command xfile2 xfile3 5. Rename file xxx to xfile1 6. Verify that the renaming is successful. your_command xfile1 xfile2 xfile3 7. Create a sub-directory named lab8a under the current (home) directory 7. mkdir lab8a 1. cp /cs/dept/course/ /s/2031/xxx. 2. ls xxx 3. cp /cs/dept/course/ /s/2031/xfile2 cs/dept/ /2031/xFile3. or cp /cs/dept/course/ /s/2031/xfile?. or cp /cs/dept/course/ /s/2031/xfile*. 4. ls xfile2 xfile3 or ls xfile* or ls xfile? 5. mv xxx xfile1 6. ls xfile1 xfile2 xfile3 or ls xfile* or ls xfile? 1
2 8. Verify the existence of directory lab8a by listing the directory itself. your_command drwx your_name ugrad 4096 Jul 31 17:00 lab8a (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 13. Verify that the two directory are identical lab8a: xfile1 xfile2 xfile3 8. ls -ld lab8a or ls -ld./lab8a 9. mv xfile1 xfile2 xfile3 lab8a or mv xfile? lab8a or mv xfile* lab8a 10. ls -l lab8a 11. cp r lab8a lab8b 12. ls ld lab8a lab8b or ls ld lab8? or ls -ld lab8* 13. ls lab8a lab8b or ls lab8? or ls lab8* lab8b: xfile1 xfile2 xfile3 14. Remove the whole directory lab8a using rmdir. What happened? 15. Remove the whole directory lab8a using a more effective utility. 16. Verify that directory lab8a has been removed ls: cannot access lab8a: No such file or directory 17. Move file1 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 find. name xfile*./xfile1./lab8b/xfile2./lab8b/xfile3 or 14. rmdir lab8a rmdir: failed to remove `lab8a/': Directory not empty 15. rm-r lab8a 16. ls lab8a or ls ld lab8 or ls l lab8 18. find. name xfile* find. name xfile? 17. mv lab8b/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 mv lab8b lab8working 20. ls lab8b or ls -l lab8b or ls ld lab8b 22. pwd 21. cd lab8working or cd./lab8working 24. ls -l 23. mv../xfile more xfile1 xfile2 xfile3 or more xfile? or more xfile* 26. wc -l xfile1 or more xfile1 wc l or cat xfile1 wc -l 27. Display the first line of xfile1 27. head -1 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). 28. head -2 xfile2 29. tail -3 xfile2 30. cmp xfile1 xfile2 31. diff xfile1 xfile2 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. 32. cmp xfile2 xfile3 33. diff xfile2 xfile3 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 xfile cat xfile1 xfile2 xfile3 > xfile3 cat xfile3 or more xfile3 3
4 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 35. sort xfile123 or cat xfile123 sort 36. sort xfile123 uniq c or cat xfile123 sort uniq -c 37. sort xfile123 uniq > xfile123compact or cat xfile123 sort uniq > xfile123compact 38. cat xfile123compact or more 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? 39. -rwxrwxr-x 40. -rwxrwxrwx 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 41. chmod 744 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 42.chmod g+x 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 not do chmod only once. Then show the result: 43. chmod g+w,u-w xfile123compact 44. chmod g-w,o+x xfile123compact rwxrwxrwx 1 yourname yourgroup 140 Jul 31 17:23 xfile123compact 45. chmod a+w xfile123compact or chmod ugo+w 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 52. file hello.c 53. Try to get the type of one of your a.out files. 46. echo this is a xxx new line >> xfile1 47. ls l t or ls -lt 48. ls l t -r or ls -ltr 49. ls l S or ls -ls 50. ls l S -r or ls -lsr 51. file xfile123compact a.out: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux , not stripped 53. file a.out 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 54. ls l xfile123compact 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 ln xfile123compact hardlink ls -l 57. rm 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 xfile ls -l -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: egrep v xxx xfile1 > tmp 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 59. Reverse egrep to filter out the line containing xxx, and write the result to a tmp file. Finally rename tmp to xfile1 (overwrite xfile1) 60. sort n k3 xfile123compact or cat xfile123compact sort n k3 or sort n +2-3 xfile123compact or cat xfile123compact sort n
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. Your 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. 61. sort n k3 -r xfile123compact or cat xfile123compact sort n k3 -r 62. sort n k3 k4 xfile123compact or cat xfile123compact sort n k3 k4 63. sort n k6 xfile123compact or cat xfile123compact sort n k6 64. sort n k6 r xfile123compact or cat xfile123compact sort n k6 -r 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 cut d f 1 xfile123compact or cat xfile123compact cut d f cut d f 5,6 xfile123compact or cat xfile123compact cut d f 5,6 7
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 cut d f 1,5,6 xfile123compact sort M k2 or cat xfile123compact cut d f 1,5,6 sort M k2 68. tr [a-z] [A-Z] < xfile123compact 69. tr [0-9] + < xfile123compact or tr [:digit:] + < xfile123compact 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 70. egrep 195.$ xfile123compact 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 egrep 195.$ xfile123compact wc -l 72. 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 wc l /etc/passwd or cat /etc/passwd wc l 73. 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. 73. egrep huiwang /etc/passwd or cat /etc/passwd egrep huiwang 8
9 74. wc -l /cs/dept/course/ /s/2031/2031cl or cat /cs/ /2031cl wc -l 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. 75. egrep yourname 2031cl or cat 2031cl egrep yourname 76. Look for the student(s) whose name contain Wang. 76. egrep Wang 2031cl or cat 2031cl egrep 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. 77. cat 2031cl egrep Wang wc -l 79. Pipe egrep and another utility to get the number of students whose name contain Wang or Wong. You should get egrep W[ao]ng 2031cl or cat 2031cl egrep W[ao]ng 79. egrep W[ao]ng 2031cl wc l or cat 2031cl egrep W[ao]ng wc -l 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 80. egrep v the lyrics or cat lyrics egrep v the 81. egrep [0-9] lyrics or cat lyrics egrep [0-9] 82. egrep 1980 lyrics or cat lyrics egrep egrep 1980$ lyrics or cat lyrics egrep 1980$ 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 84. egrep sea lyrics or cat lyrics egrep sea 85. egrep ^sea lyrics or cat lyrics egrep ^sea Say all your prayers and then, Oh you sleepy young 1970 heads dream of wonderful things, 86. egrep.nd lyrics or cat lyrics egrep.nd 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, 87. egrep w.nd lyrics or cat lyrics egrep w.nd 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 Submission find. -name xfile* -exec mv {} {}.2015 \; 88. egrep ^.nd lyrics or cat lyrics egrep ^.nd What we intend to do here? List directory lab8working and examine what happens to the files in lab8working? Note: all egrep can be replaced with grep -E 89. egrep [ABCD] lyrics or cat lyrics egrep [ABCD] or egrep [A-D] lyrics or cat lyrics egrep [A-D] Print out this pdf, write your solutions on this sheet. Hand in the sheet in next class. 90. egrep ^[A-Z] lyrics or cat lyrics egrep ^[A-Z] 91. egrep ^[^A-Z] lyrics or cat lyrics egrep ^[^A-Z] 92. egrep a.$ lyrics or cat lyrics egrep a.$ 93. egrep [abc]nd lyrics or cat lyrics egrep [abc]nd or egrep [a-c]nd lyrics or cat lyrics egrep [a-c]nd 94. egrep [^abc]nd lyrics or cat lyrics egrep [^abc]nd or egrep [^a-c]nd lyrics or cat lyrics egrep [^a-c]nd Or, write the question numbers and your answers in a file, and submit the file submit lab8 your_file_name 95. find. -name "xfile*"./lab8working/xfile123./lab8working/xfile2./lab8working/xfile123compact./lab8working/xfile1./lab8working/xfile3 96. Find all the files whose name begins with xfile, and change name of them. Each new name now has a.2015 suffix. End of lab8 10
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 informationTable 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 informationLinux 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 informationIntroduction 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 informationFiles 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 informationChapter-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 informationA 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 informationCSE 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 informationFiles
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 informationOn 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 informationCS246 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 informationUnix/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 informationWeek 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 informationIntroduction 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 informationCSCI 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 information2) 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 informationUnix 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 informationCSC209. 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 informationUNIX 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 informationCSE 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 informationCommands are in black
Starting From the Shell Prompt (Terminal) Commands are in black / +--------+---------+-------+---------+---------+------ +------ +------ +------ +------ +------ +-- Bin boot dev etc home media sbin bin
More informationPractical 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 informationIntroduction 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 informationConsider 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 informationLinux 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 informationEECS 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 informationIntroduction 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 informationIntroduction 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 informationOperating 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 informationCISC 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 informationEECS2301. 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 informationOperating 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 informationLaboratory 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 informationUnix 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 informationUnix 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 information1. 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 informationCSE 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 informationThe 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 informationLecture 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 informationPractical 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 informationCHAPTER 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 informationThe 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 informationCS 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 informationQUESTION 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 informationUnix 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 informationIntroduction 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 information3/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 informationCrash 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 informationThis 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 informationUnix 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 informationIntroduction 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 informationCSC209H 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 informationPerl 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 informationCENG 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 informationSet 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 informationUNIX. 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 information18-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 informationCommon File System Commands
Common File System Commands ls! List names of all files in current directory ls filenames! List only the named files ls -t! List in time order, most recent first ls -l! Long listing, more information.
More informationIntroduction 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 informationCS 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 informationUnix 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 informationThe 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 informationUnix 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 informationA 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 informationIntroduction: 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 information5/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 informationFile 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 informationIntroduction 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 informationCENG393 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 information5/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 informationContents. Note: pay attention to where you are. Note: Plaintext version. Note: pay attention to where you are... 1 Note: Plaintext version...
Contents Note: pay attention to where you are........................................... 1 Note: Plaintext version................................................... 1 Hello World of the Bash shell 2 Accessing
More informationCS 307: UNIX PROGRAMMING ENVIRONMENT KATAS FOR EXAM 2
CS 307: UNIX PROGRAMMING ENVIRONMENT KATAS FOR EXAM 2 Prof. Michael J. Reale Fall 2014 COMMAND KATA 7: VARIABLES Command Kata 7: Preparation First, go to ~/cs307 cd ~/cs307 Make directory dkata7 and go
More informationOpen 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 informationThe 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 informationShell. 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 informationPESIT 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 informationCST8207: 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 informationIntroduction to Linux. Roman Cheplyaka
Introduction to Linux Roman Cheplyaka Generic commands, files, directories What am I running? ngsuser@ubuntu:~$ cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=16.04 DISTRIB_CODENAME=xenial DISTRIB_DESCRIPTION="Ubuntu
More informationGNU/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 informationMills 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 informationIntroduction to Linux
Introduction to Linux Mukesh Pund Principal Scientist, NISCAIR, New Delhi, India History In 1969, a team of developers developed a new operating system called Unix which was written using C Linus Torvalds,
More informationAssume 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: ~
Introduction to Open Source Software Development Spring semester, 2017 School of Computer Science and Engineering, Pusan National University Joon-Seok Kim LINUX: COMMANDS Review Lab #1 2 Create Directories
More informationcommandname 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 informationIntroduction 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 informationLinux & 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 informationOpen Source Computational Fluid Dynamics
Open Source Computational Fluid Dynamics An MSc course to gain extended knowledge in Computational Fluid Dynamics (CFD) using open source software. Teachers: Miklós Balogh and Zoltán Hernádi Department
More informationBasic UNIX commands. HORT Lab 2 Instructor: Kranthi Varala
Basic UNIX commands HORT 59000 Lab 2 Instructor: Kranthi Varala Client/Server architecture User1 User2 User3 Server (UNIX/ Web/ Database etc..) User4 High Performance Compute (HPC) cluster User1 Compute
More informationIntroduction to Linux
Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 47 Operating Systems Program running all the time Interfaces between other programs and hardware Provides abstractions
More informationIntroduction 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 informationComputer 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 informationIntroduction to Linux Part 1. Anita Orendt and Wim Cardoen Center for High Performance Computing 24 May 2017
Introduction to Linux Part 1 Anita Orendt and Wim Cardoen Center for High Performance Computing 24 May 2017 ssh Login or Interactive Node kingspeak.chpc.utah.edu Batch queue system kp001 kp002. kpxxx FastX
More informationUsing UNIX. -rwxr--r-- 1 root sys Sep 5 14:15 good_program
Using UNIX. UNIX is mainly a command line interface. This means that you write the commands you want executed. In the beginning that will seem inferior to windows point-and-click, but in the long run the
More informationIntroduction 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 informationIntroduction to the UNIX command line
Introduction to the UNIX command line Steven Abreu Introduction to Computer Science (ICS) Tutorial Jacobs University s.abreu@jacobs-university.de September 19, 2017 Overview What is UNIX? UNIX Shell Commands
More informationIntroduction 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 informationUnix L555. Dept. of Linguistics, Indiana University Fall Unix. Unix. Directories. Files. Useful Commands. Permissions. tar.
L555 Dept. of Linguistics, Indiana University Fall 2010 1 / 21 What is? is an operating system, like DOS or Windows developed in 1969 by Bell Labs works well for single computers as well as for servers
More informationUnix 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 informationGetting your department account
02/11/2013 11:35 AM Getting your department account The instructions are at Creating a CS account 02/11/2013 11:36 AM Getting help Vijay Adusumalli will be in the CS majors lab in the basement of the Love
More informationIntroduction to Linux
Introduction to Linux The command-line interface A command-line interface (CLI) is a type of interface, that is, a way to interact with a computer. Window systems, punched cards or a bunch of dials, buttons
More informationTable Of Contents. 1. Zoo Information a. Logging in b. Transferring files 2. Unix Basics 3. Homework Commands
Table Of Contents 1. Zoo Information a. Logging in b. Transferring files 2. Unix Basics 3. Homework Commands Getting onto the Zoo Type ssh @node.zoo.cs.yale.edu, and enter your netid pass when prompted.
More information