Contents

Install Rosetta 2 on ARM macOS

Rosetta 2 doesn’t install automatically on an ARM-based mac without X86-64 apps. If you try to run an Intel-only binary on an Apple Silicon chip, the default message will be :

bad CPU type in executable: {executable_path}

To install Rosetta 2, run :

softwareupdate --install-rosetta

Enable/Disable Default Gatekeeper Security in macOS

This change will add the “Anywhere” option for opening apps to the Security preference panel in macOS Sonoma and Sequoia, which is hidden by default otherwise.

sudo spctl --master-disable

You’ll see a confirmation reported back stating: “Globally disabling the assessment system needs to be confirmed in System Settings.”

To re-enable the default behaviour, use :

sudo spctl --master-enable

Find all the symlinks in a directory tree

This will recursively traverse the /path/to/folder directory and list only the symbolic links:

ls -lR /path/to/folder | grep '^l'

If your intention is to follow the symbolic links too, you should use your find command but you should include the -L option; in fact the find man page says:

   -L     Follow symbolic links.  When find examines or prints information
          about files, the information used shall be taken from the  prop‐
          erties  of  the file to which the link points, not from the link
          itself (unless it is a broken symbolic link or find is unable to
          examine  the file to which the link points).  Use of this option
          implies -noleaf.  If you later use the -P option,  -noleaf  will
          still  be  in  effect.   If -L is in effect and find discovers a
          symbolic link to a subdirectory during its search, the subdirec‐
          tory pointed to by the symbolic link will be searched.

          When the -L option is in effect, the -type predicate will always
          match against the type of the file that a symbolic  link  points
          to rather than the link itself (unless the symbolic link is bro‐
          ken).  Using -L causes the -lname and -ilname predicates  always
          to return false.

Then try this:

find -L /var/www/ -type l

This will probably work: I found in the find man page this diamond: if you are using the -type option you have to change it to the -xtype option:

          l      symbolic link; this is never true if the -L option or the
                 -follow option is in effect, unless the symbolic link  is
                 broken.  If you want to search for symbolic links when -L
                 is in effect, use -xtype.

Then:

find -L /var/www/ -xtype l

Disable popup showing accented characters when holding down a key

In macOS, when a key is held down while entering text, a popup is shown which lets one choose between various accented forms of the character. To disable this execute the following command line in the Terminal :

defaults write -g ApplePressAndHoldEnabled -bool false

You’ll need to log out and log back in again for the setting to take effect.

This should disable the display of the popup and character typed should start repeating when the key is held down.

If you ever wish to revert to the orignial behaviour, execute the following command line in the Terminal :

defaults write -g ApplePressAndHoldEnabled -bool true

You’ll need to log out and log back in again for the setting to take effect.

Upgrade Debian to the latest version

Stop critical services running on the host machine

systemctl stop XXX.service

Update the current running system to minimize the update gap :

apt update && apt full-upgrade

Remplace all occurrences of the old release (bookworm) with the new one (trixie) in the APT sources file :

sed -i 's/bookworm/trixie/g' /etc/apt/sources.list

Update the APT repository with the new packages list. You will get an estimate of the number of packages that will be upgraded.

apt update

Proceed with upgrading the packages. This step is the most time-consuming since it downloads the new packages. A list of important changes will be displayed, read it carefully. You can read through with Space and escape with Q. During the upgrade, you might be asked if you want to restart running services, you cant answer with Y.

apt full-upgrade

Once everything is up-to-date, restart the host :

reboot

After restarting

Confirm you are running the new OS version :

cat /etc/os-release

Post-install cleanup

Upgrade the source files to the new deb822 format, confirm with Y :

apt modernize-sources

List obsolete packages :

apt list '~o'

Attention, some packages installed outside official APT repos might be treated as obsolete. Double-check these carefully before purging obsolete packages :

apt purge '~o'
apt autoremove

Remove warning when opening files from a Samba share

