🎯 Key Takeaways for quick navigation: 00:01 📜 Introduction to advanced shell scripting concepts. 00:41 🛠️ Bash scripting is the focus, applicable across different operating systems. 01:25 💡 Recap of previous video, covered basic shell script and system commands (DF, free, nproc, top). 03:28 🚀 Goal: Create a custom shell script to monitor virtual machine health. 06:00 🗒️ Using metadata information to detail script author, date, purpose, and version. 07:25 🔍 Debugging techniques: Using Echo statements for clear script output. 09:12 🐍 Introduction to grep command to filter output. 10:48 🔄 Piping output using the pipe symbol (|) to chain commands. 18:48 🔀 Combining grep and PS command to filter specific process information. 22:46 📊 Grep command filters output data; Pipe statement sends output from first to second command. 23:30 🔄 Piping date command's output doesn't work due to default output channel; Pipe transfers output from STDIN to the next command. 25:23 🚀 Interview question: Pipe doesn't work with date command because it sends output to STDIN; Pipe needs commands not sending info to STDIN. 26:46 📄 'awk' command extracts specific columns from output data, useful for data filtering in logs. 31:48 ⌨️ Shell script best practice: Use 'set -e' to exit script on errors, ensuring immediate error detection. 32:17 🛑 Set 'set -o pipefail' to make sure script stops on pipe command failures. 40:14 🗃️ Retrieving error logs from external storage using 'curl' command and piping it to 'grep' for specific data extraction. 45:09 🌐 'curl' command used for making HTTP requests, similar to tools like Postman; Retrieve data from APIs and websites in scripts. 45:52 📜 Shell scripting can be used by DevOps Engineers to automate tasks and perform various operations efficiently. 46:05 📜 DevOps Engineers can use the `curl` command or the Python `requests` module for API requests and retrieving information from resources. 46:20 📜 The `wget` command can be used to download files from the internet, but it doesn't display output; whereas `curl` can show output directly. 47:15 📜 The `grep` command can be used with `curl` output or downloaded files to filter information, aiding in error detection. 48:10 📜 The `find` command is useful for locating files in a directory structure based on various conditions. 54:21 📜 Understanding `if` and `if-else` conditions in shell scripting helps to execute different actions based on specific conditions. 54:49 📜 Learning `for` loops is essential for automating repetitive tasks and iterating through a range of values. 57:55 📜 Utilizing the `trap` command allows you to handle signals like Ctrl+C, providing actions to be taken when specific signals are received. 01:07:59 🔗 The `trap` command in Linux can be used to handle and respond to various signals, like Ctrl+C, in order to control script behavior and prevent unintended consequences. 01:08:13 📜 A real-world scenario for using the `trap` command is preventing incomplete data from being used by executing cleanup actions when someone interrupts a script with Ctrl+C. 01:09:22 🔗 The video concludes by encouraging viewers to comment and suggest topics for future videos, offering to provide more in-depth explanations on commands like `curl`, SMTP, or trap signals based on audience feedback. Made with HARPA AI
@@vamshikrishna7945 in keyboard below the backspace button, above the enter button there is a button with these symbols | \ press this button along with shift, then it will print pipe, so pipe symbol is this one | i hope you got it
58:50 if anyone is getting "a is greater than b", It could be because you are using the ">" operator. In bash ">" is used for string comparison, we use "-gt" for "greater than" in bash for numericals
Thanks Abhishek, please do this next level shell scripting videos along with the present Devops crash course. we will be waiting for the next level sessions on this Abhishek. Thanks for all your efforts and bringing the valuable content to us on DEVOPS journey.
Have seen lot of videos on basics of Linux/shell script but yours's is the best and the way your explanation is giving more interest in learning. Thanks much 🙏 Now have to decide to go through all your videos and finally you have very big heart of giving this knowledge as free..
Great video! One thing to note that the reason < date|echo "Date is" > doesn't work is because echo doesn't use stdin. It outputs the arguments passed to it. Thats why you see "Date is" printed on the screen. Date command still outputs to stdout. Thats why you can use pipe grep with date
you are truely awesome abhishek you are so detailed and anyone can understand from your teachings as your approach teaches a layman to IT as well and get their basics right. I am totally new to the space of operations. Thank you so much for all your efforts❤
@@AbhishekVeeramalla I am having this error: line 22: aws: command not found after creating a script file aws_resource_tracker.sh, i added the aws s3 ls to list out s3 bucket that i have but when try to run the script ... ./aws_resource_tracker.sh. I am getting an error: aws: command not found, what could be the issue
Hi Abhishek, Thank you very much for the DevOps and shell scripting playlists. I found them very useful. I have a doubt regarding piping the output of the date command to the echo command. At 24:40, you said that the date command sends the output to stdin, and hence, the pipe won't be able to catch the output of the date command. And this is the reason why "date | echo "date is " doesn't print the date. But, when I tried the following command "date | awk '{print $3}'" the output is "March" which is the 3rd column of the date command, or the output of "date | awk '{print $4}' " is "2024" which is the 4th column of the date command. So, the output of the date is sent to awk command through the pipe and hence it is able to print the 3rd and 4th columns of the date command's output. I did a similar check by piping the output of date to grep and that too worked. On the other hand, if I pipe the output of any command to echo, it doesn't work. Example: ps -ef | echo "Output of ps -ef" or ls | echo "output of ls" doesn't work. When I looked at the pipelines section of man bash, this is what I found: Pipelines A pipeline is a sequence of one or more commands separated by one of the control operators | or |&. The format for a pipeline is: command | command2 The standard output of command is connected via a pipe to the standard input of command2. So, I think, in all the cases where we use pipe, the command to the left side of pipe pushes its output to stdout and the command to the right of pipe reads from stdin. When I searched on Google about piping to echo command, this is what I found. echo prints all of its arguments. It does not read from stdin. So, when we do date | echo "Date is " the pipe connects standard output of date to standard input of echo. But, echo ignores standard input and will dump its command line arguments - which are none in this case - to its own stdout. Hence the output of this command is just "Date is " For a program that reads its stdin and prints that to stdout, we can use cat. For example date | cat prints the date. So, to conclude, I think echo is the culprit here as it doesn't catch the output from stdin, unlike awk or grep. Please clarify my doubts and correct me if I am wrong. Thank you in advance.
Yes, you're correct; the echo command doesn't read from stdin. So it doesn't work in this case. But we can do it in another way: echo "The date is $(date)". This will print the date with the following string provided in the echo command. It can capture the output, if we put in a format specifier.
The shell scripting sessions are really great and can you please share more information about the below mentioned topics : 1. How to transfer/copy the files from one server to another server? 2. Few more examples on loops concepts. 3. How to store multiple values received from grep output. Thanks in advance. .
Hi Abhishesk , thank you so much for teaching us like this ! ❤I would like to add one correction which I found while practicing from your videos , in IF-ELSE example ....... we will have to use comparison operator "-gt" instead of ">" as I was getting wrong answer with operator ">" . As comparison operators, such as -eq, -ne, -lt, -gt, -le, -ge, for numeric values, or ==, !=, , =, for string values.
Hi abhi thanks for all your efforts I have learning Devops from your videos. You are teaching in such a way that we learn in effortless way. Bless god give more power to you thanks again. Waiting for part 3.
thank you so much Abhishek, Love from KSA, i will tell about this wonderful channel to my colleagues which I found through google notifications set on my mobile
I saw all the commands explained in the video in many scripts but got the clear view on them from this video. 1. Please explain email triggering using shell scripting. 2. Please share if there are Linux, operating system, networking videos.
Hi, Abhishek. I recently found your channel and learning Ansible and Terraform. I wish if you could also make vedios on windows Powershell scripting zero to hero series. I understand that your main focus is Devops but if possible! Appreciate all your efforts!
Great video again, looking forward for part-3 and also for K8 troubleshooting videos too.. If you do part-3 for shell scripting, then pls consider this question : If in EC2 instance, load is increasing suddenly,how will u check using linux commands and also how you will mitigate it??
Hi Anil, Thanks. To answer your question, you can definitely do it using shell scripting but its not the efficient way. I will try to explain why if I make a similar video
@@AbhishekVeeramalla Thanks for the reply Can you tell me the command actually to check the increasing load, I was thinking we can check it via I)free -mt and ii)top, are there any other commands effective than these??
Amazing Great content coverage with crisp required information Abhishek. Please continue with the Part3 with further commands that we come across as we delve in-depth in DevOps. Thank you very much for the content. Wish you more success. Cheers brother!!👏🎉
HI, I was running the command date | echo "today is " when I realized that echo command will only print what is typed in it. But if you try date | grep Jul , the pipe is able to transfer the output to as an input to grep. Therefore I believe the interview question about why pipe not transferring the output should be taken with a grain of salt. Other than that I feel this is great lectures and very helpful to understand scripting. Thank you
To list different types of SIGNALS in Linux, that kill command can pass, type the command " kill -l ". This command will list all the SIGNALS in the command prompt. The most polite way 😂 of killing a process is -> [ kill ____(process_ID) ]. This command internally uses default SIGNAL listed at 15th number -> { SIGTERM }. The most powerful way of killing a process is forcefully destroying it by the command -> [ kill -9 ___(process_ID)]. This command, no matter what, will kill any running process from it's origin. It uses the signal listed at 9th number -> {SIGKILL} . Now, if we want to kill all the foreground processes in one go from the origin, then, we can use "pkill command". The beauty of this command is, we don't have to specify any process ID with this command. We can directly write the name of the process that we want to kill [ Ex: pkill -9 ping ] -> Even if you have multiple of pings going on in the foreground, this command will kill all the pings in one go...
Thanks Abhishek! Your sessions are great 🎉 Regarding the interview question, I was reading about date & echo after the video. I found that date outputs in stdout(1). echo doesnt take input from stdin(0) & only outputs arguments to stdout(1). pipe connects stdout(1) from left to stdin(0) to the right. So it only prints this. 0, 1 are file descriptor numbers.
Thanks a lot Abhishek for your videos please continue these we are learning lot things from you great thanks for all your efforts to share your knowledge ❤
🎯 Key Takeaways for quick navigation: 00:01 🧭 *Advanced shell scripting concepts introduction.* 01:11 🚀 *EC2 instance setup with Ubuntu for shell scripting practice.* 04:10 📝 *Adding metadata to scripts for better understanding.* 07:11 🚨 *Debugging with Echo and "set -x" command.* 14:02 🕵️♂️ *Investigating processes with PS and GREP.* 20:53 🔄 *Explaining the pipe "|" command functionality.* 21:34 📝 *Recap: Comments, debugging, PS, GREP, and pipe command.* 23:15 ❓ *Interview question: Pipe command with Date.* 26:19 🔄 *Filtering processes with PS, GREP, and AWK.* 32:17 🚦 *Best practices: Set -e, -o pipefail.* 40:14 📄 *Searching log files with Curl.* 44:11 🌐 *Overview of curl command and its uses.* 46:34 📥 *Difference between wget and curl commands.* 48:25 🕵️ *Introduction to the find command in DevOps.* 51:36 🔄 *Understanding sudo, su, and switching between users.* 54:49 🤔 *Basics of if, if-else, and for loops in Shell scripting.* 01:02:57 ⚠️ *Overview of the Trap command in Shell scripting.* 01:05:15 🚦 *Understanding Linux Signals and Trap Command intro.* 01:06:59 🕵️♂️ *How to Use the Trap Command in Shell Scripting.* 01:09:22 📚 *Wrapping Up and Audience Interaction.* Made with HARPA AI
Hi @Abhishek, your videos are really the best in yt, I would like to say you are doing the great jobs for the people moving to devOps. While watching this video I was looking for getopt and getopts with some good examples, not to say as you will provide in it
without practice i forget all the command but i am using in my office multiple time so i learn many command rightnow i get more clarity . Please make part 3 as well.
Hi abhishek Awsome contet to provide us thanks alot..... My request is can you please provide python script classes atleast core content of python and how to develop scripts Now a days to use python and go language scripts to work on different resources providers it must be help full it support all the environments like linux, Mac, windows Maye be it possible do for us abhishek and Another one is how develop the programing basics its use casess Your teaching levels are Best one, it helps to set next generation tech guys thankyou abhi.........
24:30 date command doesn't send the output to stdin, it sends to stdout only. This doesn't work because echo command doesn't read anything from stdin. if you do date | cat or date | more date | less it will work as expected.