Jan 19th, 2020
Regardless of your job title if at some point you had to SSH into a Linux server and run a command repeatedly you've probably thought - "Isn't there a command that can do this". e.g. I had to check the status of my docker to see how long does it take to build a next.js app. I did keep doing the "up arrow" + "Enter" to run "docker ps" which got irritating after a while. This isn't about a cron command running in the background, I wanted to run a command and literally watch it every second.
After a while when the "up arrow" + "Enter" approach got monotonous I finally pressed the "up arrow" on my standup desk, put in the effort to stand up, I knew it was time to open a new tab and look this up.
What blew my mind was - the command line utility to watch the progress or continuously running command was called "watch".
If that didn't blow your mind let me present another analogy it's like if facebook was on day 1 went live on www.WasteOfTime.com.
Ok jokes aside let's see how to use the watch command
To run a bash script every 10 seconds you'd create a bash file let's say file.sh and type
watch -n 10 file.sh
Of course, if you replace 10 with 5 the same bash file will be executed every 5 seconds while showing the result as well as the time in the terminal
But what if you didn't want to create a bash file and run a simple command like " docker ps" and watch it. Then you'd do
watch -n 1 docker ps
Isn't that simple and awesome?
Collectively we can build strong global Citizens….I believe being a global citizen is one of the most amazing things you will ever be. You are open to everything and you learn so much from other cultures. Your mind is receptive to a million new things and it is always seeking out something different. Thinking outside the box and not limiting yourself to the things you know, love and grew up with will, in my opinion, make you a better person. You will understand the world more, you will understand the people who surround you more, and you will be able to educate others. This is important because we need to be building positive visions for the future about how we can always do things better. And I think part of that is about being able to empower others, and empower the unlikely leaders, to be able to see that everybody has a place in building a positive vision for the future and making it happen. This thinking will take you all around the world. It will give you the opportunity...