1. Which command adjusts the priority of a process at start?
The nice command launches a process with a specific priority value. Lower nice values mean higher priority; positive values reduce CPU priority.
nice -n 10 ./backup.sh
Get the Preplance app for a seamless learning experience. Practice offline, get daily streaks, and stay ahead with real-time interview updates.
Get it on
Google Play
4.9/5 Rating on Store
Linux & Shell Scripting · Question Set
Process Management & Job Scheduling interview questions for placements and exams.
Questions
14
Included in this set
Subject
Linux & Shell Scripting
Explore more sets
Difficulty
Mixed
Level of this set
Go through each question and its explanation. Use this set as a focused practice pack for Linux & Shell Scripting.
The nice command launches a process with a specific priority value. Lower nice values mean higher priority; positive values reduce CPU priority.
nice -n 10 ./backup.sh
For complete preparation, combine this set with full subject-wise practice for Linux & Shell Scripting. You can also explore other subjects and sets from the links below.
htop provides an improved, interactive interface to monitor system resources. You can scroll, search, and kill processes directly from within the UI.
htop
The kill command sends a signal to a process to terminate it. Use kill -9 for forceful termination when normal kill fails.
kill -9 1234
renice adjusts the niceness (priority) of running processes. It helps control CPU scheduling dynamically during runtime.
sudo renice +5 -p 4567
crontab -e opens the user’s cron table for editing recurring job schedules. Each line defines when and how often a command runs automatically.
crontab -e 0 2 * * * /scripts/backup.sh
The at command runs a command once at a specific future time. It’s useful for delayed tasks like log rotation or temporary file cleanup.
echo 'rm /tmp/tempfile' | at 3:00 AM
Use the jobs command to list all background or stopped processes in the current shell. Bring one back to the foreground using fg %job_number or resume it in the background using bg %job_number.
jobs fg %1
A cron expression has five fields: minute, hour, day of month, month, and day of week. For example, 0 3 * * 1 means run every Monday at 3 AM. Use @daily or @reboot for predefined schedules.
0 3 * * 1 /scripts/cleanup.sh
Use watch with ps or pgrep to refresh process information at regular intervals. This helps monitor memory usage or uptime of critical processes.
watch -n 2 'ps -C nginx -o pid,cmd,%mem,%cpu'
Redirect both standard output and error streams to a log file in the cron entry. This ensures any issues during execution are captured for analysis.
0 2 * * * /scripts/backup.sh > /var/log/backup.log 2>&1
top displays real-time system performance, including CPU, memory, and process statistics. It’s useful for identifying high-load processes quickly.
top
bg resumes a stopped job in the background, while fg brings it back to the foreground. They are used in interactive shell sessions to manage job execution.
bg %1 fg %1
You can automate database backups daily using cron. For instance, schedule a cron job to run a MySQL dump script at midnight and store it with a timestamp for versioned backups.
0 0 * * * /scripts/mysql_backup.sh
The ps command shows currently running processes along with their process IDs. You can use options like ps aux to view all system processes.
ps aux