It depends on the distributions. For Debian-based distributions, like Kali Linux, these methods should work. However, for other distributions like CentOS and ArchLinux, you need other commands according to your Linux package management system.