Commands
Here I list useful commands and snippets of code.
Linux
Iptables NAT IRC DCC helper module.
# modprobe ip_nat_irc
To force USB to version 1.1 transfer mode.
# rmmod ehci_hcd
To list PCI devices.
$ lspci -k -v
To list USB devices.
$ lsusb -k -v
-k Show kernel drivers handling each device and also kernel modules capable of handling it.
-v Be verbose and display detailed information about all devices.
ffmpeg how to
Ffmpeg can convert many movie formats including .flv
to see what formats ffmpeg will support, use this command.
ffmpeg -formats
For example to convert a flv to a avi.
ffmpeg -i <FILE>.flv <FILE>.avi
You may want other options for quality etc. see the man page fore more details.
man ffmpeg
How to extract a chapter off a DVD.
$ mencoder -chapter <CHAPTER>-<END_CHAPTER> dvd://<TITLE> -ovc copy -oac copy -o <FILE>.avi
How to pause and resume a program.
$ killall -STOP <PROGRAM>
To resume you type this.
$ killall -CONT <PROGRAM>
How to cut a file to last number of lines.
Note do not use the same file for input and output. The shell creates and truncates the outfile, so if you try you will have a empty infile.
$ tail -n<NUMBER_OF_LINES> <IN_FILE> > <OUT_FILE>
Test 5.1 surround sound.
Using alsa utils.
$ speaker-test -t sine -f 440 -c 6 -D surround51
LVM
How to move a missing VG
You accidentally removed a lead to a single PV VG?
/dev/VolGroup01/LogVol00: read failed after 0 of 4096 at 79993700352: Input/output err
No problem you can remove the dead table from dmsetup with:
# dmsetup remove /dev/mapper/<volume>
How to move PEs on the same PV
You must add in --alloc anywhere to be able to do this
Say you have a gap in the PV at 1000-1200 and you want to remove the last 99 PEs off the bottom of the PV at 5100 on /dev/sda2.
# pvmove --alloc anywhere /dev/sda2:5001-5100 /dev/sda2:1000-1099
List PE ranges with.
# lvs -o lv_name,seg_pe_ranges
Accidentally created a LV and can't remove it?
# lvremove "/dev/<VG>/<LV>"
Can't remove open logical volume "<LV>"
You can deactivate it with:
# lvchange -an <VG>/<LV>
Making sure it's unmounted first.
How to remove a clustered volume group
# vgremove <VG>
Skipping clustered volume group <VG>
I set that vg to clustered mode but I cant seem to change it back to a none clustered setting.
You can override the locking mode used either in the config file or on the command line with:
# vgremove --config="global {locking_type=0}" <VG>
But do remember that this turns off all locking - you must be very careful to only run one command at a time on only one node at a time.
Ubuntu
How to fix running X11 as a normal user.
If you get this output:
$ startx
X: user not authorized to run the X server, aborting.
Then run this command
sudo dpkg-reconfigure x11-common
Why this is so is beyound me, Digital8 exapins it as:
Reconfiguring x11-common allows for 3 options, apparently ubuntu opts for the more secure of the 3.
An additional note I found is -audit level and man 7 Xsecurity
How to remove pulseaudio.
$ pkill pulseaudio
$ sudo apt-get remove pulseaudio
And for Ubuntu 8.10
sudo rm /etc/X11/Xsession.d/70pulseaudio
How to disable or enable Compiz in Ubuntu.
The system> prefs> apperance> visual effects> set to none
Comamnd line way to disable Compiz.
$ /usr/bin/metacity --replace &
Comamnd line way to enable Compiz.
$ /usr/bin/compiz --replace &
Windows Vista
How to fix folder bug to open in same window again.
command prompt, run as admin
C:\> regsvr32.exe /s actxprxy.dll
Installing IE8 seems to cause this issue.
Wine
How to check OpenGL for version and direct acceleration status.
$ glxinfo | egrep '(direct|OpenGL version)'
How to use a virtualdesktop in wine on the command line.
$ wine explorer /desktop=x,1024x768 winefile
How to make Wine log to a file.
$ wine program_to_run.exe &> /tmp/wine_log
How to cut a Wine log file to 1,000 lines.
Note do not use the same file for input and output unless you want to lose your log file data.
$ tail -n1000 /tmp/wine_log > /tmp/wine2_log
How to install files like MSVCR80.dll.
$ wget http://www.kegel.com/wine/winetricks
$ sh winetricks vcrun2005
How to reset the screen resolution after a full screen program messes it up.
$ xrandr -s 0
How to eject a disc in Wine.
$ wine eject
How to configure Wine.
To comfigure Wine settings.
$ winecfg
As in Windows you use regedit to edit the registery.
$ regedit
How to add/remove programs.
$ wine uninstaller.exe
You can install a program by also running.
$ wine <PROGRAM.EXE>