linux
Determine kernel version
uname -aDetermine the linux distro and version
cat /etc/issue
cat /etc/os-release
cat /etc/lsb-release
cat /proc/version
lsb_release -a
hostnamectlSource: https://www.cyberciti.biz/faq/find-linux-distribution-name-version-number/
Display BIOS metadata -- no reboot needed
sudo dmidecode --type biosUbuntu (any Debian?) -- check for non-LTS OS upgrades
sudo vi /etc/update-manager/release-upgradesMake sure the "Prompt" value is set to "normal" and not "lts"
Determine files within/installed by a package
apt-file list <package> #NOTE: This works on any pkg, not just installed ones
dpkg -L <package>Show the total size of the current directory (and all its subdirs)
Linux:
sudo du --total --summarize --human-readableBSD / MacOS
sudo du -c -s -hDetermine locations of superblock backups
sudo mke2fs -n /dev/sda1Needed to resolve "bad magic number in super-block" error
Reference: https://linuxroutes.com/resolve-bad-magic-number-in-super-block-in-error/
Mount a raid 1 (mirror) drive
sudo mdadm --assemble --run /dev/md0 /dev/<partition to be mounted>
sudo mount /dev/md0I needed this when I lost one of my mirrored drives and wanted to make a backup of the one that still worked
Reference: https://serverfault.com/questions/383362/mount-unknown-filesystem-type-linux-raid-member
Show only local, hardware, mounted drives
mount | grep -e '^\/dev'This will limit the output to lines that start with "/dev", to cut down on noise from tmpfs, sysfs, proc, snaps, etc
Change a user's default shell
sudo chsh -s /path/to/shell usernameSource: https://superuser.com/questions/379725/how-do-i-change-a-users-default-shell-in-osx
Last updated