View system kernel, architecture, and other information#
root@ubuntu:~# uname -a
Linux hecs-86661 4.15.0-169-generic #177-Ubuntu SMP Thu Feb 3 10:50:38 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
or
root@ubuntu:~# hostnamectl
Static hostname: hecs-86661 #Static hostname
Icon name: computer-vm
Chassis: vm
Machine ID: afa94baa3e3744baa1b19953cffa1f65
Boot ID: efe3be69dd9f4521be2a34e9ac3eb0c3
Virtualization: kvm
Operating System: Ubuntu 18.04.6 LTS
Kernel: Linux 4.15.0-169-generic
Architecture: x86-64
or
root@ubuntu:~# cat /proc/version
Linux version 4.15.0-169-generic (buildd@lcy02-amd64-015) (gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)) #177-Ubuntu SMP Thu Feb 3 10:50:38 UTC 2022
View memory#
root@ubuntu:~# free -h
total used free shared buff/cache available
Mem: 3.9G 206M 711M 7.5M 3.0G 3.4G
Swap: 0B 0B 0B
View disk space#
root@ubuntu:~# df -h
Filesystem Size Used Avail Use% Mounted on
udev 1.9G 0 1.9G 0% /dev
tmpfs 395M 7.5M 387M 2% /run
/dev/vda1 40G 7.0G 31G 19% /
tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
tmpfs 395M 0 395M 0% /run/user/0
View disk mounts#
root@ubuntu:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda 252:0 0 40G 0 disk
└─vda1 252:1 0 40G 0 part /
View the space occupied by each folder in the current directory#
du -sh *
Sort:
du -sh * |sort -nr
Last 10:
du -sh * |sort -nr |tail
View occupied ports#
lsof -i
View processes#
ps -ef
View processes and ports#
netstat -anp
View installed programs#
dpkg --list
Completely uninstall a program#
apt-get --purge remove <program_name>
Package, compress, and decompress#
tar -zcvf [archive_name] [file]
tar -zxvf [archive]