0
0
Linux CLIscripting~15 mins

nohup for persistent processes in Linux CLI - Mini Project: Build & Apply

Choose your learning style9 modes available
Using nohup for Persistent Processes
📖 Scenario: You want to run a command on a Linux server that keeps running even if you close your terminal or get disconnected. This is useful when running long tasks like backups or downloads.
🎯 Goal: You will learn how to use the nohup command to run a process that stays alive after you log out. You will also learn how to check the output and confirm the process is running.
📋 What You'll Learn
Create a simple command that runs for a while
Use nohup to run the command persistently
Redirect output to a file
Check the output file to see the command's result
💡 Why This Matters
🌍 Real World
System administrators and developers often need to run scripts or commands that take a long time. Using <code>nohup</code> ensures these tasks keep running even if the terminal closes.
💼 Career
Knowing how to run persistent processes is essential for managing servers, running backups, or deploying applications in real environments.
Progress0 / 4 steps
1
Create a simple long-running command
Write a command that uses sleep 30 to pause for 30 seconds.
Linux CLI
Need a hint?

The sleep command pauses the terminal for the number of seconds you specify.

2
Run the command with nohup to keep it running after logout
Use nohup before the command sleep 30 and redirect output to a file called output.log.
Linux CLI
Need a hint?

nohup runs the command immune to hangups. Redirect output to output.log and run in background with &.

3
Check the output file for command result
Use cat output.log to display the contents of the output file.
Linux CLI
Need a hint?

The cat command shows the contents of a file.

4
Confirm the process is running with ps
Use ps aux | grep sleep to check if the sleep 30 process is running.
Linux CLI
Need a hint?

The ps aux command lists running processes. Use grep to filter for sleep.