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


How to Install NordLayer VPN Client on Ubuntu 20.04 and Connect to a Virtual Network

A simple to follow installation guide for NordLayer VPN

MySQL usage, tweaks and learnings


Mastering MySQL Database Imports on Linux

Learn efficient ways to import MySQL databases on Linux using the mysql command-line client. Explore the --source option and < operator for seamless data migration. Master MySQL imports on Linux with our comprehensive guide.

DevOps principles and tool usage


Mastering SSH Key Conversions for DevOps

A guide to convert SSH keys from one version to another using Linux CLI