In this video, I’ll show you how to write a powerful Bash script using vim. This script lets you type keywords like ram, cpu, net, or ip, and instantly shows live system info in color!
You’ll learn:
How to use vim to write a shell script
How to save and quit properly
How to run and test your script in Linux
Perfect for Linux beginners learning the command line and scripting.
#!/bin/bash
while true; do
read -p "Enter keyword (ram, cpu, hdd, net, time, ip): " key
([ "$key" == "ram" ] && echo -e "\e[1;31m$(free -h)\e[0m") ||
([ "$key" == "cpu" ] && echo -e "\e[1;31m$(lscpu)\e[0m") ||
([ "$key" == "hdd" ] && echo -e "\e[1;31m$(df -h)\e[0m") ||
([ "$key" == "net" ] && echo -e "\e[1;31m$(ifconfig)\e[0m") ||
([ "$key" == "time" ] && echo -e "\e[1;31m$(timedatectl)\e[0m") ||
([ "$key" == "ip" ] && echo -e "\e[1;31m$(hostname -I)\e[0m") ||
echo -e "\e[1;33mInvalid input: $key\e[0m"
echo
done
On this page of the site you can watch the video online Write an Interactive Linux Bash Script Using vim (Step-by-Step) with a duration of hours minute second in good quality, which was uploaded by the user Sien Serey 01 August 2025, share the link with friends and acquaintances, this video has already been watched 33 times on youtube and it was liked by 0 viewers. Enjoy your viewing!