Tools
linux day #4
2025-12-26
0 views
admin
What Is a Process? ## Process as an Independent Execution Unit ## Who Manages Processes? → The Kernel ## Key Properties of a Process ## Process States (High Level) ## Process Hierarchy (Parent–Child Relationship) ## Practical Example (GUI – System Monitor) ## Terminal Example (Shell Inside Shell) ## Why This Matters for DevOps ## CLI Without GUI (Next Lecture) ## Listing Processes from the Command Line — ps ## Why This Lecture Matters ## What Is ps? ## Basic Usage (Default Behavior) ## Command ## What it shows ## Demonstrating Process Hierarchy ## Example: Bash inside Bash ## Showing All Processes (All Users & Sessions) ## Command ## Meaning ## Real Example ## Full Format Output (-f) ## Command ## Why use it? ## Example Interpretation ## Process Hierarchy (Tree View) ## Linux only ## What it shows ## Filtering Specific Processes ## By Process ID ## Finding Child Processes (Using grep) ## Practical Solution ## Paging Long Output (less) ## Command ## Long Format (-l) ## Command ## Combine options ## Summary of Common Linux ps Options ## ps on macOS (Important Differences) ## Why Behavior Is Different ## Default macOS Behavior ## Command ## What it shows on macOS ## Why ps Doesn’t Show Itself on macOS ## Full Output on macOS ## Linux-Like Output on macOS ## Meaning ## Cross-Platform Compatibility (Important Course Note) ## ps Advanced Usage, Multitasking, and Process Priority (Niceness) ## 1. Two Styles of ps Parameters ## 2. BSD Style ps Parameters ## Key Differences ## Common BSD Example: ps aux ## Result ## BSD vs POSIX Comparison ## Important Rule ## Practical Advice ## 3. Why Multitasking Works (Single CPU Example) ## Answer: Scheduling ## 4. Scheduler and Context Switching ## Context Switch ## 5. Observing Context Switches (/proc) ## Example ## Live Monitoring with watch ## 6. Process Priority (Niceness) ## Yes — with niceness ## Niceness Scale ## Permissions Rule ## 7. Starting a Process with Priority (nice) ## Low priority ## Attempt high priority (fails as user) ## High priority (allowed with sudo) ## 8. Changing Priority of Running Process (renice) ## Find PID ## Increase niceness (allowed) ## Decrease niceness (requires root) ## 9. Real Proof: CPU Benchmark Test ## Install benchmark tool ## Single Benchmark ## Competing Benchmarks with Different Priorities ## Result ## 10. Important Clarification ## 11. When Niceness Matters in Real Life ## Finding Process IDs Easily & Introduction to Signals ## Why Finding the Process ID (PID) Matters ## The Problem with ps | grep ## The Solution: pgrep ## What Is pgrep? ## Why pgrep Returns Only the Main Firefox Process ## Matching Full Command Lines (-f) ## Combining pgrep with renice (Very Important) ## Why This Is Powerful ## Example: Lower Firefox Priority ## Applying to All Firefox Processes ## Key Takeaway (PID Handling) ## Introduction to Signals ## What Are Signals? ## Why Signals Exist ## Common Signal Sources ## Common Signals (Conceptual) ## You Have Already Used Signals (Ctrl + C) ## Example: wget ## What Happens When SIGINT Is Sent? ## Important Concept: Signal Handling ## Why Signals Are Powerful ## The kill Command and Linux Signals (Practical Process Control) ## What Is the kill Command (Really)? ## Sending Signals Without the Keyboard ## Basic kill Syntax ## Sending SIGINT from Another Terminal ## Listing Available Signals ## The Most Important Signals (You Must Know These) ## SIGTERM — Graceful Shutdown (Default) ## Meaning ## Commands ## Why It Matters ## SIGINT vs SIGTERM ## SIGKILL — Force Termination ## Meaning ## Commands ## When to Use ## Why SIGKILL Is Dangerous ## Real Example: Why Vim Is “Hard to Quit” ## SIGHUP — Hangup Signal ## Meaning (Typical) ## Behavior ## Example ## For Daemons ## SIGSTOP — Pause a Process ## Meaning ## Example ## SIGCONT — Resume a Process ## Visual Demo with cmatrix / ping ## Pausing Network Programs (Important Insight) ## kill Built-in vs Executable, killall, Process Lifecycle, and top ## 1. kill Exists Twice: Built-in vs Executable ## Check with type ## Why This Matters ## 2. Locating the Executable kill ## 3. Comparing Built-in vs Executable kill ## Built-in ## Executable ## 4. killall — Send Signals by Process Name ## Basic Usage ## Sending Specific Signals ## Linux (preferred) ## Portable (Linux + macOS) ## 5. Process Exit and Exit Codes ## Exit Code ## 6. Parent Responsibility & Reaping ## 7. Orphan Processes ## 8. Zombie Processes ## Characteristics ## Viewing Zombies ## 9. Process States (You Must Know These) ## View states ## Important Clarifications ## 10. Introducing top — CLI System Monitor ## Start top ## 11. Understanding top Header ## Load Average ## CPU Breakdown ## Memory ## 12. top Requires Privileges ## 13. top Startup Options ## 14. Interactive top Controls (Very Important) ## Kill from top ## Renice from top ## 15. Saving top Configuration ## 16. top vs htop ## htop — Interactive Process Monitor (Practical Guide) ## 1. Installing htop ## Ubuntu / Debian ## CentOS / RHEL (EPEL required) ## 2. Starting htop ## 3. Understanding the htop Interface ## Top Section (System Overview) ## Process List ## 4. Navigating htop ## Keyboard Navigation ## 5. Changing Process Priority (Niceness) ## Increase niceness (lower priority) ## Decrease niceness (higher priority) ## 6. Sending Signals (Killing Processes) ## 7. Tree View (Process Hierarchy) ## 8. Configuration & Customization (Setup Menu) ## What You Can Customize ## Meters (Top Section) ## Display Options ## Colors ## 9. Saving Configuration ## Quit without saving ## Quit and save configuration ## 10. htop vs top — When to Use Which ## Recommendation ## Bash Job Control — Foreground, Background, Suspend & Resume ## 1. What is a job in Bash? ## Example ## 2. Foreground Jobs ## Example ## 3. Background Jobs (&) ## 4. Background Output & Redirection ## Without redirection (messy) ## Redirect output to file ## Discard output completely ## 5. Job Completion Messages ## 6. Background Jobs with Pipelines ## 7. Listing Jobs — jobs ## 8. Bringing Jobs to Foreground — fg ## Bring current job ## Bring specific job ## 9. Suspending a Foreground Job (Ctrl+Z) ## 10. Resuming Suspended Jobs ## Resume in background ## Resume in foreground ## 11. Killing Jobs (Job IDs) ## Force kill ## 12. Bash Built-in vs System kill ## 13. Keyboard Input Rule (Critical) ## 14. Controlling Background Output — stty tostop ## Problem ## Solution ## 15. Using stty tostop in Practice ## 16. Disable stty tostop ## 17. Mental Model (Very Important) ## Waiting for Background Jobs in Bash (wait) ## 1. The Problem ## 2. The wait Command (Basics) ## Wait for all background jobs ## Wait for a specific PID ## Wait for a specific job ## Wait until any job finishes ## 3. Practical Example — Waiting for Multiple Jobs ## 4. Running Commands After All Jobs Finish ## 5. Using ; to Chain Commands ## 6. Audible Notification When Jobs Finish (Bell) ## Terminal bell (if supported) ## Example: Notify When All Jobs Finish ## 7. Why wait Is Especially Useful in Scripts ## Keeping Jobs Running After Logout — nohup ## 8. The Problem ## 9. The nohup Command ## 10. Basic nohup Usage ## 11. Verifying It Still Runs ## 12. Understanding the Three Variants (Very Important) ## 1️⃣ nohup command ## 2️⃣ command & ## 3️⃣ nohup command & (Most common) ## 13. Why nohup + & Is Usually Used Together ## 14. What Happens to the Parent Process? ## 15. Killing a nohup Process ## 16. Mental Model (Final Summary) ## Linux Package Management (Debian / Ubuntu) ## 1. dpkg — The Lowest Level Package Manager ## What is dpkg? ## Installing a .deb File Manually ## Removing a Package Installed via dpkg ## 2. What Is Inside a .deb File? ## 1️⃣ data.tar.* ## 2️⃣ control.tar.* ## 3️⃣ debian-binary ## 3. Why dpkg Is Not Enough ## APT — Advanced Package Tool ## 4. apt vs apt-get ## 5. Repository Configuration ## Main file ## Additional repositories ## Repository Line Structure ## 6. Ubuntu Repository Components ## 7. Updating Package Lists ## 8. Installing Software with APT ## Recommended Packages ## 9. Keeping the System Up to Date ## Standard Upgrade (Safe) ## Full Upgrade / Dist Upgrade (Advanced) ## 10. Removing Unused Dependencies ## Custom (Third-Party) Repositories ## 11. Why Add Third-Party Repositories? ## 12. Security Model — GPG Keys ## 13. Repository Entry Types ## Old format (single line) ## Modern format (preferred) ## Example: WineHQ Repository ## 14. Why Wine Needs a Third-Party Repo ## Steps (Conceptual) ## 15. Real-World Result ## 16. Important Warning (Production Reality) ## Summary — What You Now Understand ## Package Layers ## Ubuntu Package Management – PPAs, Verification, Dependencies, Reconfiguration, and Snap ## 1. PPAs (Personal Package Archives) ## What is a PPA? ## Why Use a PPA? ## 2. Example: Installing a Newer PHP via PPA ## Default PHP Version ## Finding a PPA ## Adding the PPA ## Installing PHP from the PPA ## Removing a PPA Safely ## 3. Security Reality of PPAs ## 4. Package Verification with debsums ## What is debsums? ## Common Options ## Verify System Files ## What debsums Does NOT Detect ## When to Use debsums ## 5. Dependency Management in APT ## Viewing Dependencies ## Dependency Types ## 6. Dependency Conflict Example ## Resolvable Case ## Unresolvable Case (Hypothetical) ## 7. Breaking the System (What NOT to Do) ## 8. Fixing Dependency Issues ## Automatic Repair ## Other Recovery Steps ## 9. Best Practices to Avoid Dependency Hell ## 10. Reconfiguring Packages with dpkg-reconfigure ## Why Reconfigure? ## Reconfigure a Package ## 11. Example: Locales (Internationalization) ## Generate New Locales ## 12. Snap Packages (Alternative Packaging System) ## Why Snap Exists ## Installing a Snap ## Where Snaps Live ## Executables ## Advantages of Snap ## Tradeoffs ## 13. When to Use Snap vs APT ## 16. Snap Packages (Alternative Model) ## What Is Snap? ## Important Enterprise Warning ## 17. Why Snap Exists ## 18. Installing Snap on CentOS Stream ## 19. Installing Software via Snap ## Example: Latest Firefox ## Running Snap Applications ## 20. When to Use Snap A process is an instance of a program in execution. Once a program starts running, it becomes a process. Each process behaves like it has its own system: From the process point of view: The kernel is the lowest level of the operating system. Think of it as a bridge between: (You will study this in more detail later.) Linux processes are organized as a tree. When you open Firefox: Enabling “Show dependencies” displays the process tree Enabling “All processes” shows system-wide processes This visually proves: You create this hierarchy: Understanding processes helps you: Every tool you use later (ps, top, htop, kill, systemctl) builds on this concept. In real servers and cloud environments: The ps command is one of the most fundamental Linux/Unix tools for: ps stands for Process Status. By default, ps follows the POSIX standard (on Linux): Adds important columns: This is extremely useful on servers without a GUI. Shows only that process, not its children. There is no perfect built-in child-only filter with ps. Adds even more columns: Linux allows flexible combination of flags. macOS and Linux are both Unix, but: This affects default ps output. Even if processes are in: This is different from Linux. This often confuses beginners. To match Linux default behavior: The flags shown in this course: So far, we used Unix (POSIX) style parameters: However, ps also supports BSD style parameters. This is extremely common in documentation and forums. Once you use one BSD-style option, ps switches to BSD mode Behaves differently than: How can multiple programs run? This creates the illusion of parallel execution. Each time the CPU switches from one process to another, it performs a: Linux exposes process details via: This visually proves multitasking. Now that we understand scheduling, the next question is: Can we influence how much CPU time a process gets? To prove niceness works, we must: Works normally — no competition. High-priority process: Low-priority process: Huge difference, same hardware. Niceness does NOT make your CPU faster Many Linux operations require a PID, for example: This is error-prone and inefficient, especially in production. pgrep searches running processes by name and prints only their PIDs. That is the main Firefox process ID. Firefox helper processes often have names like: Only the main process is named firefox This makes pgrep clean and reliable. If you want all Firefox-related processes: Shell expansion allows: This would be treated as one string, not multiple PIDs. Signals are special messages sent to processes. From a human perspective: Signals are delivered at a convenient execution point Signals can come from: If a program does nothing: They are core to Linux process control. Despite its name, kill does not kill processes by default. What it actually does: kill = signal sender, not a murder weapon Previously, you used: To send signals from anywhere, we use kill. Short form (also valid): If no signal is specified, kill sends: Focus on the important ones. “Please terminate when ready.” Databases expect SIGTERM. “You are terminated immediately.” ✔️ Always works (but unsafe) Why terminals break afterward: Pause execution (not terminate) Same idea works with: This is real-world behavior, not a bug. In Bash (and other shells), many commands exist in two forms: The built-in hides the executable by default. To find the executable version: ⚠️ Important
If output looks different across systems or shells, this is normal, not an error. killall sends signals by process name, not PID. When a process exits: In Bash, the parent can read the child’s exit code: This is called process reaping. If the parent exits before the child: Firefox continues running. ⚠️ Excessive zombies → buggy parent process When servers have no GUI, top replaces System Monitor. Average number of CPU cores in use To see all processes, start it with root privileges: This gives you an instant health overview of the system. This alone makes htop much easier than top. Toggle again to return to normal view. Saved configuration is: Use htop whenever possible
Know top for interviews and restricted environments A job is a command line executed by the shell. Important distinction: Bash manages jobs, not individual processes. Only one foreground job can exist per shell. To run a job in the background, append &: Output interleaves → confusing. When a background job finishes: While a job runs in the foreground: To kill a job, not a PID: Job control works only with Bash’s built-in kill. Only foreground jobs receive keyboard input Enable automatic stop on output: Job immediately stops again on output. Now background jobs can output freely again. You start multiple background jobs and want to: Start three background jobs: Bash executes commands sequentially. You can notify yourself when jobs complete. In scripts, wait allows: Location of nohup.out: Or from another terminal: 👉 Production standard: When you close the terminal: This is why the process survives. Since it’s no longer a job: A .deb file is an archive containing: 📌 You can inspect .deb files using an archive manager. APT sits on top of dpkg and adds: APT gets packages from repositories defined in: 💡 Default configuration is recommended unless you know why you’re changing it. Before installing or upgrading: APT installs recommended packages by default. 📌 Use during maintenance windows. After upgrades, unused libraries remain. Default repositories may contain: Use third-party repos when you need: When adding a repository: ⚠️ A trusted repository can: 1️⃣ Enable 32-bit architecture
2️⃣ Add WineHQ GPG key
3️⃣ Add WineHQ repository
4️⃣ Update package lists
5️⃣ Install WineHQ Adding third-party repositories: Official Ubuntu repositories often provide: PPAs are useful when you need: Removing the PPA does NOT remove installed packages. ⚠️ Key lesson
Removing a repository does not downgrade or remove packages automatically. It only checks files installed by .deb packages. Example attack it won’t catch: ⚠️ Important
debsums ≠ full system integrity tool APT resolves automatically. Installing incompatible .deb manually: Accessible via $PATH: Traditional Linux packages: Snap Firefox version: Templates let you quickly answer FAQs or store snippets for re-use. Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink. Hide child comments as well For further actions, you may consider blocking this person and/or reporting abuse CODE_BLOCK:
terminal-server └── bash └── bash └── ping Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
terminal-server └── bash └── bash └── ping CODE_BLOCK:
terminal-server └── bash └── bash └── ping CODE_BLOCK:
ps Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
bash
ps Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
ps -e Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
ps -A Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
ps -e Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
ps -ef Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
ps -ef --forest Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
ps -ef --forest CODE_BLOCK:
ps -ef --forest CODE_BLOCK:
ps -fp <PID> Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
ps -fp <PID> CODE_BLOCK:
ps -fp <PID> CODE_BLOCK:
ps -fp 1234 Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
ps -fp 1234 CODE_BLOCK:
ps -fp 1234 CODE_BLOCK:
ps -ef | grep firefox Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
ps -ef | grep firefox CODE_BLOCK:
ps -ef | grep firefox CODE_BLOCK:
ps -ef | less Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
ps -ef | less CODE_BLOCK:
ps -ef | less CODE_BLOCK:
ps -el Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
ps -elf
ps -elF
ps -eFl Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
ps -elf
ps -elF
ps -eFl CODE_BLOCK:
ps -elf
ps -elF
ps -eFl CODE_BLOCK:
ps Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
ps -f Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
ps -T Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
ps -ef
ps -e -f Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
ps -ef
ps -e -f CODE_BLOCK:
ps -ef
ps -e -f CODE_BLOCK:
ps aux Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
ps aux # BSD style
ps -ef # POSIX style Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
ps aux # BSD style
ps -ef # POSIX style COMMAND_BLOCK:
ps aux # BSD style
ps -ef # POSIX style CODE_BLOCK:
ps auxf Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
ps -ef --forest Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
ps -ef --forest CODE_BLOCK:
ps -ef --forest CODE_BLOCK:
/proc/<PID>/status Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
/proc/<PID>/status CODE_BLOCK:
/proc/<PID>/status CODE_BLOCK:
cat /proc/49225/status | grep ctxt Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
cat /proc/49225/status | grep ctxt CODE_BLOCK:
cat /proc/49225/status | grep ctxt CODE_BLOCK:
watch -n 0.5 grep ctxt /proc/49225/status Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
watch -n 0.5 grep ctxt /proc/49225/status CODE_BLOCK:
watch -n 0.5 grep ctxt /proc/49225/status CODE_BLOCK:
nice -n 19 gedit Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
nice -n 19 gedit CODE_BLOCK:
nice -n 19 gedit CODE_BLOCK:
nice -n -10 gedit Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
nice -n -10 gedit CODE_BLOCK:
nice -n -10 gedit COMMAND_BLOCK:
sudo nice -n -10 gedit Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
sudo nice -n -10 gedit COMMAND_BLOCK:
sudo nice -n -10 gedit CODE_BLOCK:
ps -ef | grep gedit Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
ps -ef | grep gedit CODE_BLOCK:
ps -ef | grep gedit CODE_BLOCK:
renice 10 -p 68836 Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
renice 10 -p 68836 CODE_BLOCK:
renice 10 -p 68836 COMMAND_BLOCK:
sudo renice -10 -p 68836 Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
sudo renice -10 -p 68836 COMMAND_BLOCK:
sudo renice -10 -p 68836 COMMAND_BLOCK:
sudo apt update
sudo apt install sysbench Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
sudo apt update
sudo apt install sysbench COMMAND_BLOCK:
sudo apt update
sudo apt install sysbench CODE_BLOCK:
sysbench cpu --threads=10 run Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
sysbench cpu --threads=10 run CODE_BLOCK:
sysbench cpu --threads=10 run CODE_BLOCK:
#!/bin/bash
nice -n 19 sysbench cpu --threads=10 run &
sysbench cpu --threads=10 run & Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
#!/bin/bash
nice -n 19 sysbench cpu --threads=10 run &
sysbench cpu --threads=10 run & CODE_BLOCK:
#!/bin/bash
nice -n 19 sysbench cpu --threads=10 run &
sysbench cpu --threads=10 run & CODE_BLOCK:
chmod +x bench.sh
./bench.sh Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
chmod +x bench.sh
./bench.sh CODE_BLOCK:
chmod +x bench.sh
./bench.sh CODE_BLOCK:
ps -ef | grep firefox Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
ps -ef | grep firefox CODE_BLOCK:
ps -ef | grep firefox CODE_BLOCK:
pgrep firefox Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
pgrep firefox CODE_BLOCK:
pgrep firefox CODE_BLOCK:
1910 Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
pgrep -f firefox Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
pgrep -f firefox CODE_BLOCK:
pgrep -f firefox CODE_BLOCK:
renice 19 $(pgrep firefox) Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
renice 19 $(pgrep firefox) CODE_BLOCK:
renice 19 $(pgrep firefox) CODE_BLOCK:
renice 19 $(pgrep -f firefox) Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
renice 19 $(pgrep -f firefox) CODE_BLOCK:
renice 19 $(pgrep -f firefox) COMMAND_BLOCK:
# WRONG
renice 19 "$(pgrep firefox)" Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
# WRONG
renice 19 "$(pgrep firefox)" COMMAND_BLOCK:
# WRONG
renice 19 "$(pgrep firefox)" COMMAND_BLOCK:
wget bigfile.iso Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
wget bigfile.iso COMMAND_BLOCK:
wget bigfile.iso CODE_BLOCK:
Ctrl + C Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
SIGINT Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
Ctrl + C Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
SIGINT Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
kill -s SIGNAL PID Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
kill -s SIGNAL PID CODE_BLOCK:
kill -s SIGNAL PID CODE_BLOCK:
kill -s SIGINT 1234
kill -s SIGTERM 1234
kill -s SIGKILL 1234 Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
kill -s SIGINT 1234
kill -s SIGTERM 1234
kill -s SIGKILL 1234 CODE_BLOCK:
kill -s SIGINT 1234
kill -s SIGTERM 1234
kill -s SIGKILL 1234 CODE_BLOCK:
kill -SIGINT 1234 Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
kill -SIGINT 1234 CODE_BLOCK:
kill -SIGINT 1234 CODE_BLOCK:
SIGTERM (15) Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
SIGTERM (15) CODE_BLOCK:
SIGTERM (15) COMMAND_BLOCK:
wget largefile.iso Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
wget largefile.iso COMMAND_BLOCK:
wget largefile.iso CODE_BLOCK:
pgrep wget Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
kill -s SIGINT $(pgrep wget) Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
kill -s SIGINT $(pgrep wget) CODE_BLOCK:
kill -s SIGINT $(pgrep wget) CODE_BLOCK:
kill -l Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
kill PID
kill -s SIGTERM PID
kill -15 PID Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
kill PID
kill -s SIGTERM PID
kill -15 PID CODE_BLOCK:
kill PID
kill -s SIGTERM PID
kill -15 PID CODE_BLOCK:
kill -s SIGKILL PID
kill -9 PID Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
kill -s SIGKILL PID
kill -9 PID CODE_BLOCK:
kill -s SIGKILL PID
kill -9 PID CODE_BLOCK:
kill -s SIGTERM PID Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
kill -s SIGTERM PID CODE_BLOCK:
kill -s SIGTERM PID CODE_BLOCK:
kill -9 PID Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
kill -9 PID CODE_BLOCK:
kill -9 PID COMMAND_BLOCK:
gedit
# close terminal Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
gedit
# close terminal COMMAND_BLOCK:
gedit
# close terminal CODE_BLOCK:
kill -s SIGSTOP PID Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
kill -s SIGSTOP PID CODE_BLOCK:
kill -s SIGSTOP PID CODE_BLOCK:
kill -s SIGCONT PID Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
kill -s SIGCONT PID CODE_BLOCK:
kill -s SIGCONT PID CODE_BLOCK:
cmatrix Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
kill -s SIGSTOP $(pgrep cmatrix) Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
kill -s SIGSTOP $(pgrep cmatrix) CODE_BLOCK:
kill -s SIGSTOP $(pgrep cmatrix) CODE_BLOCK:
kill -s SIGCONT $(pgrep cmatrix) Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
kill -s SIGCONT $(pgrep cmatrix) CODE_BLOCK:
kill -s SIGCONT $(pgrep cmatrix) CODE_BLOCK:
ping google.com Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
ping google.com CODE_BLOCK:
ping google.com CODE_BLOCK:
type kill Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
kill is a shell builtin Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
kill is a shell builtin CODE_BLOCK:
kill is a shell builtin COMMAND_BLOCK:
type cut
# cut is /usr/bin/cut type echo
# echo is a shell builtin Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
type cut
# cut is /usr/bin/cut type echo
# echo is a shell builtin COMMAND_BLOCK:
type cut
# cut is /usr/bin/cut type echo
# echo is a shell builtin CODE_BLOCK:
which kill Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
kill -l Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
/bin/kill -l Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
/bin/kill -l CODE_BLOCK:
/bin/kill -l CODE_BLOCK:
killall firefox Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
killall firefox CODE_BLOCK:
killall firefox CODE_BLOCK:
killall -s SIGINT firefox Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
killall -s SIGINT firefox CODE_BLOCK:
killall -s SIGINT firefox CODE_BLOCK:
killall -SIGINT firefox Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
killall -SIGINT firefox CODE_BLOCK:
killall -SIGINT firefox CODE_BLOCK:
echo $? Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
ls missingfile
echo $?
# 1 Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
ls missingfile
echo $?
# 1 COMMAND_BLOCK:
ls missingfile
echo $?
# 1 CODE_BLOCK:
nohup firefox &
exit Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
nohup firefox &
exit CODE_BLOCK:
nohup firefox &
exit CODE_BLOCK:
ps -el | grep Z Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
ps -el | grep Z CODE_BLOCK:
ps -el | grep Z CODE_BLOCK:
ps -el Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
top Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
load average: 0.37, 0.21, 0.15 Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
load average: 0.37, 0.21, 0.15 CODE_BLOCK:
load average: 0.37, 0.21, 0.15 CODE_BLOCK:
top
sudo top Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
top
sudo top CODE_BLOCK:
top
sudo top COMMAND_BLOCK:
top -u username # only user processes
top -d 1 # refresh every second
top -i # hide idle
top -c # full command Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
top -u username # only user processes
top -d 1 # refresh every second
top -i # hide idle
top -c # full command COMMAND_BLOCK:
top -u username # only user processes
top -d 1 # refresh every second
top -i # hide idle
top -c # full command COMMAND_BLOCK:
sudo top -d 1 -i -c Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
sudo top -d 1 -i -c COMMAND_BLOCK:
sudo top -d 1 -i -c CODE_BLOCK:
Shift + W Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
sudo apt install htop Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
sudo apt install htop COMMAND_BLOCK:
sudo apt install htop COMMAND_BLOCK:
sudo dnf install htop Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
sudo dnf install htop COMMAND_BLOCK:
sudo dnf install htop CODE_BLOCK:
htop Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
sudo htop Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
F8 Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
F7 Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
F9 Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
F5 Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
F2 Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
Ctrl + C Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
F10 Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
ping google.com | wc -l Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
ping google.com | wc -l CODE_BLOCK:
ping google.com | wc -l CODE_BLOCK:
ping google.com Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
ping google.com CODE_BLOCK:
ping google.com CODE_BLOCK:
ping -c 10 google.com & Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
ping -c 10 google.com & CODE_BLOCK:
ping -c 10 google.com & CODE_BLOCK:
[1] 12345 Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
ping google.com &
ls Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
ping google.com &
ls CODE_BLOCK:
ping google.com &
ls COMMAND_BLOCK:
ping google.com > ping.txt & Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
ping google.com > ping.txt & COMMAND_BLOCK:
ping google.com > ping.txt & COMMAND_BLOCK:
ping google.com > /dev/null & Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
ping google.com > /dev/null & COMMAND_BLOCK:
ping google.com > /dev/null & COMMAND_BLOCK:
ping -c 5 google.com > /dev/null &
echo Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
ping -c 5 google.com > /dev/null &
echo COMMAND_BLOCK:
ping -c 5 google.com > /dev/null &
echo CODE_BLOCK:
[1]+ Done ping -c 5 google.com Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
[1]+ Done ping -c 5 google.com CODE_BLOCK:
[1]+ Done ping -c 5 google.com CODE_BLOCK:
ping -c 100 google.com | wc -l & Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
ping -c 100 google.com | wc -l & CODE_BLOCK:
ping -c 100 google.com | wc -l & CODE_BLOCK:
jobs Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
[1]- Running ping google.com > /dev/null &
[2]+ Running ping bing.com > /dev/null & Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
[1]- Running ping google.com > /dev/null &
[2]+ Running ping bing.com > /dev/null & COMMAND_BLOCK:
[1]- Running ping google.com > /dev/null &
[2]+ Running ping bing.com > /dev/null & CODE_BLOCK:
fg Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
fg %1 Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
Ctrl + Z Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
jobs Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
[1]+ Stopped ping google.com Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
[1]+ Stopped ping google.com CODE_BLOCK:
[1]+ Stopped ping google.com CODE_BLOCK:
bg %1 Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
fg %1 Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
kill %1 Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
kill -SIGKILL %1 Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
kill -SIGKILL %1 CODE_BLOCK:
kill -SIGKILL %1 CODE_BLOCK:
kill %1 Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
/bin/kill %1 Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
/bin/kill %1 CODE_BLOCK:
/bin/kill %1 CODE_BLOCK:
stty tostop Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
stty tostop CODE_BLOCK:
stty tostop CODE_BLOCK:
jobs Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
stty tostop
ping google.com & Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
stty tostop
ping google.com & CODE_BLOCK:
stty tostop
ping google.com & CODE_BLOCK:
Stopped ping google.com Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
Stopped ping google.com CODE_BLOCK:
Stopped ping google.com CODE_BLOCK:
fg Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
Ctrl + Z Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
bg Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
stty -tostop Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
stty -tostop CODE_BLOCK:
stty -tostop CODE_BLOCK:
wait Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
wait 12345 Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
wait %1 Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
wait -n Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
ping -c 5 google.com > /dev/null &
ping -c 5 google.com > /dev/null &
ping -c 5 google.com > /dev/null & Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
ping -c 5 google.com > /dev/null &
ping -c 5 google.com > /dev/null &
ping -c 5 google.com > /dev/null & COMMAND_BLOCK:
ping -c 5 google.com > /dev/null &
ping -c 5 google.com > /dev/null &
ping -c 5 google.com > /dev/null & CODE_BLOCK:
jobs Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
wait Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
ping -c 5 google.com > /dev/null &
ping -c 5 google.com > /dev/null &
ping -c 5 google.com > /dev/null & wait
echo "All jobs finished" Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
ping -c 5 google.com > /dev/null &
ping -c 5 google.com > /dev/null &
ping -c 5 google.com > /dev/null & wait
echo "All jobs finished" COMMAND_BLOCK:
ping -c 5 google.com > /dev/null &
ping -c 5 google.com > /dev/null &
ping -c 5 google.com > /dev/null & wait
echo "All jobs finished" CODE_BLOCK:
wait; echo "Done" Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
wait; echo "Done" CODE_BLOCK:
wait; echo "Done" CODE_BLOCK:
tput bel Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
ping -c 5 google.com > /dev/null &
ping -c 5 google.com > /dev/null &
ping -c 5 google.com > /dev/null & wait
tput bel
echo "All downloads completed" Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
ping -c 5 google.com > /dev/null &
ping -c 5 google.com > /dev/null &
ping -c 5 google.com > /dev/null & wait
tput bel
echo "All downloads completed" COMMAND_BLOCK:
ping -c 5 google.com > /dev/null &
ping -c 5 google.com > /dev/null &
ping -c 5 google.com > /dev/null & wait
tput bel
echo "All downloads completed" CODE_BLOCK:
task1 &
task2 &
task3 &
wait
cleanup Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
task1 &
task2 &
task3 &
wait
cleanup CODE_BLOCK:
task1 &
task2 &
task3 &
wait
cleanup CODE_BLOCK:
nohup ping -c 100 google.com & Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
nohup ping -c 100 google.com & CODE_BLOCK:
nohup ping -c 100 google.com & CODE_BLOCK:
ps -p <PID> Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
ps -p <PID> CODE_BLOCK:
ps -p <PID> CODE_BLOCK:
ps aux | grep ping Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
ps aux | grep ping CODE_BLOCK:
ps aux | grep ping CODE_BLOCK:
nohup ping google.com Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
nohup ping google.com CODE_BLOCK:
nohup ping google.com CODE_BLOCK:
ping google.com & Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
ping google.com & CODE_BLOCK:
ping google.com & CODE_BLOCK:
nohup ping google.com & Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
nohup ping google.com & CODE_BLOCK:
nohup ping google.com & CODE_BLOCK:
nohup script.sh & Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
nohup script.sh & CODE_BLOCK:
nohup script.sh & CODE_BLOCK:
kill <PID> Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
kill -9 <PID> Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
kill -9 <PID> CODE_BLOCK:
kill -9 <PID> COMMAND_BLOCK:
sudo dpkg -i package.deb Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
sudo dpkg -i package.deb COMMAND_BLOCK:
sudo dpkg -i package.deb COMMAND_BLOCK:
sudo dpkg -r package-name Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
sudo dpkg -r package-name COMMAND_BLOCK:
sudo dpkg -r package-name COMMAND_BLOCK:
sudo dpkg -r neofetch Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
sudo dpkg -r neofetch COMMAND_BLOCK:
sudo dpkg -r neofetch CODE_BLOCK:
/etc/apt/sources.list Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
/etc/apt/sources.list CODE_BLOCK:
/etc/apt/sources.list CODE_BLOCK:
/etc/apt/sources.list.d/*.list Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
/etc/apt/sources.list.d/*.list CODE_BLOCK:
/etc/apt/sources.list.d/*.list CODE_BLOCK:
deb http://archive.ubuntu.com/ubuntu jammy main restricted Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
deb http://archive.ubuntu.com/ubuntu jammy main restricted CODE_BLOCK:
deb http://archive.ubuntu.com/ubuntu jammy main restricted COMMAND_BLOCK:
sudo apt update Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
sudo apt update COMMAND_BLOCK:
sudo apt update COMMAND_BLOCK:
sudo apt install neofetch Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
sudo apt install neofetch COMMAND_BLOCK:
sudo apt install neofetch COMMAND_BLOCK:
sudo apt install --no-install-recommends neofetch Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
sudo apt install --no-install-recommends neofetch COMMAND_BLOCK:
sudo apt install --no-install-recommends neofetch COMMAND_BLOCK:
sudo apt upgrade Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
sudo apt upgrade COMMAND_BLOCK:
sudo apt upgrade COMMAND_BLOCK:
sudo apt full-upgrade Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
sudo apt full-upgrade COMMAND_BLOCK:
sudo apt full-upgrade COMMAND_BLOCK:
sudo apt-get dist-upgrade Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
sudo apt-get dist-upgrade COMMAND_BLOCK:
sudo apt-get dist-upgrade COMMAND_BLOCK:
sudo apt autoremove Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
sudo apt autoremove COMMAND_BLOCK:
sudo apt autoremove CODE_BLOCK:
deb http://example.com jammy main Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
deb http://example.com jammy main CODE_BLOCK:
deb http://example.com jammy main CODE_BLOCK:
Types: deb
URIs: https://example.com
Suites: jammy
Components: main
Signed-By: /usr/share/keyrings/example.gpg Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
Types: deb
URIs: https://example.com
Suites: jammy
Components: main
Signed-By: /usr/share/keyrings/example.gpg CODE_BLOCK:
Types: deb
URIs: https://example.com
Suites: jammy
Components: main
Signed-By: /usr/share/keyrings/example.gpg COMMAND_BLOCK:
sudo apt update
sudo apt install winehq-stable Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
sudo apt update
sudo apt install winehq-stable COMMAND_BLOCK:
sudo apt update
sudo apt install winehq-stable CODE_BLOCK:
APT → dpkg → filesystem Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
APT → dpkg → filesystem CODE_BLOCK:
APT → dpkg → filesystem CODE_BLOCK:
https://launchpad.net Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
https://launchpad.net CODE_BLOCK:
https://launchpad.net COMMAND_BLOCK:
apt show php Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
apt show php COMMAND_BLOCK:
apt show php CODE_BLOCK:
ppa:ondrej/php Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
ppa:ondrej/php CODE_BLOCK:
ppa:ondrej/php COMMAND_BLOCK:
sudo add-apt-repository ppa:ondrej/php
sudo apt update Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
sudo add-apt-repository ppa:ondrej/php
sudo apt update COMMAND_BLOCK:
sudo add-apt-repository ppa:ondrej/php
sudo apt update COMMAND_BLOCK:
sudo apt install php
php --version Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
sudo apt install php
php --version COMMAND_BLOCK:
sudo apt install php
php --version COMMAND_BLOCK:
sudo add-apt-repository --remove ppa:ondrej/php Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
sudo add-apt-repository --remove ppa:ondrej/php COMMAND_BLOCK:
sudo add-apt-repository --remove ppa:ondrej/php COMMAND_BLOCK:
sudo apt remove php
sudo apt autoremove
sudo apt install php Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
sudo apt remove php
sudo apt autoremove
sudo apt install php COMMAND_BLOCK:
sudo apt remove php
sudo apt autoremove
sudo apt install php COMMAND_BLOCK:
sudo apt install debsums Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
sudo apt install debsums COMMAND_BLOCK:
sudo apt install debsums COMMAND_BLOCK:
sudo debsums -as Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
sudo debsums -as COMMAND_BLOCK:
sudo debsums -as CODE_BLOCK:
/etc/crontab Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
/etc/crontab CODE_BLOCK:
/etc/crontab COMMAND_BLOCK:
sudo touch /usr/local/bin/apt
sudo chmod +x /usr/local/bin/apt Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
sudo touch /usr/local/bin/apt
sudo chmod +x /usr/local/bin/apt COMMAND_BLOCK:
sudo touch /usr/local/bin/apt
sudo chmod +x /usr/local/bin/apt COMMAND_BLOCK:
apt show bash Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
apt show bash COMMAND_BLOCK:
apt show bash COMMAND_BLOCK:
apt-cache show bash Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
apt-cache show bash COMMAND_BLOCK:
apt-cache show bash CODE_BLOCK:
bash → libc6 >= 2.35
zsh → libc6 >= 2.36 Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
bash → libc6 >= 2.35
zsh → libc6 >= 2.36 CODE_BLOCK:
bash → libc6 >= 2.35
zsh → libc6 >= 2.36 CODE_BLOCK:
bash → libc6 == 2.35
zsh → libc6 >= 2.36 Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
bash → libc6 == 2.35
zsh → libc6 >= 2.36 CODE_BLOCK:
bash → libc6 == 2.35
zsh → libc6 >= 2.36 COMMAND_BLOCK:
sudo dpkg -i --force-all zsh_old.deb Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
sudo dpkg -i --force-all zsh_old.deb COMMAND_BLOCK:
sudo dpkg -i --force-all zsh_old.deb COMMAND_BLOCK:
sudo apt install -f Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
sudo apt install -f COMMAND_BLOCK:
sudo apt install -f COMMAND_BLOCK:
sudo apt update
sudo apt upgrade Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
sudo apt update
sudo apt upgrade COMMAND_BLOCK:
sudo apt update
sudo apt upgrade COMMAND_BLOCK:
sudo apt autoremove Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
sudo apt autoremove COMMAND_BLOCK:
sudo apt autoremove COMMAND_BLOCK:
sudo dpkg-reconfigure package-name Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
sudo dpkg-reconfigure package-name COMMAND_BLOCK:
sudo dpkg-reconfigure package-name CODE_BLOCK:
date "+%A" Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
Wednesday Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
sudo dpkg-reconfigure locales Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
sudo dpkg-reconfigure locales COMMAND_BLOCK:
sudo dpkg-reconfigure locales CODE_BLOCK:
LANG=de_DE.UTF-8 date "+%A"
Mittwoch Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
LANG=de_DE.UTF-8 date "+%A"
Mittwoch CODE_BLOCK:
LANG=de_DE.UTF-8 date "+%A"
Mittwoch COMMAND_BLOCK:
sudo snap install gimp Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
sudo snap install gimp COMMAND_BLOCK:
sudo snap install gimp CODE_BLOCK:
/var/lib/snapd/snaps/ Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
/var/lib/snapd/snaps/ CODE_BLOCK:
/var/lib/snapd/snaps/ CODE_BLOCK:
/snap/ Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
/snap/gimp/current/ Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
/snap/gimp/current/ CODE_BLOCK:
/snap/gimp/current/ CODE_BLOCK:
/snap/bin/ Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
which gimp Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
sudo dnf install snapd
sudo systemctl enable --now snapd.socket Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
sudo dnf install snapd
sudo systemctl enable --now snapd.socket COMMAND_BLOCK:
sudo dnf install snapd
sudo systemctl enable --now snapd.socket COMMAND_BLOCK:
sudo snap install firefox Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
sudo snap install firefox COMMAND_BLOCK:
sudo snap install firefox CODE_BLOCK:
snap run firefox Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
snap run firefox CODE_BLOCK:
snap run firefox - It can be: A program you start manually (Firefox, Terminal, Bash)
A background service (nginx, sshd, cron)
A helper process started by another program
- A program you start manually (Firefox, Terminal, Bash)
- A background service (nginx, sshd, cron)
- A helper process started by another program - A program you start manually (Firefox, Terminal, Bash)
- A background service (nginx, sshd, cron)
- A helper process started by another program - Assigned CPU time
- Assigned memory
- Its own: Open files
Network connections
Environment variables
- Network connections
- Environment variables - Network connections
- Environment variables - It believes it owns the CPU
- It believes it owns memory
Even though in reality, the kernel shares resources between many processes. - Applications (Firefox, Bash, Ping)
- Hardware (CPU, RAM, Disk, Network) - How much CPU time a process gets
- How much memory it can use
- What happens if it asks for more memory
- Which process runs next - On a phone, the kernel may kill background apps to free memory.
- On a server, it may slow down processes instead. - Running – currently executing
- Sleeping / Waiting – waiting for input or resources
- Stopped – paused
- Zombie – finished execution but not cleaned up - Every process is started by another process
- Except the first system process (init / systemd) - gnome-shell → starts → firefox
- firefox → starts → web content process - A Firefox process is created
- It runs under your user
- It gets memory and CPU
- It may start child processes (tabs, web content) - You can see: PID
Memory usage
Disk usage
User
- Memory usage
- Enabling “Show dependencies” displays the process tree
- Enabling “All processes” shows system-wide processes - Memory usage - Processes have parents
- Applications are not a single process - Open Terminal
- Start another bash
- Run ping google.com - Becomes its own process
- Has its own PID
- Has a parent process - Debug high CPU usage
- Identify memory leaks
- Kill hung processes
- Understand containers and Kubernetes
- Manage system services - There is no GUI
- Everything is done via command line - There is no GUI
- You rely on the command line to inspect running processes - Troubleshooting
- Performance analysis
- Process inspection
- Interview questions - Displays information about running processes
- Works on Linux and macOS
- Behavior is slightly different between platforms (explained later) - Only processes running in the current terminal (TTY)
- Example output: Your shell (bash, zsh)
The ps command itself
- Your shell (bash, zsh)
- The ps command itself - Your shell (bash, zsh)
- The ps command itself - Scope is only the current terminal session - Each shell is a separate process
- Processes form a parent–child hierarchy - -e / -A → All processes
- Includes: Background services
GUI applications
Other terminals
Other users’ processes
- Background services
- GUI applications
- Other terminals
- Other users’ processes - Background services
- GUI applications
- Other terminals
- Other users’ processes - Open Firefox in GUI - Firefox and its helper processes appear - PPID (Parent Process ID)
- Full command path - One main Firefox process
- Multiple child processes
- All child processes share the same PPID - Multi-process browsers
- Process trees
- Application internals - Processes displayed as a tree
- Parent → child relationships
- Same structure you see in GUI system monitors - Lists the main process
- Lists all child/helper processes
- Common real-world technique - Scrollable output
- Full command lines visible
- No live updates (static snapshot) - Process state
- Scheduling info - Linux → POSIX behavior
- macOS → BSD behavior - Processes from all terminals
- But only for the current user
- Even if processes are in: Other tabs
Other terminal windows
- Other terminal windows - Other terminal windows - ps runs with elevated privileges
- Executed as root (UID 0)
- Output filters processes owned by your user
- Therefore: ps does not list itself
- ps does not list itself - ps does not list itself - UID (numeric user ID) - ps runs as UID 0 (root) - Show only processes from current terminal
- Includes processes run as other users
- Makes output consistent with Linux - Work on Linux
- Work on macOS
- Avoid platform-specific options - --forest → Linux only
- BSD alternatives exist but differ - OS documentation
- Platform-specific man pages - Start with a dash (-)
- Can be combined
- Are portable and predictable - Switches ps into BSD mode
- Changes default output behavior
- Some options behave differently than POSIX style - Lists almost all processes
- Shows CPU % and MEM %
- Different default columns than ps -ef - ps aux → CPU & memory usage
- ps -ef → hierarchy, PPID, full command - ps aux → quick system overview
- ps -ef → debugging, hierarchy, scripting
- CPU analysis → use top / htop (not ps) - No hyper-threading - Rapidly switches between processes
- Each process gets a time slice
- Switching happens thousands of times per second - Saves state of current process
- Loads state of next process
- Happens extremely fast - voluntary_ctxt_switches
- nonvoluntary_ctxt_switches - Context switches increasing rapidly
- Especially when the application is active - More nice → more polite → yields CPU
- Less nice → more aggressive → more CPU - Normal users: Can increase niceness (lower priority)
- Can increase niceness (lower priority)
- Root: Can decrease niceness (raise priority)
- Can decrease niceness (raise priority) - Can increase niceness (lower priority) - Can decrease niceness (raise priority) - Fully load the CPU
- Run competing processes - High-priority process: ~15,000 events/sec
- ~15,000 events/sec
- Low-priority process: ~2,000 events/sec
- ~2,000 events/sec - ~15,000 events/sec - ~2,000 events/sec - Changes resource allocation
- Matters only under contention
- Helps control fairness, not performance - Databases vs background jobs
- CI pipelines vs monitoring agents
- Desktop responsiveness
- Batch processing
- Production servers under load - Changing priority (renice)
- Sending signals (kill)
- Debugging or stopping processes - Too much output
- Manual searching
- Easy to pick the wrong PID
- Child processes mixed with main process - pgrep matches the process name
- Firefox helper processes often have names like: Web Content
RDD Process
- Web Content
- RDD Process
- Only the main process is named firefox - Web Content
- RDD Process - Main Firefox
- Helper processes
- Child processes - One command to find PIDs
- Another command to act on them - pgrep firefox → returns PID(s)
- Shell substitutes PID(s)
- renice applies niceness - Changes priority of all Firefox-related processes
- Useful when apps spawn many subprocesses - Interrupt normal execution
- Are delivered by the kernel
- Are handled at a safe point (context switch, I/O, etc.) - Users to stop programs
- Shells to control child processes
- OS to notify processes of errors
- Hardware/CPU events to be handled safely - Window manager
- Other processes
- Kernel / CPU - Terminal is blocked
- You cannot type commands - Terminal sends SIGINT
- Kernel delivers signal
- Process handles the signal
- Program exits gracefully (if supported) - wget: Closes connection
Cleans up partial download
Exits cleanly
- Closes connection
- Cleans up partial download
- Exits cleanly - Closes connection
- Cleans up partial download
- Exits cleanly - Handle signals (clean shutdown)
- Ignore signals
- Override default behavior - Default action applies
- For SIGINT → process terminates - Async control of processes
- Safe interruption
- Communication without polling
- Clean shutdowns - Sends a signal to a process
- The kernel delivers that signal
- The process decides what to do (except for special signals) - This only works in the same terminal
- You cannot use it from another session - Start a download: - In another terminal, find the PID: - Send SIGINT: - Same behavior as Ctrl+C
- Download exits gracefully
- Clean shutdown - Shows all signals supported by the OS
- Linux and macOS outputs differ slightly
- You do NOT need to memorize all of them - Long-running jobs - Allows cleanup
- Flushes data to disk
- Finishes transactions - Can be handled
- Can be ignored
- Are polite requests - Cannot be ignored
- Cannot be handled
- Kernel kills the process directly
- Possible data corruption - Process is stuck
- Process ignores SIGTERM
- System is at risk - Killing a database with SIGKILL
- No data flush
- Possible corruption
- Recovery needed on restart - Only then SIGKILL - Ctrl+C → ignored
- SIGINT → handled internally
- Vim expects :q or :q! - Program didn’t reset terminal state
- Escape sequences not restored
- Solution: open a new terminal - Terminal closed
- Session ended - Child processes receive SIGHUP
- Usually causes them to exit - gedit exits
- SIGHUP delivered automatically - Often means: reload configuration - Cannot be ignored
- Kernel-enforced
- Process freezes completely - CPU usage → 0
- Memory stays allocated
- State → stopped - Process resumes execution
- Continues exactly where it stopped - SIGSTOP freezes the process
- Network connection may stay open
- Remote server may timeout
- Resume behavior depends on server support - Sometimes download resumes
- Sometimes restarts
- Sometimes fails - Shell built-in
- Standalone executable - Built-ins are implemented inside the shell
- Executables are separate programs
- Output and supported options may differ - Linux: /usr/bin/kill
- macOS: /bin/kill - Shows signal names and numbers
- Format depends on shell (bash, zsh) - Different formatting
- Usually fewer details
- Still POSIX-compliant - Sends SIGTERM by default
- All firefox processes terminate - -s means “verbose”, not “signal”
- Always use -SIGNAL form - Memory is freed
- CPU is released
- Process entry remains temporarily - 0 → success
- 1–255 → error - Kernel sends SIGCHLD to parent
- Parent calls wait() / waitpid()
- Exit code is collected
- Process entry is removed - Child becomes an orphan
- Adopted by init / systemd (PID 1 or user session systemd) - Process has exited
- Parent did NOT collect exit code
- Entry remains in process table - No CPU usage
- No memory usage
- Occupies process table slot - Short-lived
- Cleaned automatically - Running ≠ visible GUI
- Sleeping processes are normal
- D state ignores signals until kernel returns
- T can be resumed with SIGCONT
- Z means exit not yet reaped - Last 15 min - us → user space
- sy → kernel space
- wa → I/O wait - Buffers / Cache → reclaimable - Root sees more processes
- Reads /proc/* fully - Enter signal (default SIGTERM) - Enter niceness - Saves layout
- User-specific
- Root and normal user configs differ - htop is easier and richer
- top is guaranteed everywhere - htop is not always installed by default
- Installing it may require permission and repository access
- If you cannot install additional software, you must use top - htop reads process data from /proc
- Some entries require root access - CPU cores (one bar per core)
- Load average (1 / 5 / 15 minutes)
- Memory usage - Scrollable with arrow keys
- Horizontally scrollable to see full commands
- Click column headers to sort
- Mouse support (if terminal allows it) - ↑ ↓ → ← : move around
- Mouse: select, sort, scroll (if supported) - Requires root privileges
- Be careful: selection moves when list refreshes - A signal selection menu appears
- No need to remember signal numbers
- Select: SIGTERM (default, safe) SIGKILL (force, dangerous)
Any other signal
- SIGTERM (default, safe)
- SIGKILL (force, dangerous)
- Any other signal - SIGTERM (default, safe)
- SIGKILL (force, dangerous)
- Any other signal - “Cancel” option - Parent → child relationships
- Who launched whom - Understanding service dependencies - Memory style (bar, graph, LED)
- Add/remove meters
- Move meters left/right - Add CPU frequency
- Add Temperature (on physical servers) - CPU numbering (start at 0 or 1)
- Show/hide kernel threads
- Highlight running processes - Fully customizable color scheme - User-specific
- Separate for: normal user
root (sudo htop)
- normal user
- root (sudo htop) - normal user
- root (sudo htop) - A job can contain multiple processes
- A process is a single running program - ping → one process
- wc → another process
- Together → one job - Occupies the terminal
- Blocks Bash until it finishes
- Receives keyboard input - You cannot type new commands
- Ctrl+C sends SIGINT and stops it - Bash immediately returns control
- Job continues running
- Output still appears in the terminal unless redirected - 12345 → PID (usually last process in pipeline) - Bash prints its status after your next command - Multiple processes → one job
- Bash shows only last PID
- Both processes run concurrently - + → current job (default target)
- - → previous job - Receives keyboard input
- Ctrl+C works
- Terminal is blocked again - Bash sends SIGTSTP
- Job is paused, not terminated
- Control returns to shell - Bash sends SIGCONT
- Program continues execution - Sends SIGTERM
- Requests graceful shutdown - % indicates job ID
- Without %, kill assumes PID - Job IDs exist only inside Bash
- External kill does not understand % - Typed characters - Never receive keyboard input
- Must be brought to foreground first - Background jobs print output
- Output clutters terminal - Any background job that writes output → stopped - Wait until all of them finish
- Or wait for one specific job
- Then run the next command - Multiple downloads
- Parallel builds
- Long-running scripts - Runs in the foreground
- Blocks until all current background jobs change state
- Usually means: they finish - Waits only for that process - % → job ID (Bash job control) - Returns as soon as one background job completes - Bash blocks
- All three pings run in parallel
- wait exits only after all three finish - echo runs only after all background jobs complete - ; → always runs next command after previous finishes
- wait must complete first - Sends a bell escape sequence
- Terminal may: Beep
Flash
Ignore it (depends on settings)
- Ignore it (depends on settings) - Ignore it (depends on settings) - Get notified when done - Many modern terminals disable bells by default
- Check terminal settings if it doesn’t work - Parallel execution
- Controlled synchronization
- Faster execution than sequential logic - When you close a terminal or log out
- Bash sends SIGHUP
- Child processes terminate - Long downloads
- Long scripts
- Remote SSH sessions - Disconnects a process from SIGHUP
- Keeps it running after logout - Process runs in background
- Survives terminal close
- Output redirected to nohup.out - Current directory (if writable)
- Otherwise: $HOME/nohup.out - Closing terminal
- Logging out - Foreground process
- Survives terminal close
- Still receives keyboard signals (Ctrl+C) - Background process
- Dies when terminal closes
- No keyboard input - Survives logout
- No keyboard input
- Ideal for servers - Parent process dies
- Kernel reassigns child to PID 1 - Parent becomes systemd (or init) - Synchronization tool
- Blocks until jobs finish
- Essential for scripts - Prevents termination on logout
- Handles SIGHUP only
- Usually combined with & - dpkg = Debian Package Manager
- Used by Debian, Ubuntu, and derivatives
- Works directly with .deb files
- Does NOT resolve dependencies - Installs files
- Removes files
- Tracks installed packages - -i = install
- Requires root privileges
- Fails if dependencies are missing - Files copied into /
- Example paths: /usr/bin
/etc
/usr/share - Metadata: Package name
Version
Dependencies
- Package name
- Dependencies
- Lifecycle scripts: postinst
prerm
postrm - Package name
- Dependencies - Format version (usually 2.0) - You must manually download .deb files
- Dependencies are not resolved
- Easy to break your system - Dependency resolution
- Repository management
- Secure updates
- Automatic upgrades - Scripts → apt-get
- Manual usage → apt - Use the same config files
- Install the same packages - deb → binary packages
- URL → repository server
- jammy → Ubuntu version
- main restricted → repository components - Downloads package indexes
- Does not install anything - Resolve dependencies
- Install required libraries
- Track manual vs dependency installs - Updates installed packages
- Does not remove packages - May: Remove packages
Replace dependencies
Downgrade packages if needed
- Remove packages
- Replace dependencies
- Downgrade packages if needed
- Higher risk - Remove packages
- Replace dependencies
- Downgrade packages if needed - Frees disk space
- Reduces attack surface
- Keeps system clean - Older versions
- LTS-frozen software - Newer versions
- Vendor-supported builds
- Fast security fixes - You trust the maintainer
- Packages are cryptographically signed
- APT verifies signatures before installing - Replace system packages
- Override official updates - Older Wine versions - Faster updates
- Better Windows compatibility - Ubuntu Wine version: 6.x
- WineHQ version: 8.x
- Newer Wine versions: Fix crashes
Improve compatibility
Reduce graphical glitches
- Fix crashes
- Improve compatibility
- Reduce graphical glitches - Fix crashes
- Improve compatibility
- Reduce graphical glitches - Affects entire system
- Applies to future upgrades
- Can override core packages - Read install instructions
- Understand what is added
- Remove unused repositories later - PPA = Personal Package Archive
- Ubuntu-specific feature (Canonical / Launchpad)
- Allows individuals or teams to publish newer or custom packages
- Mostly not available on Debian - Stable versions
- LTS-frozen software - Newer versions (e.g., PHP, Node.js)
- Faster security fixes
- Vendor-maintained builds - Ubuntu repo → PHP 8.1
- We want → PHP 8.2+ - Go to Launchpad
- Search for PHP
- Example PPA: - This is not an official Canonical repository
- Maintained by an individual
- Must be explicitly trusted - New .list file added to /etc/apt/sources.list.d/
- GPG key automatically installed
- Packages now available system-wide - PHP 8.2 installed
- Overrides Ubuntu’s default PHP - PHP falls back to Ubuntu version (8.1) - PPAs can replace any package
- Affect future upgrades
- Trust is delegated to the maintainer - Minimize PPAs
- Remove when no longer needed
- Prefer LTS versions - Verifies installed package files against stored checksums
- Uses MD5 (not cryptographically secure, but useful)
- Detects accidental or unauthorized modifications - File modified since install
- Expected for config files - Not owned by any package
- Precedence via $PATH - New server handover
- Suspected tampering
- Debugging broken packages
- Compliance checks - Install libc6 2.36 - Broken dependency state
- APT cannot install unrelated packages
- System partially broken - Fixes broken dependencies
- Upgrades or removes conflicting packages
- Keeps manually installed packages - Update first: - Remove broken package manually if needed - Prefer official repositories
- Minimize PPAs
- Avoid random .deb files
- Keep system updated
- Use LTS releases
- Delay major upgrades
- Backup before upgrades
- Use containers (Docker) when possible - Ask configuration questions
- Run post-install scripts
- Set system defaults - Bootloader selection
- Display manager choice
- Locale generation - Date formats
- Number formats
- Currency formats - de_DE.UTF-8
- Choose default locale - Global dependencies
- Version conflicts
- Distro-specific builds - Bundling dependencies
- Isolating applications
- Auto-updating packages - Images stored in: - Mounted at: - No dependency conflicts
- Consistent behavior
- Automatic updates
- Cross-distribution compatibility - Larger disk usage
- Slower startup
- Mostly desktop-focused
- Less common on servers - Universal package format
- Bundles all dependencies
- Runs isolated from system libraries
- Auto-updates by default - Can be used on CentOS/RHEL - Breaks enterprise support
- Snap itself is unsupported
- Applications installed via Snap are unsupported - Share dependencies globally
- Can conflict - Each app bundles dependencies
- No conflicts
- Larger disk usage
- Faster vendor updates - Windows installers
- macOS app bundles - Takes longer (security profiles)
- Subsequent installs are faster - Much newer than ESR
- Independent of system Firefox - Developer workstations
- 최신 browser versions
- Tools needing rapid updates - Production servers
- Systems requiring enterprise support
- Security-restricted environments
how-totutorialguidedev.toailinuxubuntudebiancentossystemdkernelserverbashshellcron