Archive for the 'Linux' Category

 

Linux usb tree view info..

Oct 02, 2008 in Linux, Ubuntu

To view a tree of USB devices in Linux, install ‘usbview’ (apt-get install usbview)
or get the ‘usbtree’ script from here:

http://www.linux-usb.org/usb2.html

Furthermore, if /dev/bus/usb/devices is not enabled, tweak
/etc/init.d/mountdevsubfs.sh to do so. See here for more info:

https://bugs.launchpad.net/debian/+source/usbview/+bug/156085

Setting the MAC address..

Aug 15, 2008 in Embedded, Linux, Network

On an embedded board (TS7260) I was testing, it turned out
that the MAC address of the network adapter was all FFs.

As a result, I was not able to network to the board at all.

Here is how to set the MAC address:


$ ifconfig eth0 down
$ ifconfig eth0 hw ether 00:80:48:BA:d1:20
$ ifconfig eth0 up

From http://linuxhelp.blogspot.com/2005/09/how-to-change-mac-address-of-your.html

Generating ssh host keys ..

Aug 15, 2008 in Linux

$ cd /etc/ssh
$ ssh-keygen -d -f ssh_host_dsa_key -N ""
$ ssh-keygen -t rsa -b 1024 -f ssh_host_rsa_key -N ""

Setting date and time ..

Aug 11, 2008 in Linux

$ cd /etc
$ mv localtime localtime.0
$ ln -s /usr/share/zoneinfo/America/Los_Angeles ./localtime
$ /usr/sbin/ntpdate -b pool.ntp.org
11 Aug 10:06:43 ntpdate[3429]: step time server 128.10.19.24 offset -0.016644 sec
$ date
Mon Aug 11 10:06:46 PDT 2008

See page for setting the hardware clock with ‘hwclock’.

Info from http://www.hypexr.org/linux_date_time_help.php

Linux USB drivers ..

Aug 07, 2008 in Linux

An intro to developing a USB driver for Linux

http://www.linuxjournal.com/article/4786

Setting up a shared directory in Linux ..

Aug 05, 2008 in Linux

1. Add users a common group

2. Change ownership of directory to the common group

chown -R common:common /xyz/abc/

3. Set the group sticky bit

chmod -R g+s /xyz/abc/

See http://www.cyberciti.biz/faq/linux-setup-shared-directory for more details.

Kernel parameters ..

Jul 25, 2008 in Linux

The sysctl Interface
September 1st, 1997 by Alessandro Rubini in

A look at the sysctl system call that gives you the ability to fine tune kernel parameters.

http://www.linuxjournal.com/article/2365

Free memory on linux (debian) ..

Jul 23, 2008 in Linux

Use the “free” command:

$ free [-k]


     total               used               free         shared       buffers         cached
Mem: 127176         122416             4760                     0           21200           67972
-/+ buffers/cache:          33244          93932
Swap:                       0                   0                   0

The real “available if memory full” number is 93932 in the “-/+” line .

If free memory falls too much, Linux will use memory from cached area.

For more details, see:

$ cat /proc/meminfo

MemTotal:             127176 kB
MemFree:                4704 kB
Buffers:               21204 kB
Cached:                68032 kB
SwapCached:                0 kB
Active:                84412 kB
Inactive:              17952 kB
SwapTotal:                 0 kB
SwapFree:                  0 kB
Dirty:                    44 kB
Writeback:                 0 kB
AnonPages:             13148 kB
Mapped:                11988 kB
Slab:                  18068 kB
SReclaimable:          15372 kB
SUnreclaim:             2696 kB
PageTables:              324 kB
NFS_Unstable:              0 kB
Bounce:                    0 kB
CommitLimit:           63588 kB
Committed_AS:          19120 kB
VmallocTotal:         385024 kB
VmallocUsed:             640 kB
VmallocChunk:         384376 kB

Basic network diagnostics tools..

Jul 07, 2008 in Linux, Network

  • — tcpdump
    — Example:
    tcpdump -enqti eth0 \( arp or icmp \)

    -e Print the link-level header on each dump line.

    -n Don’t convert addresses (i.e., host addresses, port numbers, etc.) to names.

    -q Quick (quiet?) output. Print less protocol information so output lines are shorter.

    -t Don’t print a timestamp on each dump line.

    -i Listen on interface.

  • — ping
  • — netstat -lptun

    l = listening sockets (-a for all), p = show program (app), t = tcp, u = unix, n = numeric address.

  • — arp
    — Example:
    arp -ne
  • — route
  • — traceroute

Ubuntu / Debian package management notes..

Jul 01, 2008 in Linux, Ubuntu

To manage packages in a shell, use these programs:

Set wide printing area:

export COLUMNS=128

dpkg, dpkg-query, dselect, apt-get

‘ dpkg -l ‘*’ ‘ (or dpkg –list ‘*’) is like ‘yum list’ on Fedora.

Check out


http://hawknotes.blogspot.com/2006_04_01_archive.html
for more details..

List installed packages: dpkg -l | rpm -qa

List all available packages: dpkg -l ‘*’ | yum list

List contents of package: dpkg -L package_name | rpm -ql package_name

Find the package that installed file: dpkg -S file | rpm -qf file

Install a package: apt-get install package_name | rpm -i package_name
(or yum install package_name)

Remove a package: dpkg –purge package_name | rpm -e package_name