SSH command history: find and reuse Bash commands

An SSH connection gives you access to a remote shell. The commands you can recall usually come from that shell and its user account, not from a universal history shared by every server.

Start with the shell you already have

In Bash, the Up arrow recalls earlier commands. Ctrl+R searches backwards through history: type a distinctive fragment, press Ctrl+R again to find an older match, then inspect the command before running it. These operations do not require sudo.

history
# Press Ctrl+R, then type part of a previous command.

Suggestions while you type

NexusTerm adds a visible suggestion list based on recent commands available to the current Bash user. Start typing a prefix, select a suggestion and use Tab to complete it. Completion prepares the command; Enter executes it. This is useful when several commands begin with kubectl or when a long path is hard to remember.

kubectl get pods -n production
kubectl get deployments -n production

Choose where history is active

Set automatic activation in NexusTerm settings, or choose it for a particular connection. A server where you use an interactive Bash shell may suit suggestions; an appliance with a restricted command interface may not. Avoid assuming that every SSH endpoint runs Bash.

Why a command may be missing

A command can be absent because it belongs to another user, another shell or an earlier session whose history was not saved. Shell settings can also exclude commands. After changing user, history and permissions belong to the new shell context; the client cannot manufacture access to another user’s private history.

Keep the final review

Before pressing Enter, check the host, namespace and paths. A command recalled from a previous environment may be syntactically correct but target the wrong resource. Avoid putting passwords or tokens directly into shell commands: history can retain what you type.

Reference documentation: Bash manual: history interaction.