In 2021 we can also suggest for linux distributions with systemd the use of systemd-run as a way to detach a process and keep it running after closing ssh login.
One can launch a command , give it some name like 'background_cmd_service' and turn it into a systemd service. Later inspect status:
systemd-run --unit=background_cmd_service --remain-after-exit command
# later on
journalctl -b -u background_cmd_service.service
systemctl status background_cmd_service.service
When launching the service as regular user, one might need to enable lingering (cf. enable-linger loginctl option). This is true even with nohup since systemd is cleaning up all services running within the session once the user logs out.
For scripts, or other executables, you can provide the path to the executable like this:
systemd-run --unit=background_cmd_service --remain-after-exit --working-directory=/full/path/ command
You can also stop your service or clear a failed service using the standard systemctl options like:
systemctl stop background_cmd_service.service
systemctl reset-failed background_cmd_service.service
Many of the pre-2016, but highly voted answers on stack exchange suggesting nohup, disown, command &, and (command &) don't work since 2016, due to a systemd default change in how it treats user processes after user logout - Details