Day 12 Learnings: Network and Connectivity in Linux

Today, I delved into network and connectivity topics in Linux, focusing on monitoring system activity and managing processes effectively. These tools are essential for optimizing system performance and ensuring seamless operation.


What I Learned This Week

  • Monitoring System Activity with the top Command:
    The top command provides real-time insights into system performance, including CPU usage, memory consumption, and active processes.

  • Terminating Processes with the kill Command:
    The kill command allows you to terminate misbehaving or unnecessary processes by sending specific signals.


Steps I Followed

System Monitoring | top Command

  1. Launch top:
    Opened the command in the terminal:

     top
    

    The display included process details such as PID, user, CPU usage, and memory usage.

  2. Navigate the Interface:

    • Used k to kill a process directly.

    • Pressed q to exit the top interface.

  3. Filter by User:
    Displayed processes for a specific user:

     top -u username
    
  4. Customize Display:
    Sorted processes by memory usage:

     top -o %MEM
    

Managing Processes | kill Command

  1. Find Process ID (PID):
    Used the ps or top command to identify the PID of the process to terminate:

     ps -e | grep process_name
    
  2. Terminate a Process:
    Sent the default SIGTERM signal to a process:

     kill PID
    
  3. Force Kill a Process:
    Used the SIGKILL signal to terminate stubborn processes:

     kill -9 PID
    
  4. Kill Multiple Processes:
    Sent a termination signal to multiple PIDs:

     kill PID1 PID2
    

Problems I Encountered

  1. Unresponsive top Navigation:
    Initially struggled to navigate the top interface effectively.

  2. Permission Denied Errors with kill:
    Encountered permission errors while trying to terminate processes started by another user.


How I Solved These Problems

  1. Exploring top Documentation:
    Used man top and keyboard shortcuts within top to navigate and customize the interface.

  2. Using sudo for Elevated Permissions:
    Resolved permission errors by running the kill command with sudo:

     sudo kill PID
    

Resources I Used

  • Linuxize Guide to top Command

  • Linuxize Guide to kill Command

  • Community forums for troubleshooting tips and practical examples.


Conclusion

Today’s learnings introduced me to powerful tools for monitoring and managing system performance. The top command helps keep tabs on system activity, while the kill command provides precise control over processes.

Looking forward to Day 13 and exploring more Linux functionalities!