Posts Tagged ‘check’

Each user on a unix system is assigned a user id, or uid. You can see your uid by running ‘id -u’. root will have a uid of zero. So to check if the user running a script is root, you can simply check that id -u is equal to zero, like so: if [ […]

Ever jumped onto an Ubuntu server somewhere without knowing which operating system version it’s running? You can find this out with one simple command: lsb_release -a This will provide output like: Distributor ID: Ubuntu Description: Ubuntu 9.10 Release: 9.10 Codename: karmic