Ubuntu CPU, Memory and Disk

Explore how to check CPU, memory, and disk information on an Ubuntu system

Up-time and processors ———————————————–
htop Shows CPU, Memory and Diks Utilization
cat /proc/cpuinfo Shows CPU Model
cat /proc/version Shows Ubuntu version is running

Reboot System
shutdown -h now
halt
reboot

Process
pidof apache2 Check PID of Apache process
sudo lsof -i:22 Check if port 22 is listening
sudo kill -9 process_id Kill Process using ID

Disk

lsblk List Disks with sizes
findmnt -D
List partitions
df -h Display information about total space and available space on a file system.
sudo fdisk -l List partitions
sudo fdisk /dev/sdd

Add New Drive
cd /
sudo mkdir /dynatracetrans Create Mount in Point
lsblk
sudo mkfs.ext4 /dev/sdd
lsblk -f
sudo nano -Bw /etc/fstab Add following lines
UUID=”236a7892-b41e-4dcd-aa54-ea635710fb3f” //dynatrace/data /replayData ext4 defaults,nofail 1 2
sudo mount -a mount all
findmnt list mounting points
lsblk -f list mounting points
sudo restartsudo -i blkid
sudo mount /dev/sdd /mnt/media

Add Swap File to Ubuntu VM in Azure
sudo nano /etc/waagent.conf Config file by setting the following three parameters
ResourceDisk.Format=y
ResourceDisk.EnableSwap=y
ResourceDisk.SwapSizeMB= 4096
service walinuxagent restart
free
dmesg | grep swap
swapon -s
cat /proc/swaps
file /mnt/resource/swapfile
free| grep -i swap