Forrest logo
back to the sed tool

ssh:authorized-keys:remove

Removes a single authorized key from the ~/.ssh/authorized_keys file
$ sed -i '${key-to-remove}' ~/.ssh/authorized_keys
try on your machine

The command sed -i '${key-to-remove}' ~/.ssh/authorized_keys is a sed command used to remove a specific key from the authorized_keys file located in the ~/.ssh directory.

Here is the breakdown of each part of the command:

  • sed is a stream editor used to perform text transformations on input streams.
  • -i is an option for sed that tells it to edit the file in-place, meaning it will modify the file directly instead of printing the modified output to the standard output.
  • ${key-to-remove} is a placeholder that should be replaced with the actual key you want to remove. It represents the pattern you want to match in the authorized_keys file.
  • ~/.ssh/authorized_keys is the path to the authorized_keys file in the ~/.ssh directory. This is the file that will be edited by the sed command.

When you run this command, sed will search for lines in the authorized_keys file that match the specified key pattern and remove them from the file. The file will be updated with the removal of the key.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the sed tool