How to properly switch to zsh and be able to use dietpi commands

I like to use zsh and oh my zsh because of I find it easier to modify the config file for plugins and get themes.

I managed to change everything over but now I can’t use any of the dietpi commands without going to the /boot/dietpi folder first.

Is there a proper way to give zsh the same full functionality as the default bash? I looked on github for some solutions, but I want to make sure I didn’t miss anything out.

I added export PATH=/usr/bin:/boot/dietpi:/bin:/usr/sbin:/sbin:$PATH to the top of .zshrc and I found conflicting suggestions to add /boot/dietpi/dietpi-login at the bottom and

. /DietPi/dietpi/func/dietpi-globals

What is the correct way?


on bash we set alias inside /etc/bashrc.d/dietpi.bash. We don’t export the path.

So what’s the correct way to bring those to zshrc? Can the aliases be copied over to zshrc? I’m guessing I can’t just somehow include the bashrc script into the zshrc script.

I guess you find this GitHub issue already? DietPi-specific apps are not executing directly when using ZSH (and possibly any other shell) · Issue #180 · MichaIng/DietPi · GitHub

As you can see, we don’t support zsh as it is not tested with our script. Therefore you will do it on your own risk. Following seems to be working DietPi-specific apps are not executing directly when using ZSH (and possibly any other shell) · Issue #180 · MichaIng/DietPi · GitHub

I created a files ~/.aliases and added the following lines from the bash script you showed me,

# DietPi-Globals: dietpi-* aliases, G_* functions and variables
. /boot/dietpi/func/dietpi-globals || { echo -e '[\e[31mFAILED\e[0m] DietPi-Login | Failed to load DietPi-Globals. Skipping DietPi login scripts...'; return 1; }

# Aliases
# - sudo alias that allows running other aliases with "sudo":
alias sudo='sudo '
# - DietPi programs
alias dietpi-letsencrypt='/boot/dietpi/dietpi-letsencrypt'
alias dietpi-autostart='/boot/dietpi/dietpi-autostart'
alias dietpi-cron='/boot/dietpi/dietpi-cron'
alias dietpi-launcher='/boot/dietpi/dietpi-launcher'
alias dietpi-cleaner='/boot/dietpi/dietpi-cleaner'
alias dietpi-morsecode='/boot/dietpi/dietpi-morsecode'
alias dietpi-sync='/boot/dietpi/dietpi-sync'
alias dietpi-backup='/boot/dietpi/dietpi-backup'
alias dietpi-bugreport='/boot/dietpi/dietpi-bugreport'
alias dietpi-services='/boot/dietpi/dietpi-services'
alias dietpi-config='/boot/dietpi/dietpi-config'
alias dietpi-software='/boot/dietpi/dietpi-software'
alias dietpi-update='/boot/dietpi/dietpi-update'
alias dietpi-drive_manager='/boot/dietpi/dietpi-drive_manager'
alias dietpi-logclear='/boot/dietpi/func/dietpi-logclear'
alias dietpi-survey='/boot/dietpi/dietpi-survey'
alias dietpi-explorer='/boot/dietpi/dietpi-explorer'
alias dietpi-banner='/boot/dietpi/func/dietpi-banner'
alias dietpi-justboom='/boot/dietpi/misc/dietpi-justboom'
alias dietpi-led_control='/boot/dietpi/dietpi-led_control'
alias dietpi-wifidb='/boot/dietpi/func/dietpi-wifidb'
alias dietpi-optimal_mtu='/boot/dietpi/func/dietpi-optimal_mtu'
alias dietpi-cloudshell='/boot/dietpi/dietpi-cloudshell'
alias dietpi-nordvpn='G_DIETPI-NOTIFY 1 "DietPi-NordVPN has been renamed to DietPi-VPN. Please use the \"dietpi-vpn\" command."'
alias dietpi-vpn='/boot/dietpi/dietpi-vpn'
alias dietpi-ddns='/boot/dietpi/dietpi-ddns'
alias cpu='/boot/dietpi/dietpi-cpuinfo'
# - Optional DietPi software aliases
[[ -d '/mnt/dietpi_userdata/sonarr' || -d '/mnt/dietpi_userdata/radarr' || -d '/mnt/dietpi_userdata/lidarr' ]] && alias dietpi-arr_to_RAM='/boot/dietpi/misc/dietpi-arr_to_RAM'
command -v kodi > /dev/null && alias startkodi='/boot/dietpi/misc/start_kodi'
[[ -f '/usr/games/opentyrian/run' ]] && alias opentyrian='/usr/games/opentyrian/run'
[[ -f '/mnt/dietpi_userdata/dxx-rebirth/' ]] && alias dxx-rebirth='/mnt/dietpi_userdata/dxx-rebirth/'
# - 1337 moments ;)
alias 1337='echo "Indeed, you are =)"'

# "G_DIETPI-NOFITY -2 message" starts a process animation. If scripts fail to kill the animation, e.g. cancelled by user, terminal bash prompt has to do it as last resort.
[[ $PROMPT_COMMAND == *''* ]] || PROMPT_COMMAND="[[ -w '/tmp/' ]] && rm -f /tmp/ &> /dev/null && echo -ne '\r\e[J'; $PROMPT_COMMAND"

# DietPi-Login: First run setup, autostarts and login banner
# - Prevent call if $G_DIETPI_LOGIN has been set. E.g. when shell is called as subshell of G_EXEC or dietpi-login itself, we don't want autostart programs to be launched.
[[ $G_DIETPI_LOGIN ]] || /boot/dietpi/dietpi-login

Then I added source "$HOME/.aliases" somewhere around the top of the ~/.zshrc file and restarted. It seems to work fine. I am even getting the intro message showing temperature etc. I couldn’t get the last few blocks of code to work. I guess it’s good enough for now. Thanks for explaining.

1 Like