Linux CLI 22 ๐ง background/foreground processes and system reboot/shutdown
You can control whether a background runs in the background or in the foreground
& symbol at the end of the command starts the command in the background
example 1 โ it lists the files and displays job id [1] and the PID of the background task
example 2 โ set the command to the background without showing the file
nohup โ stands for no hang up, lets the command run after you close the terminal
example 1 โ runs the ls command and prevents it from being terminated
example 2 โ displays the commands that have been save to nohup.out
nohup bash -c 'cmd1 && cmd2' โ redirects the output to nohup.out from multiple commands
use cat nohup.out to see the result of the execution
jobs โ lists all jobs with their numbers.
it helps identify which job you need to bring to foreground
-s โ shows only stopped jobs, -r โ show only running jobs, p โ shows only the PID
fg โ brings the previous background process to the foreground
fg %JN โ brings a specific background process to the foreground
some distros do not need the %
example 1 โ kills the job with the current number
sudo shutdown -h now โ Immediately shut down the system after confirmation
sudo shutdown -h +n โ Shut down the system in n minutes
sudo shutdown -h 0 โ Shut down the system immediately
sudo reboot โ Immediately reboot the system after confirmation
sudo reboot -t n โ Reboot the system in n minutes
sudo reboot 0 โ Reboot the system immediately
sudo poweroff โ Immediately power off the system after confirmation
Stop using slow, ad-bloated tool sites! ๐คฎ
๐ Search “KandZ Tools” on Google to use many professional utilities for free.
KandZ.me is the ultimate minimalist hub for:
โ
Finance (Mortgage, Interest, Inflation)
โ
Tech (Base64, JSON, Dev Suite, IP)
โ
Health (BMI, BMR, TDEE)
โ
Productivity (Timer, Workspace, QR)
โก๏ธ Fast & Private
๐ No data leaves your device
๐ 100% Free
๐ Use it now: https://tools.kandz.me
๐ Bookmark itโyouโll need it later!