←May→
| Sun |
Mon |
Tue |
Wed |
Thu |
Fri |
Sat |
| |
|
1 |
2 |
3 |
4 |
5 |
| 6 |
7 |
8 |
9 |
10 |
11 |
12 |
| 13 |
14 |
15 |
16 |
17 |
18 |
19 |
| 20 |
21 |
22 |
23 |
24 |
25 |
26 |
| 27 |
28 |
29 |
30 |
31 |
|
|
|
|
Sat, May 12, 2012 2:25 pm
Determining the Package for a File on a Ubuntu Linux System
To determine which installed package provides a file on a
Ubuntu Linux system, you can
use the command
dpkg -S filename. If you need
a particular file, but the package providing it is not installed,
you can install the
apt-file package and then use
the command
apt-file search filename to determine
which package or packages provide it.
[ More Info ]
[/os/unix/linux/ubuntu]
permanent link
Thu, Apr 19, 2012 5:57 pm
Wed, Apr 11, 2012 10:48 pm
Show the list of installed packages on a Ubuntu system
To display the list of installed packages on a
Ubuntu Linux system from a shell prompt,
you can use
dpkg --get-selections. You can also use the
Ubuntu Software Center, if you prefer a
GUI method of checking.
$ dpkg --get-selections | more
accountsservice install
acl install
acpi-support install
acpid install
adduser install
adium-theme-ubuntu install
aisleriot install
alsa-base install
alsa-utils install
amazonmp3 install
anacron install
If you only want to determine whether a paricular package is installed,
you can use grep to filter the results.
$ dpkg --get-selections | grep libboost
libboost-filesystem1.46.1 install
libboost-serialization1.46.1 install
libboost-system1.46.1 install
You can find the locations for the files installed when the package was
installed by using the -L option with dpkg
$ dpkg -L libboost-filesystem1.46.1
/.
/usr
/usr/lib
/usr/lib/libboost_filesystem.so.1.46.1
/usr/share
/usr/share/doc
/usr/share/doc/libboost-filesystem1.46.1
/usr/share/doc/libboost-filesystem1.46.1/copyright
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/libboost-filesystem1.46.1
/usr/share/doc/libboost-filesystem1.46.1/NEWS.Debian.gz
/usr/share/doc/libboost-filesystem1.46.1/README.Debian.gz
/usr/share/doc/libboost-filesystem1.46.1/changelog.Debian.gz
To obtain information regarding a package, including its description,
you can use the -s or --status option followed
by the complete package name.
$ dpkg -s libboost-filesystem1.46.1
Package: libboost-filesystem1.46.1
Status: install ok installed
Priority: optional
Section: libs
Installed-Size: 208
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: i386
Source: boost1.46
Version: 1.46.1-5ubuntu2
Depends: libboost-system1.46.1 (>= 1.46.1-1), libc6 (>= 2.4), libgcc1 (>= 1:4.1.1), libstdc++6 (>= 4.1.1)
Description: filesystem operations (portable paths, iteration over directories, etc) in C++
This package forms part of the Boost C++ Libraries collection.
.
The Boost Filesystem Library provides portable facilities to query and
manipulate paths, files, and directories. The goal is to
facilitate portable script-like operations from within C++ programs.
Homepage: http://boost.org/libs/filesystem/
Original-Maintainer: Debian Boost Team <pkg-boost-devel@lists.alioth.debian.org>
[/os/unix/linux/ubuntu]
permanent link
Thu, Apr 05, 2012 7:57 pm
Recovering Lost Photos with DEFT Linux and PhotoRec
DEFT Linux can be used for
forensics examination of a disk drive or to recover deleted or otherwise
lost files from a disk drive.
If you have lost files on a device, such as a memory card from a camera,
perhaps because you accidentally deleted them, you can use DEFT and
the
PhotoRec utility that comes with
DEFT 7 to search for and recover
those files.
PhotoRec 6.13 comes with
DEFT 7. PhotoRec was created by Christophe Grenier. It is also
available for
Mac OS X and Microsoft Windows systems.
[ More Info ]
[/os/unix/linux/deft]
permanent link
Sun, Nov 13, 2011 3:03 pm
Determining the Network Interface Card (NIC) in a Linux System with lspci
I found that a
network interface card (NIC) in a system was not picking up an
IP via
DHCP. When I checked the
IP configuration for the card,
I saw it had an invalid
MAC address of all zeros.
$ ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:00:00:00:00:00
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:19 Base address:0xdead
The system had an Ethernet controller built into the motherboard. In such
cases you can determing what Ethernet controller is being used by opening
the system case or you can use the lspci command.
$ lspci | grep Ethernet
00:04.0 Ethernet controller: Silicon Integrated Systems [SiS] 190 Ethernet Adapt
er
On Linux systems, the lspi command displays information about
Peripheral
Component Interconnect (PCI) buses in the system and devices connected to
them.
In the above case I could see that the system needed a Linux driver for
a SiS 190 Ethernet Adapter.
NAME
lspci - list all PCI devices
SYNOPSIS
lspci [options]
DESCRIPTION
lspci is a utility for displaying information about PCI buses in the
system and devices connected to them.
By default, it shows a brief list of devices. Use the options described
below to request either a more verbose output or output intended for
parsing by other programs.
If you are going to report bugs in PCI device drivers or in lspci
itself, please include output of "lspci -vvx" or even better "lspci
-vvxxx" (however, see below for possible caveats).
Some parts of the output, especially in the highly verbose modes, are
probably intelligible only to experienced PCI hackers. For exact defi
nitions of the fields, please consult either the PCI specifications or
the header.h and /usr/include/linux/pci.h include files.
Access to some parts of the PCI configuration space is restricted to
root on many operating systems, so the features of lspci available to
normal users are limited. However, lspci tries its best to display as
much as available and mark all other information with <access denied>
text.
OPTIONS
Basic display modes
-m Dump PCI device data in a backward-compatible machine readable
form. See below for details.
-mm Dump PCI device data in a machine readable form for easy parsing
by scripts. See below for details.
-t Show a tree-like diagram containing all buses, bridges, devices
and connections between them.
Display options
-v Be verbose and display detailed information about all devices.
-vv Be very verbose and display more details. This level includes
everything deemed useful.
-vvv Be even more verbose and display everything we are able to
parse, even if it doesn't look interesting at all (e.g., unde
fined memory regions).
-k Show kernel drivers handling each device and also kernel modules
capable of handling it. Turned on by default when -v is given
in the normal mode of output. (Currently works only on Linux
with kernel 2.6 or newer.)
-x Show hexadecimal dump of the standard part of the configuration
space (the first 64 bytes or 128 bytes for CardBus bridges).
-xxx Show hexadecimal dump of the whole PCI configuration space. It
is available only to root as several PCI devices crash when you
try to read some parts of the config space (this behavior proba
bly doesn't violate the PCI standard, but it's at least very
stupid). However, such devices are rare, so you needn't worry
much.
-xxxx Show hexadecimal dump of the extended (4096-byte) PCI configura
tion space available on PCI-X 2.0 and PCI Express buses.
-b Bus-centric view. Show all IRQ numbers and addresses as seen by
the cards on the PCI bus instead of as seen by the kernel.
-D Always show PCI domain numbers. By default, lspci suppresses
them on machines which have only domain 0.
Options to control resolving ID's to names
-n Show PCI vendor and device codes as numbers instead of looking
them up in the PCI ID list.
-nn Show PCI vendor and device codes as both numbers and names.
-q Use DNS to query the central PCI ID database if a device is not
found in the local pci.ids file. If the DNS query succeeds, the
result is cached in ~/.pciids-cache and it is recognized in sub
sequent runs even if -q is not given any more. Please use this
switch inside automated scripts only with caution to avoid over
loading the database servers.
-qq Same as -q, but the local cache is reset.
-Q Query the central database even for entries which are recognized
locally. Use this if you suspect that the displayed entry is
wrong.
Options for selection of devices
-s [[[[<domain>]:]<bus>]:][<slot>][.[<func>]]
Show only devices in the specified domain (in case your machine
has several host bridges, they can either share a common bus
number space or each of them can address a PCI domain of its
own; domains are numbered from 0 to ffff), bus (0 to ff), slot
(0 to 1f) and function (0 to 7). Each component of the device
address can be omitted or set to "*", both meaning "any value".
All numbers are hexadecimal. E.g., "0:" means all devices on
bus 0, "0" means all functions of device 0 on any bus, "0.3"
selects third function of device 0 on all buses and ".4" shows
only the fourth function of each device.
-d [<vendor>]:[<device>]
Show only devices with specified vendor and device ID. Both ID's
are given in hexadecimal and may be omitted or given as "*",
both meaning "any value".
Other options
-i <file>
Use <file> as the PCI ID list instead of
/usr/share/misc/pci.ids.
-p <file>
Use <file> as the map of PCI ID's handled by kernel modules. By
default, lspci uses /lib/modules/kernel_version/modules.pcimap.
Applies only to Linux systems with recent enough module tools.
-M Invoke bus mapping mode which performs a thorough scan of all
PCI devices, including those behind misconfigured bridges, etc.
This option gives meaningful results only with a direct hardware
access mode, which usually requires root privileges. Please
note that the bus mapper only scans PCI domain 0.
--version
Shows lspci version. This option should be used stand-alone.
PCI access options
The PCI utilities use the PCI library to talk to PCI devices (see
pcilib(7) for details). You can use the following options to influence
its behavior:
-A <method>
The library supports a variety of methods to access the PCI
hardware. By default, it uses the first access method avail
able, but you can use this option to override this decision. See
-A help for a list of available methods and their descriptions.
-O <param>=<value>
The behavior of the library is controlled by several named
parameters. This option allows to set the value of any of the
parameters. Use -O help for a list of known parameters and their
default values.
-H1 Use direct hardware access via Intel configuration mechanism 1.
(This is a shorthand for -A intel-conf1.)
-H2 Use direct hardware access via Intel configuration mechanism 2.
(This is a shorthand for -A intel-conf2.)
-F <file>
Instead of accessing real hardware, read the list of devices and
values of their configuration registers from the given file pro
duced by an earlier run of lspci -x. This is very useful for
analysis of user-supplied bug reports, because you can display
the hardware configuration in any way you want without disturb
ing the user with requests for more dumps.
-G Increase debug level of the library.
MACHINE READABLE OUTPUT
If you intend to process the output of lspci automatically, please use
one of the machine-readable output formats (-m, -vm, -vmm) described in
this section. All other formats are likely to change between versions
of lspci.
All numbers are always printed in hexadecimal. If you want to process
numeric ID's instead of names, please add the -n switch.
Simple format (-m)
In the simple format, each device is described on a single line, which
is formatted as parameters suitable for passing to a shell script,
i.e., values separated by whitespaces, quoted and escaped if necessary.
Some of the arguments are positional: slot, class, vendor name, device
name, subsystem vendor name and subsystem name (the last two are empty
if the device has no subsystem); the remaining arguments are option-
like:
-rrev Revision number.
-pprogif
Programming interface.
The relative order of positional arguments and options is undefined.
New options can be added in future versions, but they will always have
a single argument not separated from the option by any spaces, so they
can be easily ignored if not recognized.
Verbose format (-vmm)
The verbose output is a sequence of records separated by blank lines.
Each record describes a single device by a sequence of lines, each line
containing a single `tag: value' pair. The tag and the value are sepa
rated by a single tab character. Neither the records nor the lines
within a record are in any particular order. Tags are case-sensitive.
The following tags are defined:
Slot The name of the slot where the device resides
([domain:]bus:device.function). This tag is always the first in
a record.
Class Name of the class.
Vendor Name of the vendor.
Device Name of the device.
SVendor
Name of the subsystem vendor (optional).
SDevice
Name of the subsystem (optional).
PhySlot
The physical slot where the device resides (optional, Linux
only).
Rev Revision number (optional).
ProgIf Programming interface (optional).
Driver Kernel driver currently handling the device (optional, Linux
only).
Module Kernel module reporting that it is capable of handling the
device (optional, Linux only).
New tags can be added in future versions, so you should silently ignore
any tags you don't recognize.
Backward-compatible verbose format (-vm)
In this mode, lspci tries to be perfectly compatible with its old ver
sions. It's almost the same as the regular verbose format, but the
Device tag is used for both the slot and the device name, so it occurs
twice in a single record. Please avoid using this format in any new
code.
FILES
/usr/share/misc/pci.ids
A list of all known PCI ID's (vendors, devices, classes and sub
classes). Maintained at http://pciids.sourceforge.net/, use the
update-pciids utility to download the most recent version.
/usr/share/misc/pci.ids.gz
If lspci is compiled with support for compression, this file is
tried before pci.ids.
~/.pciids-cache
All ID's found in the DNS query mode are cached in this file.
BUGS
Sometimes, lspci is not able to decode the configuration registers com
pletely. This usually happens when not enough documentation was avail
able to the authors. In such cases, it at least prints the > mark to
signal that there is potentially something more to say. If you know the
details, patches will be of course welcome.
Access to the extended configuration space is currently supported only
by the linux_sysfs back-end.
SEE ALSO
setpci(8), update-pciids(8), pcilib(7)
AUTHOR
The PCI Utilities are maintained by Martin Mares <mj@ucw.cz>.
pciutils-3.1.7 31 January 2010 lspci(8)
[/os/unix/commands]
permanent link
Sun, Nov 13, 2011 11:10 am
Mounting a USB Drive on a Linux System from the Command Line
If you need to manually mount a USB external drive, such as a flash
drive, from the command line, i.e., a shell prompt,
log into the root account for the system then issue the
dmesg
command feeding its results to
grep and then use
tail
to get just the last line containing the word "SCSI", since if you just
plugged the device into the system, that last line likely contains the relevant
entry.
$ su - root
Password:
# dmesg | grep -i 'SCSI device' | tail --lines=1
SCSI device sdb: 7813120 512-byte hdwr sectors (4000 MB)
Since I know the flash drive I plugged into the system in this case is
a 4 GB drive, I know that sdb is indeed the relevant drive
designator.
Alternatively you could look for the information in /var/log/messages
.
[root@example ~]# grep SCSI /var/log/messages | tail --lines=1
Nov 13 09:55:55 example kernel: SCSI device sdb: 7813120 512-byte hdwr secto
rs (4000 MB)
You can then use the information you obtained for the drive designator,
in this case sdb to mount the drive. Note you might see other
"sd" designators, such as sda, sdc, sdd, etc., or "hd" designators, such as
hda, hdb, hdc, etc.
Use the mount command to mount the drive to an
exising mount point, such as one beneath /mnt or
/media. Unless a directory already exists that you
wish to use, you could create a directory which you will use to
access the contents of the USB drive. Let's suppose you want to use
myusb for that directory; you then need to create the
directory.
Presuming the file system on the flash drive is vfat, I could use the
command below to mount the device at the mount point /media/myusb.
You need to spcify the file system type with the -t option.
Note: I use sdb1 rather than just the designator sdb,
since I want to mount the first and, in this case, only partition, on the
flash drive. The
VFAT file system is a commonly used one for flash and other USB drives. It
is a Microsoft created file system that allows the use of file names longer
than an 8 character file name with a 3 character extension.
[root@example ~]# mount -t vfat /dev/sdb1 /media/myusb
I can then issue the mount command again without any parameters
to verify the drive is mounted.
[root@example ~]# mount | grep sdb
/dev/sdb1 on /media/myusb type vfat (rw)
The rw on the output shows me that the drive is mounted
in read/write mode rather than read only (ro) mode, so I could write to
the drive as well as read from it.
You should then be able to access the drive using /media/myusb,
or whatever you used for the path designator.
[root@frostdragon ~]# ls /media/myusb
aoss.txt definitions
When you are finished with the drive, you should unmount it using the
umount command prior to removing it from the system. You can
also remove the directory you created for mounting it using the rmdir
command, unless you will use that same directory for mounting it or
other drives in the future.
[root@example ~]# umount /media/myusb
[root@example ~]# rmdir /media/myusb
References:
-
VFAT
Wikipedia, the free encyclopedia
-
How to Mount USB flash drive from Command Line
Date: December 1, 2007
Linux Commando
[/os/unix/linux]
permanent link
Sun, Nov 13, 2011 10:46 am
lsusb
To see a list of all USB devices connected to a Linux computer, use the
lsusb command.
# lsusb
Bus 005 Device 001: ID 0000:0000
Bus 002 Device 001: ID 0000:0000
Bus 004 Device 001: ID 0000:0000
Bus 001 Device 002: ID 0781:5530 SanDisk Corp.
Bus 001 Device 001: ID 0000:0000
Bus 003 Device 001: ID 0000:0000
Note: if you type lsusb and get a "command not found" message,
the command may not be in your path. It may be in /sbin, so
try specifying the path /sbin/lsusb.
To see more details on the USB devices attached to the system, use
lsusb -v. If you don't specify a particular device you
are interested in, you will get quite a bit of information. To restrict
the information to a particular device, e.g., the SanDisk flash drive
in the list above, you can specify a device and bus number, e.g., bus 001
and device number 002 in the above case, using the -s option.
# lsusb -v -s 1:2
Bus 001 Device 002: ID 0781:5530 SanDisk Corp.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x0781 SanDisk Corp.
idProduct 0x5530
bcdDevice 1.00
iManufacturer 1
iProduct 2
iSerial 3
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 32
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
MaxPower 200mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 8 Mass Storage
bInterfaceSubClass 6 SCSI
bInterfaceProtocol 80 Bulk (Zip)
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 1
can't get device qualifier: Connection timed out
can't get debug descriptor: Connection timed out
If you move the USB device to another USB port on the system, you will
see the bus number and device number combination change.
# lsusb
Bus 005 Device 001: ID 0000:0000
Bus 002 Device 001: ID 0000:0000
Bus 004 Device 001: ID 0000:0000
Bus 001 Device 007: ID 0781:5530 SanDisk Corp.
Bus 001 Device 001: ID 0000:0000
Bus 003 Device 001: ID 0000:0000
The full list of options for the command is shown below.
# lsusb -h
lsusb: invalid option -- h
Usage: lsusb [options]...
List USB devices
-v, --verbose
Increase verbosity (show descriptors)
-s [[bus]:][devnum]
Show only devices with specified device and/or
bus numbers (in decimal)
-d vendor:[product]
Show only devices with the specified vendor and
product ID numbers (in hexadecimal)
-D device
Selects which device lsusb will examine
-t
Dump the physical USB device hierarchy as a tree
-V, --version
Show version of program
References:
-
Linux / Unix Command: lsusb
Linux Operating System and Linux Distributions
[/os/unix/commands]
permanent link
Fri, Nov 11, 2011 2:04 pm
Creating a tar file from a list of files
If you wish to create a
tar file
using a text file which contains the list of files to be archived, you can do so
using the
xargs command.
$ cat filenames.txt | xargs tar -cvf allfiles.tar
If the list of file names contains spaces in file names or in the directory
paths, you should put double quotes at the beginning and end of each line
before you run the tar command, which you can do with the
sed command.
$ sed -i 's/^/"/' filenames.txt
$ sed -i 's/$/"/' filenames.txt
[/os/unix/commands]
permanent link
Sun, Sep 18, 2011 6:15 pm
Extracting the Contents of a .bz2 File
To extract the contents of a
.bz2 file on a Linux or Unix system, such
as Solaris, you can use the
bunzip2 command.
bunzip2 file.bz2
The .bz2 file will be deleted when its contents are extracted. If you
wish to keep the original .bz2 file, you can use the -k or
--keep options.
-k --keep
Keep (don't delete) input files during compression or
decompression.
References:
-
File Extension .BZ2 Details
FilExt
-
Extract a bz2 or bzip2 file
By: qmchenry
Date: July 11, 2006
Tech-Recipes
-
Running Linux
By: Matt Welsh
Third Edition, Chapter 7, Archive and Compression Utilities, pages 184-187
[/os/unix/programs/utilities]
permanent link
Sun, Sep 11, 2011 10:00 pm
Xubuntu
I sometimes use a
Ubuntu Linux
live CD for troubleshooting issues with Microsoft Windows systems, since
a live CD allows me to boot the system from a CD without loading the Microsoft
Windows operating system on the hard drive. Or when I'm working at a site
without my own laptop, a live CD allows me to boot a system at the site without
fear that a system may be potentially infected with malware that might perform
keystroke logging
or might otherwise be monitored by someone remotely unbeknownst to the system's
owner.
I created a
Ubuntu 11.04 Desktop edition
live CD for booting a system so that I could
check on files on the system which had Microsoft Windows XP Home edition on
the hard drive. The system's owner reported she was having problems with
the system and I wanted to start with a quick look at some of the files on
the system and make a backup of her "My Documents" folder. I needed to open
Firefox on the system to check on some information online, but whenever I
opened a second tab in Firefox to Amazon.com, Firefox would crash. It also
crashed with only one tab open when I used Ctrl-Alt-F2 to obtain
a shell prompt with an error message indicating that there was a problem
with inadequate memory.
The system had a 3.2 GHz processor, but only 512 MB of memory and the
system requirements for Ubuntu Desktop Edition 11.04 (Natty Narwhal) listed on
the Ubuntu site were as follows:
- 1 GHz x86 processor (Pentium 4 or better)
- 512 MiB of
system memory (RAM)
- 5 GB of hard-drive space
- Graphics card and monitor capable of 800x600
- Either a CD/DVD drive or a USB port (or both)
- Internet access is helpful
Since the system just met the minimum memory requirement for Ubuntu 11.04,
I decided to try
Xubuntu (pronounced "zoo-BOON-too"), instead. Xubuntu is a derivative of
Ubuntu, which uses the Xfce desktop environment, which requires less memory
than the
Unity desktop used by Ubuntu.
Xubuntu is a community developed, Ubuntu-based Linux operating
system that is well-suited for both laptops and desktops. It contains
all the applications you need - a web browser, document and spreadsheet
editing software, instant messaging and much more.
Minimum system requirements
You need 256 MB
RAM to run the Live CD or 256 MB
RAM to install. The Alternate Install CD only requires you to have 64 MB RAM at
install time.
To install Xubuntu with the standard installer (Ubiquity), you
need 4.4 GB of free space
on your hard disk. The Alternate Install CD only requires you to have 2 GB of
free space on your hard disk.
Once installed, Xubuntu can run with starting from 256 (or even
just 192) MB RAM, but it is strongly recommended to have at least
512 MB RAM.
I downloaded
Xubuntu 11.04 (Natty Narwhal). I burned it to a CD and rebooted the
system with it. I found that I didn't have any problems when I opened
multiple tabs in Firefox under Xubuntu.
References:
-
Homepage | Ubuntu
-
Ubuntu
Wikipedia, the free encyclopedia
-
Xubuntu Home Page | Xubuntu
-
Xubuntu
Wikipedia, the free encyclopedia
-
DistroWatch.com:
Xubuntu
DistroWatch.com: Put the fun back into computing. Use Linux, BSD.
-
Unity (user interface)
Wikipedia, the free encyclopedia
[/os/unix/linux/xubuntu]
permanent link
Privacy Policy
Contact