Tag: Bash Function
Sometimes we want to repeat a command on Linux, and we can use the following BASH function to repeat a command for a number of times: function repeat() { …
To extract the domain name from a full URL in a Bash script, you can use parameter expansion, sed, awk, or grep. Each method has its own benefits, and …
We sometimes need in BASH script to display messages with different format/colour to terminal console. For example, the warnings messages are blue, and error messages are red. We can …
On Linux, we can cat the file “/proc/meminfo” to display memory related information: $ cat /proc/memoinfo MemTotal: 32939372 kB MemFree: 31155452 kB MemAvailable: 31269760 kB Buffers: 242964 kB Cached: …
sudo is the command to allow normal users perform some escalated operations. We can use the following BASH function to check to see if the sudo command is available. …