I present to you a compilation of the most useful Linux commands for System Information and Monitoring
General Information
Clear terminal screen
Clears the terminal screen, just like the shortcut Control + L.
clearReset terminal session
Resets the current terminal session.
resetEnd terminal session
Closes the local or remote (SSH) terminal session and terminates initiated processes.
exitResource Management
Show running tasks
Displays a list of running tasks and their resource usage.
topShow tasks with enhanced resources
Displays more detailed and visual information about running tasks.
htopRAM status
Displays the status of RAM in megabytes.
free -hDisk Space
List mounted partitions
Displays a list of the partitions mounted on the system.
df -hView partition information on the system
Displays information about the partitions and their usage.
lsblkSize of files and directories
Displays the size of files and directories sorted by size.
ls -lSr | moreSpace used by a directory
Estimates the space used by the directory dir1.
du -sh directorySize sorted of files and directories
Displays the size of files and directories sorted by size.
du -sk * | sort -rnSystem Information
Data of connected users
Displays information about users connected to the system.
who -aView CPU usage details
Displays CPU usage details for each core.
mpstat -P ALLReboot history
Displays the system’s reboot history.
last rebootSystem architecture and version
Displays the architecture and version of Linux and the kernel.
uname -aLoaded kernel
Displays the currently loaded kernel.
lsmodSystem hardware components
Displays information about the system hardware.
dmidecode -qList hard drive partitions
Displays the partitions configured on the system.
cat /etc/fstabHard drive features
Displays specific features of the hard drive.
hdparm -i /dev/hdaShow PCI devices
Displays a list of connected PCI devices.
lspciShow USB devices
Lists the USB devices connected to the system.
lsusbKernel loading process events
Displays events during the kernel loading.
tail /var/log/dmesgSystem events
Displays logged system events.
tail /var/log/messagesOpen files by processes
Displays the list of open files by the current process.
lsof -p $$Open files in a directory
Displays open files in a specific directory.
lsof /directorySystem calls
Displays the system calls made by a process.
strace -c ls >/dev/nullLibrary calls
Displays the library calls of a specific process.
strace -f -e open ls >/dev/nullReal-time interrupts
Displays system interrupts in real time.
watch -n1 'cat /proc/interrupts'System Shutdown and Restart
Log out user
Ends the current user’s session.
logoutShut down the system
Shuts down the system immediately.
shutdown nowRestart the system
Restarts the system immediately.
shutdown -r nowScheduled shutdown
Schedules a shutdown for a specific hour and minute.
shutdown hours:minutes &Cancel scheduled shutdown
Cancels a scheduled shutdown.
shutdown -cDates
Show system date
Displays the current system date.
dateYear calendar
Displays the calendar for a specific year.
cal yearMonth and year calendar
Displays the calendar for a specific month and year.
cal month year