Commands I Occasionally Use but Tend to Forget
Server
Lastmod: 2025-01-07
Published: 2024-12-31

I will note down commands that I occasionally use but tend to forget.

System Related

Upgrading Ubuntu

# apt update
# apt upgrade
# apt dist-upgrade

# do-release-upgrade
  • Installing do-release-upgrade
# apt install update-manager-core

update-alternatives

  • Setting the default path for Python
# update-alternatives --install /usr/bin/python python /usr/bin/python3 1
  • Setting the default editor
# update-alternatives --config editor

Time Zone Setting

  • When using systemd
# timedatectl set-timezone Asia/Tokyo
  • Setting manually
# ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime

File System Related

Mounting SD Cards or HDD Images

  • Assigning the device to loop
# losetup -f --show -P sdcard.img

This will make partitions like /dev/loop0p1 visible for mounting.

  • Releasing the loop device
# losetup -d /dev/loopN

Network Related

How to check NIC drivers

# udevadm info -a -p /sys/class/net/eth0
# ethtool -i eth0

Checking NIC Offload

# ethtool -k eth0

Checking NIC-specific settings

# ethtool --show-priv-flags eth0

Checking Transceiver Information

# ethtool -m eth0

Raw Dump of Transceiver EEPROM

# ethtool -e eth0 raw on | hexdump -C

Package Related

Installing apt-fast

# add-apt-repository ppa:apt-fast/stable
# apt update
# apt install apt-fast

Installing add-apt-repository

# apt install software-properties-common