In Control Panel, go to Network and Internet.
Next, click on Internet Options.
In the Internet Properties dialog, open the Security tab.
Next, select the Local intranet option and then click on the Sites button for Local intranet.
In the new window, click on the Advanced button.
In the Add this website to the zone field, you need to add the IP address (or FQDN) of the server and click Add.
Click Close and OK to save the changes.

Flush DNS Cache

OS VersionCommand
macOS 12 (Monterey)sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
macOS 11 (Big Sur)sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
macOS 10.15 (Catalina)sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
macOS 10.14 (Mojave)sudo killall -HUP mDNSResponder
macOS 10.13 (High Sierra)sudo killall -HUP mDNSResponder
macOS 10.12 (Sierra)sudo killall -HUP mDNSResponder
OS X 10.11 (El Capitan)sudo killall -HUP mDNSResponder
OS X 10.10 (Yosemite)sudo discoveryutil udnsflushcaches
OS X 10.9 (Mavericks)sudo killall -HUP mDNSResponder
OS X 10.8 (Mountain Lion)sudo killall -HUP mDNSResponder
Mac OS X 10.7 (Lion)sudo killall -HUP mDNSResponder
Mac OS X 10.6 (Snow Leopard)sudo dscacheutil -flushcache
Mac OS X 10.5 (Leopard)sudo lookupd -flushcache
Mac OS X 10.4 (Tiger)lookupd -flushcache
ipconfig /flushdns

Remove No Subscription message in Proxmox VE 8.4

sed -i "/\.data\.status\.toLowerCase() !== 'active') {/c\.data.status.toLowerCase() == 'active') {" /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js && systemctl restart pveproxy.service

This has been tested in Proxmox VE 8.4.1 and must be run after each update of the Proxmox User Interface.

In the file :

/usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js

search for the line :

.data.status.toLowerCase() !== 'active') {

(as of 2025-04-20, this is line 565) and replace with :

.data.status.toLowerCase() == 'active') {

apt-key deprecation in Raspberry Pi OS Bookworm (12)

First find the key in the old location

apt-key list | grep -A4 "trusted.gpg$"
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).

/etc/apt/trusted.gpg

pub rsa2048 2012-06-17 [SC]
CF8A 1AF5 02A2 AA2D 763B AE7E 82B1 2992 7FA3 303E
uid [ unknown] Raspberry Pi Archive Signing Key

What you need from this is the last 8 characters of the long hexadecimal number, without the spaces. In this case, 7FA3303E. Then you export the key to a temporary file.

apt-key export 7FA3303E | sudo gpg --dearmor -o /tmp/raspi.gpg
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).

This should have created a file /tmp/raspi.gpg with the key in.

file /tmp/raspi.gpg
/tmp/raspi.gpg: PGP/GPG key public ring (v4) created Sun Jun 17 15:49:51 2012 RSA (Encrypt or Sign) 2048 bits MPI=0xabc2a41a70625f9f…

Now delete the old key.

apt-key del 7FA3303E
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
OK

And finally put the new key in place.

Code: Select all

mv /tmp/raspi.gpg /etc/apt/trusted.gpg.d/raspberrypi-bookworm-stable.gpg

The reason for doing the steps in this order is that otherwise the new key gets deleted as well as the old one.

from https://forums.raspberrypi.com/viewtopic.php?t=358016

Rotate DSI Display

For Raspberry Pi OS Bookworm :

Add the video information to the end of cmdline.txt :
(located at /boot/firmware/cmdline.txt or on the /boot partition of the SD Card.)


video=DSI-1:800x480@60,rotate=<rotation-value>

Replace the <rotation-value> placeholder with one of the following values, which correspond to the degree of rotation relative to the default on your display: 0 (default), 90, 180 (reversed), 270

