I am running the following command to list the packages installed on a server.
$> dpkg -l
This is fine but when I do this
$> dpkg -l > list_of_packages_installed
I only get 106 columns of data and the rest is cut off. So all the rows are there but not all the data column-wise. There must be something simple I am missing here?
The variable COLUMN is indeed responsible for this. The manpage of dpkg(8) contains under the section “ENVIRONMENT”:
if COLUMNS is set in your environment then dpkg will use it. You can check with
this command:
if that command outputs something like
then you know that this variable is set in your environment.
Note that this command:
does not tell you if it is an environment or a shell variable. COLUMNS can be set as a shell variable without being exported to the environment. With this command:
you explicitely put the variable in the environment of dpkg.
If it was not in your environment then it will be for this command only.
Also note that the behaviour of dpkg in this respect is different between
ubuntu and debian and also depends on the version. There have been a few
bug reports on this topic. The dpkg in squeeze for example will set the
column width so that all package names and version can be displayed in full
if COLUMNS is not set in the environment and the output is not a tty.
Regards