Score:0

history command not working

is flag

I am a beginner with Ubuntu 22.04.2 Desktop. Some of the commands I used before do not work right now, and history is one of them. Previously, I used MobaXterm to only download and upload files. When I used my account on Ubuntu, this is the same message I got from both of them.

enter image description here

guiverc avatar
cn flag
You've not said what Ubuntu product/release you're using. Have you changed from the default shell? (*if you use different shells you may find you have different commands available, but have lost some of the BASH default commands*)
hr flag
Your screenshot suggests you are using `sh` - history is a feature of more full-featured shells like bash, zsh etc. - see [Arrow keys, Home, End, tab-complete keys not working in shell](https://askubuntu.com/questions/325807/arrow-keys-home-end-tab-complete-keys-not-working-in-shell)
Fateme Nazari avatar
is flag
I edited my question for more information. and the version of Ubuntu is 22.04.2 LTS
waltinator avatar
it flag
`echo "$SHELL"` to see which shell you're using. Read the `man` page for that shell.
Fateme Nazari avatar
is flag
when I used echo "$SHELL" command I got /bin/sh. I googled it and it seems that I should change the sh to bash and there is a command like chsh and when I use that I got permission error.
Score:1
hr flag

Based on your screenshot, you are using the sh shell. On Ubuntu systems, /bin/sh is dash, the Debian Almquist shell, which is a lightweight shell that does not provide shell history features.

To switch to Ubuntu's default interactive shell, bash, you can do any one of

  • type bash to open a new interactive shell within your sh shell

  • type exec bash to replace the current sh shell with bash

  • type chsh -s /bin/bash to set your default login shell to bash - you will be prompted to enter your password to confirm the change.

See also Arrow keys, Home, End, tab-complete keys not working in shell

Fateme Nazari avatar
is flag
thank you so much. The first one worked. but for chsh -s /bin/bash it says I cannot change it. so it seems I have to use bash command every time.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.