Laptop Insurance 1
Change to bash shell
Facts - Other software technologies

Many users of unix systems immediately start a bash shell after logging in. The bash shell has the well known advantage of easy command line editing and easy repeating previously executed command lines.

Unfortunately the bash shell is not the standard shell for many unix users. Fortunately it is easy to change your shell to the bash shell. Just follow these steps:

  1. Check your current shell, see the environment variable SHELL. Write this shell down in case you ever need to revert the shell change.
  2. Check the path to bash with which bash. Usually the output is /bin/bash.
  3. Log out and then log in as root and execute the following command: usermod -s /bin/bash username. Substitute your username for the username argument and make sure the path to bash is correct.

It may be that the editing of the command line appears to be broken in your bash shell. In that case your bash shell might operate in vi mode. Even the most fanatic vi evangelist does not like this. Therefore the emacs mode is the default mode for the bash shell. Change your bash shell to emacs mode by removing any lines as below in your login scripts:

set -o vi

Alternatively you could set the bash shell to emacs mode with the following shell command:

set -o emacs

Finally a number of useful key bindings in the bash shell operating in the emacs mode:

ctrl-aGo to the beginning of the command line
ctrl-eGo to the end of the command line
alt-bGo back one word
alt-fGo forward one word,
 
ctrl-dDelete current character
ctrl-wBackward kill word
alt-dForward kill word
ctrl-kForward kill rest of the line
ctrl-x backspaceBackward kill rest of the line
 
ctrl-yYank previous kill
ctrl-_Undo

After changing to bash shell on a couple of machines we could not use sftp any more on one of the machines. It turned out that when using sftp as service of the ssh daemon, login scripts like .profile and .bashrc are run. One of these scripts contained output and that broke sftp file transfers. We had a couple of options:

  • Changing back to ksh, these login scripts did not contain any echo statements,
  • commenting out all echo statements for the user we changed the shell to bash,
  • using the scp protocol instead of sftp
  • changing the ssh daemon such that sftp did not use a login shell

We implemented the second option. With the third option some people needed to install a different remote file transfer client. Implementing the fourth option affected other unix users apart from the user for which the shell was changed to bash. If such a unix user changes the umask in a login scripts then the fourth option might affect the permissions of any files uploaded with sftp.

 
Electric Bikes & Scooters
power systems kettlebells