Golden Codes - armanexplorer planet

Practical code snippets for Django, Python, Bash, Git and All!

View on GitHub

append after a line using sed

The command sed -i '/Port 22/a Port 143' /etc/ssh/sshd_config will insert the line Port 143 after the line containing Port 22 in the file /etc/ssh/sshd_config. Here's a breakdown of the command:

By running this command, you are instructing sed to find the line with Port 22 in /etc/ssh/sshd_config and add a new line Port 143 after it. This can be useful for changing or adding configuration options in files without manually editing them.