hexdefender
Email
  • Introduction to Linux
    • Overview
    • Linux Kernel
    • Linux Distros
    • Introduction to Kali Linux
    • Install Kali on VirtualBox
    • Install Kali on AWS
  • Linux Commands
    • Linux File Systems
    • Basic File and Directory commands
    • File Permissions and Ownerships
    • System Commands in Linux
    • Text Processing Commands in Linux
    • Linux Archive Utility
    • Package Management in Kali Linux
    • Networking Commands
    • Disk Utility Tools
    • Linux List of CLI Command lookup
    • Linux CLI Cheatsheet
    • Assignment
  • Networking Essentials
    • Overview
    • Networking Protocols
    • IP Addressing & Subnetting
    • DNS and DNS Security
    • Network Devices and Architecture
    • VPNs and Secure Tunnels
    • Network Address Translation (NAT) & Port Forwarding
    • Wireless Networks & Protocols
    • Cloud Networking & Security
    • Common Network Tools
  • Bash Scripting
    • Fundamentals of Bash
    • Variables, Branching and Loops
    • System Variables in Bash
    • Functions and Error Handling in Bash Scripts
    • File Handling and Text Processing
    • 5 Useful Bash Scripts for Everyday Tasks
    • Useful Assignments
  • Fundamentals of Cybersecurity
    • Introduction to Cybersecurity
    • Importance of Cybersecurity
    • Important Cybersecurity Frameworks
    • Cybersecurity Roles and Career Options
  • Penetration Testing
    • Reconnaissance and Footprinting
    • Exploitation Techniques
      • Introduction
      • Service Enumeration
      • Password Attacks
      • Exploit Discovery
      • The Art of Exploitation
      • The Pentester's guide to Metasploit
    • Post Exploitation - Malware & Escalation
  • Web Application Security
    • Common Web Vulnerabilities
    • OWASP Top 10
    • SQL Injections
    • Cross Site Scripting Attacks
    • Web Application Firewalls
    • Secure Coding Practices
  • Cryptography
    • Basic concepts of cryptography
    • Examples of Asymetric & Hashing functions
    • Public Key Infrastructure
    • Digital Signatures
    • Symmetric and Asymmetric Encryption
  • Social Engineering
    • Introduction to Social Engineering
    • Mitigation Strategies for Social Engineering
  • Digital Forensics
    • Digital Forensics Basics
    • Forensics Tools and Techniques
    • Reverse Engineering Fundamentals
    • Malware Analysis
Powered by GitBook
On this page
  1. Linux Commands

System Commands in Linux

Chapter 4: System Commands in Linux

Overview

In this chapter, we will delve into various system commands in Linux that are essential for managing system processes, resources, and configurations. These commands provide users with insights into system performance and allow for effective system administration.

Key Commands and Examples

Command
Most Used Arguments
Examples

top

-u (user), -p (PID)

top top -u username

ps

-e (all), -f (full), -u (user)

ps -ef `ps aux

kill

-9 (force)

kill PID kill -9 PID

df

-h (human-readable)

df -h df -i

free

-m (megabytes), -h (human-readable)

free -m free -h

uname

-a (all)

uname -a

uptime

uptime

shutdown

-h (halt), -r (reboot)

shutdown -h now shutdown -r +10

reboot

reboot

Command Descriptions and Use Cases

  1. top: Displays real-time information about system processes and resource usage.

    • Use Case: Monitoring system performance and identifying resource-hogging processes.

  2. ps: Shows the current running processes.

    • Use Case: Checking the status of processes or identifying processes by their user or name.

  3. kill: Terminates a process by its process ID (PID).

    • Use Case: Stopping a misbehaving application or process.

  4. df: Displays disk space usage for file systems.

    • Use Case: Checking available and used disk space on mounted file systems.

  5. free: Displays memory usage statistics.

    • Use Case: Monitoring RAM usage and available memory on the system.

  6. uname: Displays system information.

    • Use Case: Checking kernel version, system architecture, and operating system details.

  7. uptime: Shows how long the system has been running along with user load averages.

    • Use Case: Determining system stability and performance over time.

  8. shutdown: Shuts down or reboots the system.

    • Use Case: Safely shutting down the system for maintenance or rebooting for updates.

  9. reboot: Restarts the system.

    • Use Case: Quickly rebooting the system after applying updates or changes.

Interview Questions and Answers

  1. Q: What does the top command do in Linux?

    • A: The top command provides a dynamic, real-time view of running processes and their resource usage, allowing users to monitor system performance.

  2. Q: How can you find the PID of a running process?

    • A: You can find the PID of a running process using the ps command, such as ps -ef or ps aux, and then searching for the process name.

  3. Q: What is the difference between kill and kill -9?

    • A: The kill command sends a termination signal to a process, while kill -9 sends a SIGKILL signal that forces the process to terminate immediately without cleanup.

  4. Q: How can you check disk space usage on your system?

    • A: You can check disk space usage with the df -h command, which provides human-readable output of disk usage for all mounted filesystems.

  5. Q: What information does the free command provide?

    • A: The free command displays information about total, used, free, shared, buffer/cache, and available memory in the system.

  6. Q: What is the purpose of the shutdown command?

    • A: The shutdown command is used to safely turn off or restart the system, allowing users to perform necessary cleanup and prevent data loss.

  7. Q: How would you check how long the system has been running?

    • A: You can check how long the system has been running by using the uptime command, which displays the current time, how long the system has been up, and the number of users.

Conclusion

This chapter has covered essential system commands in Linux that are critical for managing system processes and resources. Mastery of these commands will enable learners to perform basic system administration tasks efficiently and prepare them for more advanced topics in subsequent chapters.

PreviousFile Permissions and OwnershipsNextText Processing Commands in Linux

Last updated 8 months ago