Windows Command prompt command for locking the machine
C:\Users\duksis> rundll32.exe user32.dll,LockWorkStation
On Ubuntu gnome possibly
$ gnome-screensaver-command -l
sources:
https://askubuntu.com/questions/184728/how-do-i-lock-the-screen-from-a-terminal
https://www.youtube.com/watch?v=-bl8iPgt-2w