mathiasbynens / mathiasbynens/dotfiles

Use .ssh/known_host for tab completion on ssh, scp, sftp

Open
#298 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Shell
Stars
31.5k
Forks
8.4k
PR merge metrics
No merged PRs in 30d

Description

Why not use `~/.ssh/knownhosts` for tab completion on `ssh`, `scp`, `sftp`.
This way you have easier access to other hosts.

I use the following command:

``` bash
HOSTLIST=$(echo `cat ~/.ssh/known_hosts | cut -f 1 -d ' ' | sed -e s/,.*//g | uniq | cut -f 1 -d ':' | cut -f 1 -d ']' | cut -d '[' -f2`;)
complete -W "${HOSTLIST}" ssh sftp scp
```

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the repository's shell completion configuration and the issue's sample command, then inspect how host names can be read from ~/.ssh/known_hosts. Done means ssh, scp, and sftp tab completion include the relevant known hosts without breaking existing completion behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, shell
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.