chsh: Cannot determine your user name. while trying to setup zsh - ubuntu-16.04

I have installed oh-my-zsh and now trying to make it my default shell. but when I trying to enter chsh -s $(which zsh) command it is giving me this --> chsh: Cannot determine your user name. error.
Please help me, guys.

It's probable that your system restricts the ability to change the shell.
You should contact your own uni tech support for instructions, or construct a dedicated shell rc file that runs zsh directly, depending on the $SHELL you have by default.
Here's a sample code which I had to use in my system.
if($?prompt) then
exec /usr/bin/zsh -l
export SHELL=/usr/bin/zsh
endif

Related

How can I update my account to use zhs. in VSCode?

When I run my code in VS Code, I get this message after every user interface input
The default interactive shell is now zsh.
To update your account to use zsh, please run chsh -s /bin/zsh.
What can I do to use zsh and/or keep this messsage from appearing?
If you are using MAC, Apple has changed the default Interactive Shell from macOS Catalina.
But your Shell still could be bash.
if you want to change it to zsh, just run the following command in your terminal.
chsh -s /bin/zsh
and if you want to stop message appearing every time you open terminal
just follow this article here.

Shell alias expansion under ESXi host does not auto complete - AND - detecting if running interactively

Since ESXi does not come with bash, I am sourcing an .sh file to set up some custom aliases for common commands while connected via ssh.
On other distros like RHEL, I can type part of an alias and hit tab to autocomplete. This does not seem to work under ESXi 7.x.
Is there a switch or something that I can turn on to make autocomplete work for custom aliases, or is this just a limitation of the shell that ESX offers?
NOTE: If type l<tab> then I DO get the built in commands that start with L.
Also while I'm on the topic of the ESXi shell… On RHEL I have this line in my .bashrc file
[[ $- != *i* ]] && return
Purpose of this code being that if the current session is not being ran interactively then return else run rest of code.
When I run this on esx I get the error sh: *i*: unknown operand. Does the shell not support this substring methodology?
If I run echo $- then I get “smi” as the output.
Thanks
As you probably know ESXi provides ash (NOT bash) and Busybox. Although Busybox includes ash as I recall ESXi uses a custom built executable (check where /bin/ash points or doesn't point to). The Wikipedia article on ash gives a good overview of ash and its minimalist philosopy. Shell history was originally not included and autocompletion is definitely regarded as a nice to have that didn't make the cut. Sorry to be the bearer of bad news.

How to pass a device path to an ipython profile startup script?

I'm looking for a way to pass the path of a USB/serial device to my ipython profile startup file on OS X. Because the device file can have an awkward name it would be nice if I could leverage bash completion. Something like:
$ ipython --profile test /dev/tty.usb[TAB]
I could then make this in to an alias `ipython-test /dev/tty.usb[TAB]'.
I'd like to do this to allow my startup script to establish a connection with some hardware.
Other ideas welcome of course.
You can do that by evaluating a bash command there which will give you this autocompletion effect. E.g. with tab you'd like to get the first matching entry, here's a code which will do that for you:
ipython --profile test `ls /dev/tty | head -n1`
For understanding how that works see Understanding backticks in bash.

How can I modify command line in Ubuntu 10.04?

I am using a vpn service from certain server. I was given with a root account, and when I connect with a root account, the command line looks like below.
root#xa9g82:/etc/#
Then I used useradd to add an account called 'temp'
When I connected to the server with temp, then the command line only has a single character.
$
The user information is not shown, neither the path. Also, note that, in root's command line I can use tab to automatically complete the filename, however 'temp's command line inserts tab space, when I press tab. It is very inconvenient.
I am using Ubuntu 10.04. How can I resolve this issue?
I usually edit ~/.bashrc. Being root, you might want to change the system-wide preferences, at /etc/bash.bashrc. Personally, I changed some lines in ~/.bashrc to look like:-
# If this is an xterm set the title to user#host:dir
case "$TERM" in
xterm*|rxvt*)
## PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u#\h: \w\a\]$PS1" # default
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\h: \W\a\]$PS1" # How I like it
;;
*)
;;
esac
use prompt to set the prompt.... (man prompt...)
it depends on what shell you run each one has it's own tricks, but you can make it looks as you wish.
BASH
TCSH
It is likely that the default shell for root is set to /bin/sh, which does not provide many of the features that you may used to if you use a shell like bash. To check if this is the case, run the following command:
cat /etc/passwd | grep ^root
The last component of the line that this command outputs will be your shell (which, as stated previously, I'm guessing is /bin/sh). If this is not the shell you want (it probably isn't), then edit /etc/passwd (using nano or whatever editor you're most comfortable with) and change your shell to something more palatable, like /bin/bash. After doing this, you'll need to log out and then log back in.

How do I get the "Command Buffer" in Solaris 10?

When working on a linx CShell u get the option to press the up / down arrows to select the last command/s typed or the Command Buffer. This even works on Windows.
However this is not functional when working on Solaris, to which i recently switched. I am guessing that the shell is also a CShell.
Please tell me what key combination is required to have this feature on Solaris ?
The default shell in Solaris has command history, but you can also use Bash instead, it's more user friendly. Just type 'bash' (no quotes) at the command line. You can also edit /etc/passwd to make bash your default shell.
The "official" default shell for Solaris is actually sh, the original Bourne shell (see Chapter 10 of the Advanced User Guide for Solaris for more info). If you'd like to change it to csh or tcsh—and you're not root (it's generally considered bad practice to use anything but sh as root's default)—just issue passwd -e /path/to/shell_of_your_choice <loginname>. I'm guessing this would probably look like passwd -e /bin/csh <loginname>, but you'd probably want to make sure it exists, first.
It may be that it's the Korn shell in which case try <ESC>k.
bash at least will allow you to switch modes with "set -o vi" or "set -o emacs".
Maybe you can use the !! command, to repeat the previous one.
Use "echo $SHELL" to see what your login shell is. If it's ksh or bash, try "set -o emacs". If that works, you'll be able to use ^P to go back a command. ^R lets you search for a command, ^F and ^B to move around within the command.
If you can´t change your default shell, or you just want to try out one that works, you can kick off any other shell from your command line. I recommend you tcsh, which will have good command line editing and history using the arrow keys. Type /bin/tcsh at your prompt to try it out. You can use the earlier responses to change your default shell if you like tcsh. Make sure your have the following in your $HOME/.cshrc file:
set filec
set history=1000 # or some other large number
set autologout=0 # if you are logging in remotely under your account.
I hope this helps.
You enable history temporarily if you use BASH by typing
HISTSIZE=1000
which will enable up and down keys and store 1000 commands. After termal disconnetion all history will be gone.
This works on solaris 10.
For permanent solution add these lines to ~/.bashrc
HISTSIZE=1000
HISTFILESIZE=1000