(https://www.raspberrypi.com/documentation/accessories/display.html)

For Raspberry Pi OS Buster / Bullseye :

Add one of the following values in config.txt
(located at /boot/firmware/cmdline.txt or on the /boot partition of the SD Card.)

lcd_rotate=0 # default (normal landscape)
lcd_rotate=1 # 90 degrees (portrait, upside down)
lcd_rotate=2 # 180 degrees (landscape)
lcd_rotate=3 # 270 degrees (portrait, upside down)

Change Static IP Address

Enterprise Linux 9 / Raspberry Pi OS 12 :

sudo nmtui

Or

su

# list devices (ens192 used as example below)
nmcli device

# set [manual] for static setting or [auto] for DHCP
nmcli connection modify ens192 ipv4.method manual
nmcli connection modify ens192 ipv4.addresses xx.xx.xx.xx/24 
nmcli connection modify ens192 ipv4.gateway xx.xx.xx.1

# for multiple DNS, specify with space separated
nmcli connection modify ens192 ipv4.dns "xx.xx.xx.1 xx.xx.xx.2"

# restart the interface to reload settings
nmcli connection down ens192; nmcli connection up ens192

# confirm the applied settings
nmcli device show ens192

# confirm state
ip address show

Debian 12 :

su

ip a

nano /etc/network/interfaces

# restart the interface to reload settings
systemctl restart networking

# confirm state
systemctl status networking

Raspbian 10 / Raspberry Pi OS 11 :

sudo nano /etc/dhcpcd.conf

Mount VMWare VMFS Volumes in Linux

Install the vmfs pckages :

sudo apt install vmfs6-tools

Mount the partition sdX1 using FUSE :

vmfs6-fuse /dev/sdX1 /mnt/media

About VMWare VMFS’ hidden files

There are hidden files in the root of any VMFS volume which start with a dot and end with the extension .sf, and some free space seems to be missing from a newly created VMFS datastore.

These system files are indexes and descriptors of the files on the VMFS filesystem and cannot be deleted.

  • They may take more space if you have a small block size (more addresses).
  • They may take less space if you have a large block size (less addresses).
  • They are metadata files that are created when the volume is first set up.
  • They cannot be changed and cannot be deleted.
  • They may grow over time but not significantly.

The VMFS-3 file system organizes all space on disk in collections of resources. There are four resource types managed by the VMFS-3 file system: Blocks, sub-blocks, pointer blocks, and file descriptors.

Resources are grouped together into collections called CLUSTERs and clusters can be further grouped together into CLUSTER GROUPS.

Each resource type is managed by one of several system files which are created during the file system bootstrap process:

  • fbb.sf – file block bitmap.system file
  • fdc.sf – file descriptor cluster.system file
  • pbc.sf – pointer block cluster.system file
  • sbc.sf – sub-block cluster.system file
  • vh.sf – vmfs heartbeat.system file
  • sdd.sf – scsi device description.system file

The VMFS-5 file system uses one additional system file:

  • pb2.sf – pointer block 2.system file

Prevent .DS_Store on Samba shares

Open up /etc/samba/smb.conf and add the following lines to each share :

veto files = /._*/.DS_Store/
delete veto files = yes

restart samba :

systemctl restart smbd.service

If neede, cleanup the server of unwanted .DS_Store files :

find ./ -type f -name ".DS_Store" -exec rm -f {} \;

or

find ./ ( -name ".DS_Store" -or -name "._" -or -name "Thumbs.db" -or -name ".tmp" -or -name "*.lnk" -or -name "TemporaryItems" -or -name "folders.501" -or -name ".TemporaryItems" -or -name "__MACOSX" ) -ls -delete

Passing a Physical Disk Drive to a Proxmox VM

In the Proxmox VE host, display the local disks in the Disks section and note the device you’ll be passing to your VM (e.g. /dev/sdX).

Then, run the host console in the web UI or connect via ssh.

Take note of the VM ID that the physical hard disk will be connecting to.

list the local disks available (since we’ll be passing a physical disk, ignore partitions) :

ls -n /dev/disk/by-id/

sample output : 
lrwxrwxrwx 1 0 0  9 Feb 11 10:05 ata-CT1050MX30SSD1_1723175912B9 -> ../../sdb
…
lrwxrwxrwx 1 0 0  9 Feb 11 10:05 ata-CT525MX300SSD1_171816E67E70 -> ../../sdc
…
lrwxrwxrwx 1 0 0  9 Feb 11 10:05 ata-CT500MX500SSD1_21102D720097 -> ../../sda

Make sure the VM is stopped before changing its configuration.

Using the VM ID noted earlier, pass the disk to your VM either as a virtio or sata (recommended) device :

qm set VMID -sata1 /dev/disk/by-id/YYY

usage:
qm set %VMID% -%VIRTUALDEVICE% %DISKID

%VIRTUALDEVICE% can ben set as sataN where N is a digit between 0 and 5.

Then, check in the VM’s Hardware tab that the disk is listed.

Verify inside the guest OS that the physical disk is connected, then it can then be used normally as a physical disk (mount partitions, etc…)

Difference Between .bashrc and .bash_profile

Interactive Login and Non-Login Shell

When invoked, Bash reads and executes commands from a set of startup files. What files are read depends upon whether the shell is invoked as an interactive login or non-login shell.

A shell can be interactive or non-interactive.

In simple terms, an interactive shell is a shell that reads and writes to a user’s terminal, while a non-interactive shell is a shell that is not associated with a terminal, like when executing a script.

An interactive shell can be either login or non-login shell.

A login shell is invoked when a user login to the terminal either remotely via ssh or locally, or when Bash is launched with the --login option. An interactive non-login shell is invoked from the login shell, such as when typing bash in the shell prompt or when opening a new Gnome terminal tab.

Bash Startup Files

When invoked as an interactive login shell, Bash looks for the /etc/profile file, and if the file exists , it runs the commands listed in the file. Then Bash searches for ~/.bash_profile, ~/.bash_login, and ~/.profile files, in the listed order, and executes commands from the first readable file found.

When Bash is invoked as an interactive non-login shell, it reads and executes commands from ~/.bashrc, if that file exists, and it is readable.

Difference Between .bashrc and .bash_profile

.bash_profile is read and executed when Bash is invoked as an interactive login shell, while .bashrc is executed for an interactive non-login shell.

Use .bash_profile to run commands that should run only once, such as customizing the $PATH environment variable .

Put the commands that should run every time you launch a new shell in the .bashrc file. This include your aliases and functions , custom prompts, history customizations , and so on.

Typically, ~/.bash_profile contains lines like below that source the .bashrc file. This means each time you log in to the terminal, both files are read and executed.

if [ -f ~/.bashrc ]; then
	. ~/.bashrc
fi

Most Linux distributions are using ~/.profile instead of ~/.bash_profile. The ~/.profile file is read by all shells, while ~/.bash_profile only by Bash.

Set up Windows 11 without a Microsoft account

When in the Out-of-box experience (OOBE), disable internet requirement by disconnecting the Ethernet network cable.

If the device you’re setting up only has a WiFi card (e.g. Surface); disable it before continuing. Open command prompt as stated before with Shift + F10 and run the Device Manager console : devmgmt.msc

On the “Sign in” page, use these steps :

Up to version 24H2 :

  1. Use the Shift + F10 keyboard shortcut to open Command Prompt.
  2. Type the following command to release the current network configuration (no spaces) :
    oobe\bypassnro
  3. Computer will reboot automatically, and you may need to start the out-of-box experience again.
  4. Click the “I don’t have internet” option.
  5. Proceed with creating a standard offline account.

From version 25H2 on :

  1. Use the Shift + F10 keyboard shortcut to open Command Prompt.
  2. Type the following command to invoke the local account creation wizard :
    start ms-cxh:localonly
  3. The wizard will launch and allow to create the local account.
  4. Proceed with installation.