Add nmap to the bash-completion fun

Find this line in /etc/bash_completion:

complete -F _known_hosts traceroute traceroute6 tracepath tracepath6 \
ping fping telnet host nslookup rsh rlogin ftp dig ssh-installkeys mtr

Add the word nmap to the end of that list.

About Nathan Powell

I am a middle aged technologist freak-ball.
This entry was posted in computers. Bookmark the permalink.

3 Responses to Add nmap to the bash-completion fun

  1. Don Spidell says:

    You people and your bash completion, tabbed browser windows, and ssh keys. What’s next? Non-volatile memory? Some kind of visual device so you can see what you’re typing? Gah… no one does things the old fashioned way anymore.

  2. Bob Igo says:

    So … what is this supposed to do? Re-running bash after the change and typing ‘nmap [tab]‘ gave me a bizarre list of things that look nothing like stuff I’d use as parameters to nmap.

  3. Bob,

    Well, in theory it should read your ~/.ssh/known_hosts file and use the ip’s and domain names contained in there. Unfortunately Ubuntu’s default config makes this difficult. For this to work well, you have to make your /etc/ssh/ssh_config look like:

    HashKnownHosts no

    Otherwise, ssh makes all the hostnames/ip’s hashes. Which aren’t as useful in this context.