nohup and Background Process
nohup (short for no hang up) is used to run a command or program in the background.
- The process continues even if you close the terminal tab.
- It stops when you shut down the system.
- Without
nohup, closing the terminal will terminate the process.
Common Commands
| Command | Description |
|---|---|
nohup program_file | Runs the given program in the background. |
nohup program_file >> storing_file | Runs the program in the *background and stores the output in another file (storing_file). *(Press Enter twice to continue) |
top | Displays all currently running processes. |
ps | Shows the status of active processes (Process Status). |
ps -aux | Lists detailed information about all running processes. |
cat storing_file | Displays the entire log content of a stored background process. |
tail -f storing_file | Shows the last 10 lines and updates live as new logs appear. |
tail -10 storing_file | Displays only the last 10 lines of the file. |
kill -9 process_id | Forcefully stops a process using its process ID (find it using ps -aux). |
grep file_name | Searches for a matching pattern inside a specific file. |
Zip and Unzip Commands
| Command | Description |
|---|---|
sudo apt install zip | Installs the zip package. |
zip zip_name.zip file_name | Compresses a single file. |
zip -r zip_name.zip folder_name | Compresses a folder recursively (includes all sub-files and directories). |
unzip zip_name.zip | Extracts the contents of a zip file. |
Disk Commands
| Command | Description |
|---|---|
df -h | Displays the disk space usage of all drives (in human-readable format). |
du -sh | Shows how much disk space a particular file or directory uses. |
Quick Summary
- Use
nohupto run programs in the background safely.
- Use
ps,top, andkillto manage processes.
- Use
zipandunzipfor file compression.
- Use
dfandduto monitor disk usage.
SOCIAL SHARE CARD GENERATOR