≡ Menu

Question: Sometimes I want to repeat a command (or shell-script) frequently (every few seconds). Is there a better way to execute a unix command every n seconds (instead of keep typing the same command manually)?

Answer: Using watch command you can execute a command and view it’s output every few seconds. This is very helpful while monitoring memory usage, disk usage etc.,

You can execute any Unix command using watch command. Watch command will be executed until you terminate it either by CTRL+C or kill the process.
[continue reading…]

Question: I’m using Sun Solaris OS. When I execute the find command, I get “find: bad option -not” as shown below. How do I fix the following error?

find: bad option -not
find: path-list predicate-list" in Solaris SunOS.

[continue reading…]

As part of our on-going bash tutorial series, we discussed about bash positional parameters in our previous article. In this article let us discuss about the bash special parameters with few practical shell script examples.

Some of the bash special parameters that we will discuss in this article are: $*, $@, $#, $$, $!, $?, $-, $_
[continue reading…]

A parameter is an entity that stores values. It can be a name, a number or some special characters. A variable is a parameter denoted by a name. Some variables are set for you already, and most of these cannot have values assigned to them.

These variables contain useful information, which can be used by a shell script to know about the environment in which it is running.
[continue reading…]

Question: I would like to terminate my Unix command line shell, when I don’t execute any command for N number of seconds. i.e How to automatically log out if there is no activity in a Linux shell ?

Answer: TMOUT variable in bash will terminate the shell if there is no activity for N seconds as explained below.
[continue reading…]

When you execute a unix shell-script or command that takes a long time, you can run it as a background job.

In this article, let us review how to execute a job in the background, bring a job to the foreground, view all background jobs, and kill a background job.
[continue reading…]

This article is part of our on-going bash tutorial series. Like any other programming languages, Bash also provides variables.

Bash variables provide temporary storage for information that will be needed during the lifespan of the program.
[continue reading…]

How To Fix Offending key in ~/.ssh/known_hosts file

As we discussed earlier in our basic ssh client commands article, when you do ssh to a machine for the 1st time (or whenever there is a key change in the remote machine), you will be prompted to say ‘yes’ for authenticity of host.
[continue reading…]