Some commands don’t work because you have insufficient privileges. You need to issue commands with superuser privileges.
The sudo (superuser do) command allows you to perform actions with superuser privileges. Just prefix the command with sudo.
Discussion
Most tasks that you want to perform on the command line can usually be performed without superuser privileges. The most common exceptions to this are when you’re installing new software and editing configuration files.
For example, if you try to use the command apt-get update, you will receive a number of permission denied messages:
$ apt-get update E: Could not open lock file /var/lib/apt/lists/lock – open (13: Permission denied) E: Unable to lock directory /var/lib/apt/lists/ E: Could not open lock file /var/lib/dpkg/lock – open (13: Permission denied) E: Unable to lock the administration directory (/var/lib/dpkg/), are you root? |
The message at the end–are you root?–gives the game away. If you issue the same command prefixed with sudo, the command will work just fine:
$ sudo apt-get update Get:1 http://mirrordirector.raspbian.org wheezy InRelease [12.5 kB] Hit http://archive.raspberrypi.org wheezy InRelease Get:2 http://mirrordirector.raspbian.org wheezy/main Sources [6,241 kB] Hit http://archive.raspberrypi.org wheezy/main armhf Packages Ign http://archive.raspberrypi.org wheezy/main Translation-en_GB Ign http://archive.raspberrypi.org wheezy/main Translation-en 40% [2 Sources 2,504 kB/6,241 kB 40%] |
See Also
To understand more about file permissions, see Recipe 3.12.
To install software using apt-get, see Recipe 3.16.