Using batch Command In Linux (Examples)

batch command in Linux is used for reading commands from standard inputs or from a certain specified file and execute them when the system load levels drops below 1.5 or the value specified in the invocation of atd. means, unless the overall system load is above 1.5 or one as specified, the batch command will keep waiting, and once the requirement meets, it runs all certain command in batch.

Syntax to use batch command in Linux


It’s noteworthy to mention that batch requires no other parameters unlike other similar commands such as atq, or atrm commands

Examples for using batch command in linux

To work with batch command, first run ‘top’ command to view current load average.


In order to try out using some batch commands, follow a series of instructions as mentioned below:

1: At first run ‘batch’ on the terminal. It will display the following output on screen.

Warnings: commands will be executed using /bin/sh

When the above prompts appear on screen, type the following contexts.

at> echo “Servo Node, A Linux Tutorial” >> batch.txt
at> <EOT>
job 7 at Thu Apr 15 21:48:00 2021

This will bring you on terminal back. To run the created batch.txt, execute the series of commands mentioned below.

$ atq
$ cat batch.txt

and the output will be:

Servo Node, A Linux Tutorial

Once the batch command shows it output, you can press ctrl+d.