top of page
Writer's pictureKateryna

Essential Linux Commands for Developers

Updated: Apr 7


System Information


  • uname -a: Displays all system information, including kernel version and hardware architecture.

  • top: Provides a dynamic real-time view of running system processes.

  • htop (needs installation on some distros): An interactive process viewer, similar to top but more user-friendly.

  • df -h: Shows disk space usage on all mounted filesystems, in human-readable form.

  • free -h: Displays the amount of free and used memory in the system, in human-readable form.

User Management


  • useradd <username>: Creates a new user account.

  • usermod -aG <groupname> <username>: Adds a user to a specified group.

  • passwd <username>: Sets or changes the password for a user account.

  • chage -l <username>: Lists password aging information for a user.

File and Directory Management


  • ls -lah: Lists all files and directories in the current directory, including hidden files, with detailed information in a human-readable format.

  • find / -name <filename>: Searches the entire filesystem for a file or directory named <filename>.

  • tar czvf archive.tar.gz /path/to/directory: Creates a compressed tar archive of a directory.

  • chmod +x script.sh: Makes a script executable.

Package Management


  • apt update && apt upgrade (Debian, Ubuntu, and derivatives): Updates the package index and upgrades all packages to their latest versions.

  • yum update (CentOS, RHEL): Updates all installed packages to their latest version.

  • dnf update (Fedora, newer RHEL): Similar to yum, but uses the DNF package manager.

Network Configuration and Troubleshooting


  • ip addr show: Displays IP addresses and all network interfaces.

  • netstat -tulnp: Lists all active listening ports along with the corresponding service.

  • ping google.com: Sends ICMP ECHO_REQUEST packets to google.com to test connectivity.

  • traceroute google.com: Traces the route packets take from your machine to google.com

Process Management

  • ps aux: Shows running processes with detailed information.

  • kill <PID>: Sends a SIGTERM to a process with the specified PID, requesting its termination.

  • killall <processname>: Terminates all processes with the given name.

  • systemctl restart <servicename>: Restarts a systemd service.

System Monitoring and Performance


  • vmstat: Reports virtual memory statistics.

  • iostat: Provides CPU and input/output statistics for devices and partitions.

  • lsof: Lists open files and the processes that opened them.

Disk Usage and Files


  • du -sh /path/to/directory: Shows the total size of a directory and its subdirectories in a human-readable format.

  • ncdu (needs installation on some distros): An interactive disk usage viewer, providing a detailed breakdown of which files and directories are using disk space.


13 views0 comments

Recent Posts

See All

Comments


bottom of page