Introduction

Some commands and tips, often used when working on a server, I feel tired of asking gpt again and again.

1. Kill Jupyter Notebook Kernel

When you use Jupyter Notebook on a server,especially when in VSCode, sometimes the kernel may get stuck or become unresponsive. Unfortunately, VSCode does not provide a direct way to kill or shutdown the kernel from its interface.This make a lot of jupyter processes running on the server, consuming resources and causing confusion.

Check the running Jupyter processes with:

bash
1
pgrep -a -u username -f jupyter

and then kill

bash
1
kill -9 PID

And if you want to be more aggressive, the most brutal method is:

bash
1
pkill -9 -u username -f jupyter

2. Check Processes

To check all the processes running under your username, you can use:

bash
1
ps -u username -o pid,ppid,cmd,%mem,%cpu --sort=-rss | head -n 20

This command will show you the top 20 processes consuming the most memory, along with their PID, parent PID, command, memory usage, and CPU usage.

To check all the processes running on the server, you can use:

bash
1
ps -a -o pid,ppid,user,cmd,%mem,%cpu --sort=-rss | head -n 20

This command will show you the top 20 processes consuming the most memory, along with their PID, parent PID, user, command, memory usage, and CPU usage.

Let me see who’s zombie processes occupying the server resources. 馃挗