Advanced Shell Scripts every Linux developers should know

| Command | Command Full name | Example | Work |
ps | processes | ps -ef | lists all processes running including system processes. |
grep | global/regular expression/pint | grep “amazon” | Searching plain text data set to match a regular expression. |
awk | Mawk language | awk -F” “ ‘{print $1}’ | An interpreter of AWK language which is very useful in text data processing and a lot other things. For query, run man awk in terminal. |
sudo | substitute user do | sudo su - | Switches as another user. su means superuser. |
🚧 The “|” or pipe parameter sends the output of the first command into second command.
Example:
ps -ef | grep "amazon"
In this code, the first command lists all the processes running and the second command finds out all the processes that has the name “amazon” in it.
🚧 The pipe parameter (|) sends the output of the first command into the next command only if the first command doesn't send its output into stdin process.
date | echo "Date is" --> this command doesn't print the date as the date command sends the output into stdin process.
set command
set command is used to set some ground rules before executing a script.
set -x: it runs the script in debug mode.set -e: it ends the script when any error occursset -o pipefail: it ends the script in case of failure in the pipe parameter (|) data transfer.
curl vs wget
curl command executes an API and returns s response data where wget downloads the file from a network.


