sed -i 18d .ssh/known_hosts
Using sed to remove a specific line.
The -i
parameter is to edit the file in-place.
This works as posted in GNU sed
.
In BSD sed
, the -i
flag requires a parameter to use as the suffix of a backup file.
You can set it to empty to not use a backup file:
sed -i'' 18d .ssh/known_hosts
vi +18d +wq ~/.ssh/known_hosts
ssh-keygen -R <hostname>