Run Any Command in Background [Linux/Unix]

Some command takes time to execute or we need to run the command continuously so we need to take it on the background.

Arnish Gupta
1 min readDec 1, 2020
Photo by Aron Visuals on Unsplash

There are many packages available to execute the command in the background but the most popular and easy approach is for Screen Command. Let’s understand how it works.

Installation

Firstly we have to install the screen package on our machine. In some operating system screen package already installed.

[CENTOS] yum install screen -y

[LINUX] apt-get install screen -y

Used

### We have to open the new screen using the below commandscreen -s <Tag_Name> (Here Tag_Name is for identity it is optional)Example: 
screen -s mysite (With Tag)
screen (without the tag)
## You can do whatever you want and come to the original screen
CTRL + a (then press 'd') ## It detached the screen## For list of running screensscreen -ls## For go to the specific screenscreen -r <Screen_ID> (You can find Screen_ID on screen -ls command)## For Kill/Exit the screenCTRL + a (then press 'k') then press 'y' (it ask for confirmation)

Thank you for reading !! Have a Good Day (sudo :))

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response