Learn Shell Scripting with US - An Online Workshop In Tamil - from KanchiLUG

Meeting Link: Jitsi Meet

First Meet Schedule: 21 January 2023, 11:00 IST

1 Like

Second Meet Schedule: 28 January 2023, 11:00 IST
Meeting Link: Jitsi Meet

Topic(s):

  • History Of Unix
  • GNU
  • Free and Open Source Software
  • What is GNU/Linux
  • Different flavors of GNU/Linux

Reference:

1 Like

Third Meet Schedule: 4 February 2023, 11:00 IST
Meeting Link: Jitsi Meet

Topic(s):

  • Manual Pages
  • Writing What we Learn
    • Create Own Blog Using WordPress
    • Create Own Blog Using Github Pages with Hugo and Markdown

Reference(s):

1 Like

Fourth Meet Schedule: 11 February 2023, 11:00 IST
Meeting Link: Jitsi Meet

Topic(s):

  • Storage Devices
  • Partitions
  • Real File Systems
  • Pseudo File Systems
  • Unix File System Hierarchy
  • Navigating Unix File System Hierarchy
  • File Permissions

Reference(s):

Fifth Meet Schedule: 18 February 2023, 11:00 IST
Meeting Link: Jitsi Meet

Topic(s):

  • Process
  • Proc File system and Process Hierarchy
  • Process related tools
  • File Descriptors
  • Command Line
  • Pipes
  • Redirection

Reference(s):

Sixth Meet Schedule: 25 February 2023, 11:00 IST
Meeting Link: Jitsi Meet

Topic(s):

  • Subshell
  • Variables, expansions and substitutions
  • conditional expressions and test, [, [[ commands
  • If-elif-else-fi
  • case-esac
  • for-do-done
  • while-do-done
  • #! and env
  • writing simple shell script

Tasks for the Final Session (Next week):

  • Given a directory and file extension, write a shell script to list all files with the given extension in that given directory. The script should be capable of searching through all the sub directories
  • Given a directory, write a shell script to list all files and their properties from the given directory, each line should contain following fields in the same order,
    • file full path
    • file size
    • file permissions (eg: rw-r–r–)
    • file type
  • Write a shell script to list all the disks and partitions available in your system.
  • Given a file, write a shell script to detect in which filesystem that given file was stored.
  • Given a application name (eg: firefox), write a shell script to list all process ids belongs to that application
  • Given a username, write a shell script to list all processes belongs to that user.

Anyone completing any one of these tasks will be awarded a digital badge from KanchiLUG similar to the below one

Reference(s):

Final Meet Schedule: 04 March 2023, 11:00 IST
Meeting Link: Jitsi Meet

Topics(s):

  • Review Tasks Submissions
  • Clear errors if anyone have problems completing the tasks
  • General Discussion and Feedback

Murugan’s task code

#!/bin/sh

dir="$1"
fileExtn="$2"

if [ -n "$dir" ]
then
  if [ -n "$fileExtn" ]
    then
      find "${dir}" -type f -name "*.${fileExtn}"
    else
      find "${dir}"
  fi
else
  find "."
fi 

Ranjith’s code

#Given a file, write a shell script to detect in which filesystem that given file was stored.

echo "enter the file name with path"

read filename

echo "The file is present in the filesystem:"; stat -f $filename | grep Type | awk '{print $NF}' 

Marcel’s code

ls -l | grep  '^-'| gawk -v a="`pwd`/" '{print a$NF " " $5 " " $1  }' > /tmp/input.txt
a='';
echo "FILE_FULL_PATH                                                 FILE_SIZE FILE_PERMISSIONS FILE_TYPE";
echo "-----------------------------------------------------------------------------------------------------";
while IFS= read -r line
do
  a=`echo $line| cut -d ' ' -f1`
  b=`file -b $a`
  echo "$line "\""$b"\"""
done < /tmp/input.txt 

Parameshwar’s code

#!/usr/bin/bash

case $1 in
	1)
		find $2 -path "*$3";;
	2)
		find $2 -maxdepth 1 -printf "$(cd $2 && pwd)/%f %k %M %Y\n";;
	3)
		sudo fdisk -l;;
	4)
		find $2 -printf "%F\n";;
	5)
		parent=$(ps -C $2 -o "%p" h)
		ps --ppid $parent --pid $parent;;
	6)
		ps -u $2;;
	*)
		echo "Unknown Option";;
esac