[Home]Linux Stuff

HomePage | RecentChanges | Preferences

Difference (from prior major revision) (no other diffs)

Added: 498a499,502
dmidecode –type memory

or


Added: 500a505,517
or

cat /proc/meminfo

or

free -l

CPU Info

cat /proc/cpuinfo



General Lessons on using Linux on PCs


Sys Info

 uname -a


TV Out

 http://packages.debian.org/unstable/misc/atitvout

 su
 atitvout -r pal
 atitvout -f t (to switch to TV)
 atitvout -f l (to switch back to LCD) 

Playing DVDs

Install Ogle (http://www.dtek.chalmers.se/groups/dvd/) Install ogle-gui (for the gui version) Install libdvdcss (to playback encrypted DVDs, most are nowadays)

 ogle -u cli /dev/cdrom or /dev/dvd or /dev/hdc 

Some of the default key bindings include the following:

 , slower, in slow-motion sound will be muted
 p play, normal playback speed
 . faster, in fast-forward sound will be muted
 (space), pause / unpause
 > skip to the next chapter
 < skip to the previous chapter
 c resume (if you have jumped to a menu from the movie)
 f toggle between fullscreen and window mode
 q exit the player
 t jumps to the Title menu
 r jumps to the Root menu
 a jumps to the Audio menu
 A jumps to the Angle menu
 P jumps to the PTT (Chapter) menu
 S jumps to the Subpicture menu

Non configurable keys:

 'i', saves a screen shoot (as screenshoot.jpg in pwd)
 'I', saves a screen shoot with the subpicture overlay intact


Compiling Progs

 ldconfig

CPPFLAGS="-I/usr/local/include" LDFLAG="-L/usr/local/lib" PKG_CONFIG_PATH="/usr/local/lib/pkgconfig" export CPPFLAGS LDFLAGS PKG_CONFIG_PATH

LD_LIBRARY_PATH="/usr/local/lib" PATH="/usr/local/bin:$PATH" export LD_LIBRARY_PATH PATH

CFLAGS="/usr/local/lib" export CFLAGS

If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the `-LLIBDIR` flag during linking and do at least one of the following:

   - add LIBDIR to the `LD_LIBRARY_PATH` environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH` environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR` linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf`


Debian Package Management

Searches for xxxx

 apt-cache search "xxxx"

Converts Red Hat/Suse? package to Debian

 alien -d xxx.rpm

Installs a Debian Package

 dpkg - i xxx.deb


X Windows

/etc/X11/default-display-manager contains the default DM

/etc/init.d/{g|k|x|w}dm contains HEED_DEFAULT_DISPLAY_MANAGER which if TRUE will only start the DM if /etc/X11/default-display-manager shows it as the default DM

 startx


Create a Swap Partition

 cfdisk /dev/hdd2 (or whatever the device is)

select the "Free Space"
select New
select Primary
enter the size
select Beginning
select Type
select 82 Linux Swap
select Write
confirm

 mkswap -c /dev/hdd2

 swapon /dev/hdd2

add following to /etc/fstab

 /dev/hdd2 swap swap sw,pri=1 0 0


Merging two partitions on a disk to one

Easiest way is to used GNU Parted:

 apt-get install parted

If the device is mounted:

 df 

this will show u the mount name so then un mount it:

 umount /mt/xyz

Now enter parted:

 parted /dev/hdd

NOTE! Don't forget to tell it the right disk to partition, don't just run parted as it will assume your current disk!!!

Use parted's "print" command to show current partitions:

 print
Note the Disk used and it's size, 20.5GB in my case

Delete existing partitions:

 rm 1
 rm 2

Add a new partition:

 mkpart primary 32.3kB 20.5GB

Quit parted:

 quit

Format new partition:

 mkfs -V -t ext3 /dev/hdd1

Don't forget to update /etc/fstab and remount the new disk!!!


Using a USB Memory Stick

To check if the stick is seen:

 dmesg
To mount it to a dir called /mnt/memstick
 mount /dev/sda1 /mnt/memstick -t vfat


Installing Java plugin in Firefox

Install Java Search for Java SO file:

 find /usr -name libjavaplugin_oji.so

In ~/.mozilla/plugins create a link to the relevant libjavaplugin_oji.so that has been found (depending on Java version installed and what version you want)

 ln -s /usr/lib/j2se/1.4/jre/plugin/i386/mozilla/libjavaplugin_oji.so


Samba

To connect to a smb share:

 smbclient //hostname/sharename -U username


Burning CDs

Burning from an ISO image:

 cdrecord -v -pad speed=1 dev=/dev/hdc src.iso


Setting up Soundcard

 su
 alsaconf
to detect and setup soundcards
 alsamixer
to set default sound levels
 alsactl store
to save settings


Changing Network Settings

(As Root)

Wireless

Sniff Networks

 iwlist ath0 scanning

Capture Packets

 wireshark

Monitor AP

 wlanconfig ath0 destroy
 wlanconfig ath0 create wlandev wifi0 wlanmode monitor
 ifconfig ath0 up
 iwconfig ath0 channel 1
 wireshark

Scan local network

 nmap -v 192.168.1.*
or
 nmap -v 192.168.0.*
or
 nmap -v 192.168.*.*

Spoof MAC address

 ifconfig ath0 down
 ifconfig ath0 hw ether 11:11:11:11:11:ab
 ifconfig ath0 up

Add ESSID

 iwconfig ath0 essid "bestcoffee"

or connect to any hidden ESSID

 iwconfig ath0 essid any

Get IP

 dhclient ath0

DHCP to Static

Edit /etc/network/interfaces

Replace:

 auto eth0
 iface eth0 inet dhcp

With:

 auto eth0
 iface eth0 inet static
  address 192.168.0.10
  netmask 255.255.255.0
  broadcast 192.168.0.255
  gateway 192.168.0.254

(Obviously use your own addresses!)

Take the interface down with:

 ifdown eth0

Bring the interface back up with:

 ifup eth0

Or to force all auto interfaces to be reconfigured just:

 ifup -a --force

Check with:

 ifconfig -a

Networking Stats

Show routing table and don't resolve IP names

 netstat -rn

Show nodes on network

 ping -b [broadcast address] (get from ifconfig -a)

Get details of any wireless networks

 iwlist eth1 scanning

Configuring for WEP

 iwconfig eth1 essid {essidvalue}
 iwconfig eth1 s:key #Text WEP key or remove the s:if you know in hex; if you don't have one, remove this line
 dhclient eth1


VMWare on Debian Etch

When you install VMWare on Debian you get:

 "None of the pre-built vmmon modules for VMware Server is suitable for your running kernel."

This is not a problem as it will build the module for you if you've got a few things it needs. First you will need the kernel header files for your kernel:

 uname -a
 Linux linuxpc 2.6.16-2-686 #1 Sat Jul 15 21:59:21 UTC 2006 i686 GNU/Linux?

For me mine is: 2.6.16-2-686 So:

 apt-get install linux-image-2.6.16-2-686
 apt-get install linux-headers-2.6.16-2-686

This installed them in /usr/src/linux-headers-2.6.16-2-686, so to keep it simple I made a symlink in /usr/src:

 ln -s linux-headers-2.6.16-2-686 linux

I then got:

 Using compiler "/usr/bin/gcc". Use environment variable CC to override.

 Your kernel was built with "version 4.0.4", while you are trying to use "/usr/bin/gcc" version "4.1.2". This 
 configuration is not recommended and VMware Server may crash if you'll continue. Please try to use exactly same 
 compiler as one used for building your kernel. Do you want to go with compiler "/usr/bin/gcc" version "4.1.2" anyway? [no]

Sure enough I couldn't get any further, so I downgraded my compiler version, I've generally found it best to compile any progs with the same version as was used to compile the Kernel, I don't know why Etch is shipping with a later version of GCC that was used to compile the kernel?

 apt-get remove gcc
 apt-get install gcc-4.0
 apt-get install gcc-4.0-locales
 apt-get install libc6-dev-amd64 lib64gcc1 libmudflap0-dev
 cd /usr/bin
 ln -s gcc-4.0 gcc

So now if you have a go again at installing VMWare you should be successful, I was!

NB: If you upgrade your kernel you'll have to repeat all of the above again before VMWARE will run again!

NBB: After upgrading to Kernel 2.6.17 VMWARE wouldn't run, even after recompiling, after a bit of research I found I had to do the following (in BASH):

 LD_PRELOAD=/usr/lib/libdbus-1.so.3; export LD_PRELOAD; vmware;

to get VMWARE running again!


XML::RSS and Expat

While trying to get this installed on a Debian Sarge box it had a prerequisite of XML::Parser which refused to install in "cpan" with the error of:

 Expat.xs:12:19: expat.h: No such file or directory

I tried an apt-get install libexpat1-dev which resolved the problem.

Or download expat from http://sourceforge.net/projects/expat/ and install in the normal way.


IPOD on Linux

I've got a Generation 4 IPOD and am using GNUPod to put songs on etc. On Debian Sarge: Linux 2.4.27-3-k7 #1 i686 GNU/Linux?

Here's how, (need to be root):

Use dmesg to check where IPOD is located, sda2 in my case:

 dmesg

 Initializing USB Mass Storage driver...
 usb.c: registered new driver usb-storage
 scsi1 : SCSI emulation for USB Mass Storage devices
 usb-uhci.c: interrupt, status 3, frame# 10
  Vendor: Apple     Model: iPod              Rev: 1.62
  Type:   Direct-Access                      ANSI SCSI revision: 02
 WARNING: USB Mass Storage data integrity not assured
 USB Mass Storage device found at 2
 USB Mass Storage support registered.
 Attached scsi removable disk sda at scsi1, channel 0, id 0, lun 0
 SCSI device sda: 78126048 512-byte hdwr sectors (40001 MB)             <=================

Also, a fdisk will confirm partitions available:

 fdisk /dev/sda
 p - for list partitions:

 Disk /dev/sda: 40.0 GB, 40000536576 bytes
 255 heads, 63 sectors/track, 4863 cylinders
 Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
 /dev/sda1               1           5       40131    0  Empty
 /dev/sda2               6        4863    39021885    b  W95 FAT32       <=================

Edit /etc/fstab to include line for the usb:

 /dev/sda2        /media/usb    auto    rw,user,auto  0       0

 mount /media/usb                          - Mount the IPOD
 modprobe sbp2                             - Can't remember what this does
 gnupod_INIT -m /media/usb                 - Only neeeded fo first time use of IPOD by GNUPod
 gnupod_addsong -m /media/usb *.mp3        - Copy the songs to the IPOD
 mktunes -m /media/usb --ipod-name=ipod    - Convert GNUPodTunes? DB to iTunes DB
 eject /media/usb                          - Unmount it!


CPAN on Ubuntu

While trying to install various Perl modules I was getting errors like:

 "/usr/lib/perl/5.8/CORE/perl.h:420:24: error: sys/types.h: No such file or directory"

and a load more complaints of missing ".h" files

This is because Ubuntu isn't shipped as Linux for "Developers" but more for end users and so it isn't preinstalled with all sorts of development header files needed for compiling your own or others programs.

So, as root, I ran:

 apt-get install libexpat1-dev

And that solved the problems.


X Org setting in Debian

As Root run:

 dpkg-reconfigure xserver-xorg

It usually fixes things


ogg to mp3

Convert spaces in filenames to underscores:

 for x in * ; do mv "$x" `echo -n $x | tr " " "_"`; done

Now do the conversion:

All ogg files in a dir:

 for f in *.ogg; do oggdec -o - "$f"|lame -h -V 2 --vbr-new - "${f%.ogg}.mp3"; done

One file:

 oggdec -o - xyz.ogg |lame -h -V 2 --vbr-new - "xyz.mp3"

flv to mp4

One file:

 ffmpeg -i xyz.flv -ar 22050 xyz.mp4

All flv files in a dir:

 for f in *.flv; do ffmpeg -i "$f" -ar "${f%.flv}.mp4"; done

Info commands

USB Info

 lsusb -v

Memory Info

 dmidecode –type memory

or

 top

or

 cat /proc/meminfo

or

 free -l

CPU Info

 cat /proc/cpuinfo

Install sysstat for: sar, iostat and mpstat

 iostat 5

    where 5 is the no of secs between polls 

 mpstat

    Processor stats 

 netstat

    Stats on n/w interfaces 

List mount partitions with size data:

 df -k (-k seizes in kb)

Calculate disk usage for a specific folder:

 du -ks (-k kb, -s total in subdir only, otherwise lists every dir)

Devices

 dmesg

Modules

 modprobe -l

Errors

 tail /var/log/messages

List Hardware

 lshw
 lshw -C network

HomePage | RecentChanges | Preferences
This page is read-only | View other revisions
Last edited 2010-9-22 10:42 am by Jhipkiss (diff)
Search: