First, Open SSH Configuration File (sshd) :
Find the line that reads #Port 22. Next, eplace it with New Port :
To:
Second, Save File Modification Press Ctrl + O and Enter After Press Ctrl + X
Next, restart the SSH service using the following command:
Debian and Ubuntu:
Debian and Ubuntu with systemd:
CentOS and Fedora
CentOS and Fedora with systems: