watch command in linux with examples | Pro Tech guides

watch command in linux with examples

watch command in Linux allows you to execute the given command or script repeatedly. By default, it refreshes the command every 2 seconds.

Linux command watch | Execute command or script Repeatedly

linux command watch
watch command in Linux

Hello, guys welcome to the Linux command line tutorial.

Today, I'm going to show you how you can use "watch" command in Linux.

"watch" is an excellent command. Which can run scripts or command at a regular interval or repeatedly.

watch command

watch command
watch command

$watch yourCommand

what is watch command
Output
For example, I'm going to use "free" command with the "watch" command. So just say "watch free -h" and press ENTER

To Exit press ctrl+c
  • If you use "watch" before any command. It executed repeatedly.

And you can see after Every 2 seconds this command is going to be executed.

By "default" the command will be executed at an interval of 2 seconds.

To change the frequency

If you want to increase the frequency to execute this command.

You can use the flag "-n" and then the "Number of seconds". Which you want to provide.

watch command with -n flag
watch command with -n flag

$watch -n [numberofSeconds] [yourCommand]
For example, I want to use "1" second interval.

So I can just write "watch -n 1 free -h" and press ENTER

Now it's refreshing at a 1-second interval.

Conclusion

So this is how you can use "watch" command.

You can use this "watch" command with any command or even with the script.

I hope you've enjoyed this tutorial please rate comment and bye for now.

HAVE A NICE DAY💖

Name

Apps,3,Games,1,Linux,38,Linux Commands,37,Network-Devices,1,Networking,1,Terminal Apps,2,Termux,17,Userland,3,Windows,1,
ltr
item
Pro Tech guides: watch command in linux with examples
watch command in linux with examples
watch command in Linux allows you to execute the given command or script repeatedly. By default, it refreshes the command every 2 seconds.
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmeMdshS-ic8IdEnYHNxhpQ-PTPwCOsbeu_NA8aPS1oOLM2QJmKbzt1P4PtlTCfLyWNCEI5L4JIDWEQb7UaG99oT32YXsbLDNjDVwwywcqe4gkwc4P8vcagOY15xZX6wxShvmj0OXldQ4/s16000/watch-command-linux.jpg
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmeMdshS-ic8IdEnYHNxhpQ-PTPwCOsbeu_NA8aPS1oOLM2QJmKbzt1P4PtlTCfLyWNCEI5L4JIDWEQb7UaG99oT32YXsbLDNjDVwwywcqe4gkwc4P8vcagOY15xZX6wxShvmj0OXldQ4/s72-c/watch-command-linux.jpg
Pro Tech guides
https://devops-digest.blogspot.com/2021/01/watch-command-in-linux-with-examples.html
https://devops-digest.blogspot.com/
https://devops-digest.blogspot.com/
https://devops-digest.blogspot.com/2021/01/watch-command-in-linux-with-examples.html
true
7053638852026728047
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Content