Better CLI on your QNAP NAS
After installing Entware, the next thing I did was configure my shell environment to provide a better CLI experience. The default shell is terribly basic!
Here's what I did:
-
I installed a few packages:
sudo opkg install zsh curl git git-http coreutils-mkfifo tmux. -
I configured my account to use Zsh instead of the default
/bin/sh. Normally you'd do this by usingchshor editing/etc/passwddirectly to use/opt/bin/zshas your new shell.However in this case I did it a bit differently for a couple of reasons:
- in my experience with Synology NAS, OS upgrades tend to reset the shell in
/etc/passwdto the default one (not sure if QNAP does the same, I guess we'll see) - if you mess with your Entware install and
/opt/bin/zshbecomes unavailable, you may find yourself locked out of your account.
Instead, I edited my
.profilefile withvim ~/.profileand added these lines at the end: - in my experience with Synology NAS, OS upgrades tend to reset the shell in
if [[ -x /opt/bin/zsh ]]; then
export SHELL=/opt/bin/zsh
exec /opt/bin/zsh
fiThis way, if /opt/bin/zsh is no longer available, you can stil log into your account -- it'll just fall back to the default /bin/sh shell.
- Log out and back in, and configure Zsh with some basic settings.
The next steps are absolutely not specific to QNAP and are purely down to personal preference, but I'm listing them anyway:
-
Install Powerlevel10k using the installation instructions for Oh My Zsh (and install the recommended font for your terminal if you haven't already).
Now you can enjoy a modern, good looking CLI when ssh'ing into your NAS!