Execute a command without sharing access to connected networks

unshare

  • Execute a command in new user-defined namespaces.
    More information: <https://www.kernel.org/doc/html/latest/userspace-api/unshare.html>.
  • Trick copyright: tl;dr; <https://github.com/tldr-pages/tldr>

unshare --net {{command}} {{command_arguments}}

click the source code to copy install unshare on any operating system with command-not-found.com