LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-18-2011, 05:19 PM   #1
Advice Pro
Member
 
Registered: Mar 2009
Location: Virginia, US
Distribution: Ubuntu 10.10 & Debian 6.0.3,
Posts: 343

Rep: Reputation: 7
What's the difference between these terminal commands?


  1. dpkg -l
  2. dpkg -list
  3. dpkg -list | less
 
Old 02-18-2011, 05:37 PM   #2
fordeck
Member
 
Registered: Oct 2006
Location: Utah
Posts: 520

Rep: Reputation: 61
Here is a brief explanation:

dpkg -l ( will list installed packages )
dpkg -list ( is not a valid option, use --list instead and will return the same output as -l )
dpkg --list | less ( less will allow you to page through the results if it is longer than a single page )


Regards,

Fordeck
 
Old 02-18-2011, 05:37 PM   #3
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 271Reputation: 271Reputation: 271
man dpkg and man less. The | is called a pipe and spits the output of the first into the second.

The second and third commands need to be dpkg --list (with two dashes).

EDIT: Here's a link to a handy reference card for Debian commands.

Last edited by pljvaldez; 02-18-2011 at 05:38 PM.
 
Old 02-23-2011, 12:24 PM   #4
Advice Pro
Member
 
Registered: Mar 2009
Location: Virginia, US
Distribution: Ubuntu 10.10 & Debian 6.0.3,
Posts: 343

Original Poster
Rep: Reputation: 7
  1. With dpkg -l, the list always cuts off the top, is there an alternative?
  2. Can I dist only uninstalled packages?
 
Old 02-23-2011, 12:31 PM   #5
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 271Reputation: 271Reputation: 271
Yup, just use the grep command after a pipe. So something like dpkg --get-selections |grep uninstall. (or maybe it's not-installed. Also there's purge - which are files that were not just removed, but purged, i.e. their config files were also deleted).

Last edited by pljvaldez; 02-23-2011 at 12:39 PM.
 
Old 02-23-2011, 12:34 PM   #6
fordeck
Member
 
Registered: Oct 2006
Location: Utah
Posts: 520

Rep: Reputation: 61
Quote:
Originally Posted by Advice Pro View Post
  1. With dpkg -l, the list always cuts off the top, is there an alternative?
  2. Can I dist only uninstalled packages?
If you want to page through the results just use

dpkg -l | less

That will pipe the output to the pager. In this case less

Regarding the un-installed packages just use:

apt-cache search <package_name>

Regards,

Fordeck
 
Old 02-23-2011, 12:39 PM   #7
timdvtemp
Member
 
Registered: Feb 2011
Distribution: Redhat/Fedora
Posts: 39

Rep: Reputation: 3
"With dpkg -l, the list always cuts off the top, is there an alternative?"

Yes there is. As before mentioned, the pipe (|) symbol can "pipe" (direct) the output of a program somewhere else. In this case, you can pipe the output to "less" or "more".

I myself would do this: dpkg -l | more

Alternatively: dpkg -l | less

Essentially the same result. Press space to go down page by page, otherwise use the up and down arrows. Press q to quit less, enter to quit more.
 
Old 02-23-2011, 12:57 PM   #8
Advice Pro
Member
 
Registered: Mar 2009
Location: Virginia, US
Distribution: Ubuntu 10.10 & Debian 6.0.3,
Posts: 343

Original Poster
Rep: Reputation: 7
Quote:
Originally Posted by fordeck View Post
Regarding the un-installed packages just use:

apt-cache search <package_name>
I meant a list of all uninstalled packages, the above command only gives info on an uninstalled package.
 
Old 02-23-2011, 01:09 PM   #9
slack-fu
Member
 
Registered: Feb 2006
Location: Norway
Distribution: Slackware Linux 13.37
Posts: 71

Rep: Reputation: 10
apt-cache search * | grep uninstalled
 
Old 02-23-2011, 01:36 PM   #10
fordeck
Member
 
Registered: Oct 2006
Location: Utah
Posts: 520

Rep: Reputation: 61
Quote:
Originally Posted by slack-fu View Post
apt-cache search * | grep uninstalled
Won't return anything, the reason being is that the cache does not list a package as uninstalled. The cache only has available packages and this list of available packages would have thousands of possibilities. Generally you would have somewhat of an idea as to what you are looking for. For example a search for openvpn would return the following results:

Code:
$ apt-cache search openvpn
openvpn-blacklist - list of blacklisted OpenVPN RSA shared keys
anytun - secure anycast tunneling protocol
ebox-openvpn - eBox - VPN Service
gadmin-openvpn-client - GTK+ configuration tool for openvpn (client)
gadmin-openvpn-client-dbg - GTK+ configuration tool for openvpn (debug for client)
gadmin-openvpn-server - GTK+ configuration tool for openvpn (server)
gadmin-openvpn-server-dbg - GTK+ configuration tool for openvpn (debug for server)
gadmintools - GTK+ server administration tools
kvpnc - vpn clients frontend for KDE4
network-manager-openvpn - network management framework (OpenVPN plugin)
network-manager-openvpn-gnome - network management framework (OpenVPN plugin, GNOME UI)
network-manager-openvpn-kde - KDE NetworkManagement infrastructure (OpenVPN plugin)
openvpn-auth-ldap - OpenVPN LDAP authentication module
tunneldigger - Configures OpenVPN tunnel networks
tunneldigger-utils - Utilities for TunnelDigger-configured OpenVPN tunnels
openvpn - virtual private network daemon
collectd-core - statistics collection and monitoring daemon (core system)
Notice that in this case openvpn is basically a search term not necessarily a package name. So it returns anything that has openvpn in the package description.

Regards,

Fordeck
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Terminal commands working in terminal but not in a script GreYFoXGTi Linux - Newbie 1 08-04-2010 09:36 AM
making a script that opens terminal and enter commands into that terminal Cinematography Linux - General 8 12-16-2008 10:34 AM
Need help for Windows cmd commands into Linux terminal commands. windowsNilo Linux - Software 2 07-02-2008 06:26 PM
Need help for Windows cmd commands into Linux terminal commands. windowsNilo Linux - General 2 07-01-2008 06:53 AM
Difference between a Shell terminal window and the KDE Linux Console terminal window? bostonantifan Fedora 2 03-25-2007 07:23 PM


All times are GMT -5. The time now is 06:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration