Skip to content

Shell

In Athena OS, four shells are mainly used: Bash, Fish, Zsh and PowerShell. For Bash, Fish, Zsh the same prompt pattern has been used.

At installation time, the user can choose between Bash, Fish and Zsh. However, Bash and PowerShell are installed by default.

Bash

Bash (Bourne-again Shell) is a command-line shell/programming language by the GNU Project. Bash is the default command-line shell on Athena OS. Here, Bash implements autosuggestion and autocompletion features in order to increase the user experience.

Generally, Bash is not able to retrieve the new configuration on .bashrc automatically. For example, if the shell prompt changes due to a command, this change is not applied on the current shell session. Athena solved this, by adding the following line on .bashrc:

export PROMPT_COMMAND='source ~/.bashrc no-repeat-flag'

Fish

Fish (Friendly interactive shell), is a command-line shell intended to be interactive and user-friendly. Fish is intentionally not fully POSIX compliant, it aims at addressing POSIX inconsistencies with a simplified or a different syntax.

The implementation of Fish shell has been decided according to some characteristics as:

  • Extensive UI: syntax highlighting, autosuggestion, tab completion and selection lists that can be navigated and filtered.
  • No configuration needed: Fish is designed to be ready to use immediately, without requiring extensive configuration.
  • Easy scripting: new functions can be added on the fly. The syntax is easy to learn and use.

Since Fish and Bash use different statements, at the beginning of the session, the user is associated with Bash because several bash scripts must be sourced at the login (i.e., /etc/profile.d/ scripts). When the user opens a terminal, .bashrc is sourced for setting configuration and variables and at the end it executes FISH.

Finally, for keeping FISH as shell even if in the terminal we open new tabs and preventing that it switches to BASH, the following code has been added at the end of .bashrc and delete each alias ps in your .bashrc or .bash_aliases file for avoding conflicting errors:

[[ $(ps --no-header --pid=$PPID --format=comm) != "${SHELL#/usr/bin/}" && -z ${BASH_EXECUTION_STRING} && ${SHELL} != "/usr/bin/bash" ]] && exec $SHELL

Zsh

Zsh is a powerful shell that operates as both an interactive shell and as a scripting language interpreter. While being compatible with the POSIX sh (not by default, only if issuing emulate sh), it offers advantages such as improved tab completion and globbing.

In general, Zsh is not able to retrieve the new configuration on .zshrc automatically. For example, if the shell prompt changes due to a command, this change is not applied on the current shell session. For solving this, on .zshrc the following lines have been added:

precmd() { eval "$PROMPT_COMMAND" }
export PROMPT_COMMAND='source ~/.zshrc no-repeat-flag'

In Athena OS, Zsh implements autosuggestion, globbing and autocompletion features in order to increase the user experience.

PowerShell

PowerShell is a cross-platform task automation solution made up of a command-line shell, a scripting language, and a configuration management framework.

In Athena OS, PowerShell has been implemented by adding a lot of useful modules that can improve the efficiency of the user activity.

Aliases

On Bash, Fish and Zsh are set several shells defined in ~/.bash_aliases. The most useful aliases are:

KeybindDescription
anycommand | tbGenerate a link to a webpage containing the output of the piped command.
cleanupCleanup orphaned packages.
cpc filename.txtCopy the content of a file in clipboard.
hwShow hardware info.
isoShow ISO release and version information used to install the system.
jctlGet the error messages from journalctl.
journalctl-uploadGenerate a link to a webpage containing the output of journalctl for troubleshooting purpose.
lockresetUnlock the user account due to multiple failed sudo attempts.
nbEdit ~/.bashrc by the EDITOR defined in ~/.bashrc.
nconfgrubEdit /boot/grub/grub.cfg by the EDITOR defined in ~/.bashrc.
nfEdit ~/.config/fish/config.fish by the EDITOR defined in ~/.bashrc.
nfstabEdit /etc/fstab by the EDITOR defined in ~/.bashrc.
ngrubEdit /etc/default/grub by the EDITOR defined in ~/.bashrc.
nhostsEdit /etc/hosts by the EDITOR defined in ~/.bashrc.
nmkinitcpioEdit /etc/mkinitcpio.conf by the EDITOR defined in ~/.bashrc.
nzEdit ~/.zshrc by the EDITOR defined in ~/.bashrc.
openportsShow open ports.
psaShow a detailed list of all processes.
pyserverInitiate a HTTP server instance on the current directory on port 8000.
srReboot the system.
ssnShutdown now.
update-fcUpdate the font cache when a new font is added.
update-grubUpdate the GRUB.