Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/techarkit/shell-scripting-tutorial

A complete begineers guide to learn shell scripting from scratch which includes Videos, Practice scenarios and project idea.
https://github.com/techarkit/shell-scripting-tutorial

bash linux linux-command loop programming scripting scripting-tutorial

Last synced: about 2 months ago
JSON representation

A complete begineers guide to learn shell scripting from scratch which includes Videos, Practice scenarios and project idea.

Awesome Lists containing this project

README

        

# Shell Scripting Tutorial

Keep in touch with for any kind of technical questions

[Shell Scripting for Amazon Web Services to Manage it's resources](https://github.com/techtutorials/shell-scripting-tutorial/tree/FOTV/AWS)

https://techtutorials.github.io/shell-scripting-tutorial/

* [Facebook](https://www.facebook.com/Linuxarkit/)
* [Email List](https://feedburner.google.com/fb/a/mailverify?uri=arkit)
* [Linkedin](https://in.linkedin.com/in/ravi-kumar-94530121)
* [Twitter](https://twitter.com/aravikumar48)
* [Youtube](https://www.youtube.com/Techarkit?sub_confirmation=1)
* [Email Address]([email protected])
* [WhatsApp Group](http://bit.ly/wappg)
* [Linux Telegram Group](http://bit.ly/linux-telegram)
* [Reddit TechTutorials](http://bit.ly/redditark)
* [Tumblr](https://www.tumblr.com/blog/aravikumar48)

A complete begineers guide to learn shell scripting from scratch which includes Videos, Practice scenarios and project idea. I will create one file for one topic with code.

Before jumping into the Shell scripting below are commands you have to practice for better understanding and familiar with Linux command line interface.

If you do not learn below commands also fine but i personally recommend you to learn commands first.

[103 Linux Commands Video Tutorial](https://www.youtube.com/watch?v=VG-MMju9RhQ&list=PLHyfPDPl-JDX_dfDEpsvglu4x3h1RjPkz)

alias and unalias, arch, arp, at, awk, bc, blkid, cal, cat, cd, chage, chattr, chgrp, chmod, chown, cp, cpio, crontab, curl, cut, date, dd, df, diff, dig, dnf, du, expr, fdisk, file, find, firewall-cmd, free, ftp, grep, head, history, hostname, id, ifconfig, iostat, ip, kill, last, lessandmore, ln, locate, lpstatandlpadmin, ls, lsof, lspci, mail, man, mdadm, mkdirandrmdir, mkisofs, mount, mutt, mv, nano, netstat, nice, renice, nslookup, passwd, pam_tally2, paste, ping, perloneliner, pkill, ps, pwd, reboot, poweroff, rm, rpm, rsync, scp, screen, sed, sort, ss, ssh, sysctl, tail, tar, tcpdump, top, touch, tr, traceroute, umask, uname, uniq, uptime, useradd, vi, vmstat, w, who, watch, wc, wget, ypcat, yppasswd, yum, zip, sar

After that start learning shell scripting using below topics

- [Shell Scripting Video Tutorial](https://www.youtube.com/watch?v=7GNUzvjS_mE&list=PL8cE5Nxf6M6b8qW7CSMsdKbEsPdG9pWfu)
- [Shell Scripting course Overview](https://www.youtube.com/watch?v=7GNUzvjS_mE)
- [Linux Basics](https://www.youtube.com/watch?v=IFvMor-0eFM)
- [Linux Directory Structure](https://www.youtube.com/watch?v=rVxpe1_lNFE)
- [Linux Basic Commands](https://www.youtube.com/watch?v=yYC8aaQ3eZA)
- [Copy, Remove, Move and Time Commands](https://www.youtube.com/watch?v=G7XFreQkDB8)
- [Dif and Grep Commands](https://www.youtube.com/watch?v=RwcQ6JzTsmA)
- [Head, tail, sort and more commands](https://www.youtube.com/watch?v=OgV3qrPQulU)
- [tr and wc commands](https://www.youtube.com/watch?v=d40a5zFa8yI)
- [Disk utilities like fdisk, df and du commands](https://www.youtube.com/watch?v=vx1WZepOmKg)
- [Getting Help From Command Line user Interface](https://www.youtube.com/watch?v=GcYu-0IIJas)
- [w, who, hostnamem hostnamectl and uname commands](https://www.youtube.com/watch?v=7shAr5lp_Wc)
- [Search for files and directories using find and locate commands](https://www.youtube.com/watch?v=Rd6e-OrsHpo)
- [top command its output explanation](https://www.youtube.com/watch?v=UQ7rr4_47YY)
- [vi & vim text editor](https://www.youtube.com/watch?v=K3SUrcJ740Y)
- [sed, awk, vmstat and nestat commands](https://www.youtube.com/watch?v=4hJorSKg9E0)
- [vnstat command](https://www.youtube.com/watch?v=KlpE2Ok6Bxo)
- [Introduction to Graphical user interface](https://www.youtube.com/watch?v=Yck_xhz9ku0)
- [cut command](https://www.youtube.com/watch?v=kBZNJdw7RQQ)
- [Merge multiple files using paste command](https://www.youtube.com/watch?v=_Efd6PxhNq4)
- [Connect and Manage remote machine using SSH](https://www.youtube.com/watch?v=Dp9J7aktYDs)
- [Changing files and directory permissions](https://www.youtube.com/watch?v=NNAxqSyTsUI)
- [tar and zip commands](https://www.youtube.com/watch?v=lVQppyhgERA)
- [Scheduling future jobs using crontab](https://www.youtube.com/watch?v=OOOabNTnSwY)
- [difference between scripting and programming](https://www.youtube.com/watch?v=5UuTNosxNgI)
- [what is shell scripting and it's advantages](https://www.youtube.com/watch?v=m2DvuF_S4Ac)
- [PATH environment variable](https://www.youtube.com/watch?v=4TZyWegxzGY)
- [Symbols used shell scripting](https://www.youtube.com/watch?v=L8IxV7bvBHU)
- [Make Shell Script Template](https://www.youtube.com/watch?v=7KEQJ7jtkTg)
- [Quotes single, double and reverse - Know difference between each](https://www.youtube.com/watch?v=9_fhRI-dos4)
- [Bash colors](https://arkit.co.in/coloring-style-text-shell-scripting/)
- [Script exit status](https://arkit.co.in/shell-scripting-exit-status-shell-scripting-return-codes/)
- [Variables and it's rules](https://www.youtube.com/watch?v=839s_OtTqDA)
- [Special Variables](https://www.youtube.com/watch?v=PfxzX4XNYRE)
- [Environment Variables, system variables and user defined variables](https://www.youtube.com/watch?v=PfxzX4XNYRE)
- [Constant variables, Local & Global variables and Special variables](https://www.youtube.com/watch?v=839s_OtTqDA)
- [Positional Parameters](https://www.youtube.com/watch?v=PfxzX4XNYRE)
- [Count number command line arguments $#](https://www.youtube.com/watch?v=YizjrX9ph10)
- [Arithmetic Operators](https://www.youtube.com/watch?v=qxNQ_D8txPo)
- [Relational Operators](https://www.youtube.com/watch?v=U-u1wx5VeTU)
- [LogicalOperators](https://www.youtube.com/watch?v=m_F1FTKdUU4)
- [Boolean Operators](https://www.youtube.com/watch?v=U-u1wx5VeTU)
- [Maths using expr command](https://www.youtube.com/watch?v=qxNQ_D8txPo)
- [Real maths using bc command](https://www.youtube.com/watch?v=qxNQ_D8txPo)
- [if statement](https://www.youtube.com/watch?v=gncu9vzmILw)
- [if-else statement](https://www.youtube.com/watch?v=nDhbOeEQeNY)
- [if-else-if statement](https://www.youtube.com/watch?v=UJET-9cmaqU)
- [Nested if statement](https://www.youtube.com/watch?v=Kd1SJFnmj9k)
- [Case statement](https://www.youtube.com/watch?v=JJ7mAPU0KhI)
- [For Loop](https://www.youtube.com/watch?v=1fnAUUS4qg0)
- [While Loop](https://www.youtube.com/watch?v=nBMuVIRGpwY)
- [Until Loop](https://www.youtube.com/watch?v=zdk795qFgWk)
- [Functions](https://www.youtube.com/watch?v=jXv1otUXMG4)
- [Arrays](https://www.youtube.com/watch?v=2Fetj2V6rrM)
- [Eval command](https://www.youtube.com/watch?v=AjqBRGwLmLc&list=PL8cE5Nxf6M6b8qW7CSMsdKbEsPdG9pWfu&index=57&t=0s)
- [Shifting parameters using shift command](https://www.youtube.com/watch?v=48j0kxOFKZE)
- [IFS - Input Field Separator](https://www.youtube.com/watch?v=so8IRuhWjEM)
- [Writing CPU Usage script](https://www.youtube.com/watch?v=NQx43bY4lNo)
- [Writing Disk Utilization script](https://www.youtube.com/watch?v=yXhdDV13nrA)
- [Trouble shooting debugging shell scripts](https://www.youtube.com/watch?v=kgj-4_gmvi4)
- [Checking shell script errors and improvements using shellcheck.net site](https://www.youtube.com/watch?v=kgj-4_gmvi4)
- [Here Document to write paragraphs of text](https://www.youtube.com/watch?v=r9lb0ZxGFqE)
- [Getopts Function](https://www.youtube.com/watch?v=j-lEoC0DWI8)
- [Executing Multiple scripts from single script](https://youtu.be/hs-FK681D50)
- [logger logging messages to log file](https://youtu.be/_kMXvtn1RRQ)

**Resource to Download**

- [Shell Scripting Book](https://arkit-in.tradepub.com/free/w_wile48/)
- [Shell Scripting Book](https://arkit-in.tradepub.com/free/w_pack42/)
- [Shell Scripting Book](https://arkit-in.tradepub.com/free/w_advb01/)
- [Shell Scripting Book](https://arkit-in.tradepub.com/free/w_wile54/)

**Write Your Own Method of Script for below Scenario**

- **Scenario:** Everyday from Monday to Friday one directory will be created under /fullbackup/dailybackup/YYYY-MM-DD and it will move backup to its parent directory everyday midnight /fullbackup/archive/, However Saturday, Sunday and Monday directories will move to /fullbackup/archive path every monday evening.

- **Directory Names Example:** 2018-12-24 2018-12-25 2018-12-26 2018-12-27 2018-12-28

- **Question:** I would like to delete directories older than two days from /fullbackup/archive path. How do you do it using any scripting methods.

- **Problem Statement:** I was trying to use ```find /path/ -type d -mtime +2 -print0 | xargs -r0 rm --```. This command does not work as expected due to directory modified date for SAT, SUN and MON moved directories same for all as Monday date.

- **How Do you solve it.??** Write Shell Script to accomplish this task. Should run through crontab and clear directories older than two days.