セッション終了後、端末履歴が削除されます。

セッション終了後、端末履歴が削除されます。

私は~/.bash_history大丈夫で、以前に入力したすべてのコマンドがあります。ただし、キーボードの上矢印キーを押すと何も表示されません。コマンドは、historyこのセッションで入力したコマンドのみを表示します。この問題をどのように解決できますか?

私はDebian StretchとGNOME Terminalを使います。

修正する:

HISTSIZE=1000
HISTFILESIZE=2000

$ cat .bash_logout 
# ~/.bash_logout: executed by bash(1) when login shell exits.

# when leaving the console clear the screen to increase privacy

if [ "$SHLVL" = 1 ]; then
    [ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q
fi

Ctrl+R今回のセッションで私が入力したコマンドのみを表示

たとえば、新しい端末ウィンドウを開くと履歴はまったくなく、コマンドを入力すると履歴は次のコマンドだけです。

アップデート2.0

su記録は問題なくうまく機能します。私のユーザーだけです。

新しいユーザーを作成して履歴をテストしましたが、うまくいきました。

rahman@www:~$ history 
    1  history 
rahman@www:~$ su
Password: 
root@www:/home/rahman# history 10
  314  aptitude show linux-image-4.9.0-4-amd64
  315  aptitude show linux-image-4.9.0-3-amd64
  316  aptitude install firmware-linux-free irqbalance
  317  aptitude safe-upgrade
  318  aptitude safe-upgrade -y
  319  exit
  320  exit
  321  exit
  322  history 4
  323  history 10
root@www:/home/rahman# exit
exit
rahman@www:~$ history 10
    1  history 
    2  su
    3  history 10

アップデート3.0

rahman@www:~$ echo $HISTFILE
/home/rahman/.bash_history
rahman@www:~$ echo $HISTCONTROL
ignoreboth

誰でも私を助けることができますか?この質問は迷惑で怒っています。

ベストアンサー1

私はこれを見つけました協会

問題は、以下を実行することで解決されました。

sudo chown <user> .bash_history

おすすめ記事