/ Linux

Previous Article

Running Linux Commands in the Background

Next Article

When running a large complex command or time consuming command such as moving a large quantity of files from one drive to another or running a mass rename script, your terminal will become locked and only become available when that command has finished running.

To bypass this and run the command in the background simply append an & to the command. You will then be given a process ID of the command as it runs in the background.


command &

Here is a working example. I want to move all my .arw files from one drive to another, as i have quite a few large arw files this process takes up a lot of time. I also tend to access my linux box via ssh so don't want multiple connections to the terminal. This is the command i run:

mv *.arw /media/photos/ &

To see what jobs you have running use the following command


The following is a sample output that will be returned by this command

[1]+ Running mv *.arw /media/photos/ &

The [1] returned is the job ID, if you want to see the process ID then pass the -l option as below

jobs -l

This will return the same information as the main command but also include the process ID which is  useful if you want to kill a process. See sample output below:

[1]+ 30125 Running mv *.arw /media/photos/ &

If you want to bring the job to the foreground use the following syntax:


so for our example:


This will then show the command that you are running with any output in my case it will just display:

mv *.arw /media/photos/

To send it to the background again simply ctrl + z and then %1 & this will run it again in the background

Avatar of Clive Walkden

Clive Walkden

Latest Articles

Linux command line tools, installations etc


Terraform Installation

A quick installation guide for Terraform on Ubuntu 18.04

Bitcoin - Cryptocurrency not just for geeks


RollerCoin Intro

An introduction to the RollerCoin site and how you can use it to mine your own coins

Magento 2 Blog Posts

Magento 2

Magento 2.4.x Writing to a Log File

How to log to information to a file in different Magento 2.4.x versions