08-04-2021



Command-2: View the items in a Finder window as a list. Command-3: View the items in a Finder window in columns. Command-4: View the items in a Finder window in a gallery. Command–Left Bracket : Go to the previous folder. Command–Right Bracket : Go to the next folder. Command–Up Arrow: Open the folder that contains the current folder. Installing Xcode Command Line Tools switchaudio-osx requires command line tools to be installed from OS X. To install command line tools in Xcode 4.4, from the menubar go to Xcode Preferences and click the Downloads tab. Click 'Install' on the line that reads 'Command Line Tools'. OS X Daily shows how to do it with a Terminal command. OS X Daily shows how to do it with a Terminal command. Watch Out for Fake COVID-19 Testing Sites. Nettop is a command-line program that displays updated information about network traffic. In this article we will cover how to run nettop, how to read its output, and how to format that output. This article is intended for the Mac user who wants to learn more about which applications are accessing the network, what state the network traffic is.

Watch hourglass_empty

3min Read

The Linux watch command is a power user favorite because it allows them to execute a specific command periodically and display the result in a standard output on a console or terminal window. Today we’ll show you how to start using this powerful utility on your VPS or Unix based machine!

What is the Linux Watch Command

With Linux watch, we can track the changes in the output from time to time. It is beneficial for reflecting the real-time view of events that are happening on an operating system.

By default, it runs the program every two seconds, although using –n or –interval options enables specifying a different frame.

Watch also offers its users the ability to monitor the creation and deletion of files, if you use it with various pipeline commands.

Watch will run simultaneously in the terminal until stopped by pressing CTRL+C.

Linux watch is also useful when you need to troubleshoot an issue, or monitor script output continuously. The watch command comes installed, by default in all Linux distributions with a wide range of features for its users.

Basic Linux Watch Commands

Before we start learning how to use Watch, lets log into our VPS by using SSH. Check out our PuTTY tutorial if you’re encountering issues.

To use the basic features of watch, type in the following command in the command line, while replacing file_name with your preferred file:

Os X Watch Command

Or if we want to see the current date, we can use this command:

Below, we could easily observe that the date is changing every two seconds followed by the current date and time of the system.

Command

Many times we want the Watch command to exit after one change in the output. We can do this with the help of the –g option which stops the Watch command any time there are changes in memory consumption. The command would look like this:

It is also possible to turn off the header showing the blank line, current time, command and interval. With the help of the –t option, you can stop the header in the terminal. For example:

To observe bandwidth statistics, you can use the ifconfig option with Linux Watch. It would look like this:

Now you can see the RX and TX byte traffic along with the IP address of your system. It shows the network speed every two seconds, as well.

How to Highlight Differences Between Updates with Linux Watch

Watch regularly updates the output of a specified command, by default after 2 seconds. To view the changing output we can use the –d or –difference option. This option will highlight the changes. The command to highlight differences between updates is:

Linux Watch Command For Windows

Here, the changes in the current time are highlighted in the terminal.

How to Change Time Intervals in Linux Watch?

Osx Watch Command

Linux Watch Command Examples

The duration between outputs can easily change in the Linux terminal by using the -n option followed by a digit which represents the number of seconds which you want. It’s essentially changing the update intervals, or successive update time.

Watch

Linux Watch Command

For example:

This command will reflect the output updated after every 5 seconds.

When using Linux watch we can’t observe intervals less than 0.1 seconds.

How to Use the Linux Watch Command with Other Pipelines

Watch can also be helpful with other pipeline commands:

How to Monitor Files with Linux Watch

To view a particular file’s status or changes made to it, use the below command in Linux terminal:

Here, devisers is the username and ls –l are the files present in the user directory.

How to Use the Linux Watch Command as a Clock

To use watch as a clock execute the command below in the Linux terminal command like:

How to View Hardware Status using Linux Watch

We’re adding this one as a neat little bonus for Linux users that might not be using a VPS, as this might not work on your server. Besides, Hostinger takes care of the back end, so you don’t have to!

In this example, we’ll monitor the CPU temperature of a Linux based machine:

It will display the output of the command and you’ll be able to see the temperature status of your computer!

Summary

Recent developments made to the Linux Watch command have improved its features, making it a simpler, but effective utility for accurately tracking changes in files, directories, the machine and much more! As you can tell, this is just the tip of the iceberg of what you can do with Linux Watch.

Every Linux administrator should know how to use watch for monitoring and troubleshooting purposes. It makes it easy for the user to observe various changes in the input without issuing the same command repeatedly.

We hope you add Watch to your arsenal as well! Happy developing!