Intensive Programming in Linux with CS288 Course Overview

cs288 n.w
1 / 18
Embed
Share

Explore the comprehensive course overview of CS288 - Intensive Programming in Linux taught by Instructor C.F. Yurkoski. Learn about accessing Linux, quizzes, scoping, PATH variables, essential commands, and practical examples like grep and cut. Dive into hands-on learning with a Bash script assignment to enhance your Linux skills.

  • Linux Programming
  • CS288
  • Bash Scripting
  • Linux Commands
  • Linux Learning

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Cs288 Intensive Programming in Linux Instructor: C F Yurkoski Christopher.f.yurkoski@njit.edu Section web site: https://web.njit.edu/~yurkowsk/cs288.html 6-9-15 1

  2. 6-9-15 2

  3. Linux access ssh to afs5.njit.edu or use putty, etc. 6-9-15 3

  4. Quiz 1 results Not yet available 6-9-15 4

  5. Quiz1 revu 6-9-15 5

  6. Question 1 I => ID => IDD => IDDD => DDDD => 1DDD => 12DD => 123D => 1234 6-9-15 6

  7. Quiz revu cont. 6-9-15 7

  8. scoping 6-9-15 8

  9. Quiz revu 6-9-15 9

  10. PATH variable colon separated list searched in order can include relative paths like . 6-9-15 10

  11. Other commands and misc & ; ! || && cut c -f sort n r grep v I $RANDOM $$ read fc tr diff ls -l 6-9-15 11

  12. Grep examples grep "^am" /etc/passwd grep "^[abc]" /etc/passwd | more grep "^[a-c]" /etc/passwd | more grep "nologin$" /etc/passwd grep "^a.*nologin$" /etc/passwd grep "^a.a.*nologin$" /etc/passwd grep -v "^a.a.*nologin$" /etc/passwd 6-9-15 12

  13. Cut examples cut -c 10-20 /etc/passwd cut -c -10 /etc/passwd cut -c 30- /etc/passwd cut -d ":" -f 5 /etc/passwd cut -d ":" -f 2,5 /etc/passwd cut -d ":" -f 3-5 /etc/passwd 6-9-15 13

  14. problem 1, due this week Write a Bash script, count.sh, which builds a table of counts for the commands under /bin which start with each letter. For example, if there are 3 commands starting with "a" (alsaumute, arch & awk) while there may be 2 commands starting with "z" (zcat & zsh). The first and last lines your script will print would be: a 3 ... ... ... z 2 Hint: use loop and array to design and implement this script. 6-9-15 14

  15. Homework 1 revu ls /bin > /tmp/x letters=(a b c d e f g h i j k l m n o p q r s t u v w x y z) for i in ${letters[*]} do x=0 echo -n "$i " grep "^${i}" /tmp/x | while read file do let x=x+1 echo $x > count done cat count done 6-9-15 15

  16. Problem 2 Write a Bash script, reverse.sh, which reverses the contents of a directory passed as a parameter. For example, assuming /my/dir contains cache cron games lib log run tmp, your program "reverse.sh /my/dir" will return "tmp run log lib games cron cache." Hint: use an array and two functions: main() and reverse(). Do not use the built-in command sort -r. 6-9-15 16

  17. problem 3 Write a Bash script, filter.sh, which prints those files/directories that have the size greater than the average file size of the directory passed as its first argument . Suppose for example that the directory /my/dir has five files/directories with size in parentheses : a (100) b (10) c (100) d (100) e (20), your program "filter.sh /my/dir" will list "a c d" since the size of each of these 3 files is greater than the average file size of 66. Hint: you can use 3 functions to do this: main, average, and filter, where main calls average and filter, and average computes the average file size of a directory and filter filters out those that have less than the average. 6-9-15 17

  18. problem 4 Write a Bash script, insert-sort.sh, which sorts a list of command line parameters in ascending order. For example, your command will look something like: $ insert-sort.sh 7 2 3 9 -1 and type enter. Your program will return: -1 2 3 7 9 Use only basic commands and array. Do not use any built-in commands that sort array. 6-9-15 18

Related


More Related Content