Linux

Hostname

hostname

Username

whoami

User context

id id <USERNAME>

Operating System, Version

cat /etc/issue cat /etc/*-release

Kernel, Version and Architecture

uname -a uname -r (only kernel version) arch (only architecture) lsb_release -a (distribution) cat /proc/version

Other users and groups

cat /etc/passwd cat /etc/group groups groups <USER> (current user's groups) getent group <GROUP> (users in that group)

Connected users

who (w) finger

Last user login

lastlog

Network information

ifconfig ip a arp -a route routel ss -anp netstat -tulpn /etc/hosts /etc/resolv.conf (DNS) /etc/network/interfaces (if you make changes: sudo systemctl restart networking)

Open port

netstat -atunp

Rule iptables

cat /etc/iptables/rules.v4

Active Directory

realm list ps -ef | grep -i "winbind\|sssd" (others like sssd or winbind)

Installed applications

dpkg -l apt list --installed | tr "/" " " | cut -d" " -f1,3 | sed 's/[0-9]://g' | tee -a installed_pkgs.list

Binaries

ls -l /bin /usr/bin/ /usr/sbin/

Service list

systemctl list-units --type=service (currently active) systemctl list-unit-files --type=service (all, active and non-active)

Running processes

ps aux top (dynamic)

Scheduled tasks

ls -lah /etc/cron* crontab -l (current user's job) cat /etc/crontab ls /etc/cron.d cat /var/spool/cron/crontabs/root

Disks/Drives mounted

df -h (-t ext4 for only /dev/sda) mount cat /etc/fstab (drives mounted at boot time) cat /etc/fstab | grep -v "#" | column -t (unmounted file systems) lsblk (all disks available)

Drivers and Kernel modules

lsmod /sbin/modinfo <MODULE_NAME> (module taken from the command above)

Various listing

lsblk (block devices) lsusb (dispositivi usb) lsof (open file) lspci (PCI device) lscpu (CPU)

History

history cat ~/.*history

Environment variables

env cat /proc/self/environ (file containing environment variables)

PATH variable

$PATH

Warnings

  • cat /var/log/syslog | grep <STRING> It allows you to search the logs, check why something is going wrong, what is blocking it etc.

Last updated