Howto Ubuntu
Notes for after a fresh ubuntu install:
Notes about installing and setup of various apps and features in Ubuntu
General configuration
- Ubuntu setup
- Users and permissions in Linux / Ubuntu
- My config for a fresh Ubuntu
Web server and clients
Communications
- SSH
- simpleproxy - Simple TCP proxy for linux
- iptables - managing the firewall
Development
- SVN - Subversion
- Grep - grep and egrep usage tips
- SDCC
- Octave (MatLab alternative)
- GNU Make - make using all cores and other notes
- Trac
Editors
- Emacs - some of my favoritre customizations
- SciTe / Scintilla - the lightweight programmers editor
- OpenOffice
- Latex support
Virtual environments
- VirtualBox - run other OS-es in parallel
- Wine - run windows apps within linux
Audio and Video
- XMMS setup for Ubuntu 8.04 and up - from source (depreciated)
- XMMS setup for Ubuntu Hardy - from deb.
Other nice external links and howto-s
Resize PDF to smaller
Using convert, will convert to image and then to pdf, but you can fiddle withthe resolution. Can also trim the whitespace.
convert -density 150 -trim in.pdf -quality 100 out.pdf
Using GS, will preserve PDF text structures, but resample images:
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=small.pdf big.pdf
Can use other -dPDFSETTINGS, for example /printer, /screen,...
Edit or remove old Places-bookmarks like this:
gedit ~/.gtk-bookmarks
Also, the volume icons on the desktop are removeable. Run gconf-editor and uncheck /apps/nautilus/desktop volumes_visible as needed.
Mount a remote volume over ssh (using sshfs)
sudo apt-get install sshfs sudo adduser your-username fuse (logout and login after this) sudo mkdir /media/dir-name sudo chown your-username /media/dir-name sshfs example.com:/stuff /media/dir-name
Mount an iso image as a CDROM
sudo mount -t iso9660 -o loop 'path/to/my.iso' /cdrom
Make an iso image from a CD
cat /dev/scd0 > mycd.iso
Mass search and replace in files (with sed)
for i in $(find . -type f); do sed 's/oldstring/newstring/g' $i > $i-tmp; mv $i $i-backup; mv $i-tmp $i; done
Mass file rename
Replace spaces with underscores in all file names of the directory. then rename *.JPG to *.jpg
rename 's/ /_/g' * rename 's/.JPG/.jpg/g' *
It is recommended that you use the -n switch for testing before the real action. See man rename.
DV/Firewire for Ubuntu
https://help.ubuntu.com/community/Firewire
Acroread on Ubuntu
The link.
Check the ports and apps listening on them
netstat -lnptu
Listing members of a group
I.e., the opposite to the command 'groups myuser'
sudo apt-get install members [if needed] members groupname
Custom autocomplete in Ubuntu
It is nice to use TAB key to autocomlete path for example, for a ls command in bash.
It turns out, you can also autocomplete certain command arguments, e.g. apt-get inst<TAB>
expands to apt-get install.
Even better, you can define your own completion rules for other commands and applications.
Read more on "howto" here: part 1 and part 2
Create your own apt-get repositories
The link.
A short example:
Get the tools
sudo aptitude install dpkg-dev
Create the repository structure. You can use any other location accessible from the web.
cd ~/public_html mkdir my-repository cd my-repository mkdir binary mkdir source
Copy your deb packages to your repository
cp src/bzr_0.11-1.1_all.deb public_html/my-repository/binary/
Create a repository index
cd my-repository dpkg-scanpackages binary /dev/null | gzip -9c > binary/Packages.gz dpkg-scansources source /dev/null | gzip -9c > source/Sources.gz
Using the repository. Add these two lines into the /etc/apt/sources.list
deb http://example.com/~myuser/my-repository binary/ deb-src http://example.com/~myuser/my-repository source/
Optionally, add the security key. Read about it elsewhere...
Kill-ing a process for sure
The link.
In short, ways to kill in the order of fierceness:
ps aux | grep gaim kill 1234 pkill gaim sudo kill 1234 kill -1 1234 kill -2 1234 kill -9 1234 killall gaim killall -9 gaim
How to merge PDF documents
Nice writeup was found here. You need to install pdftk, unless you have it already. Then use it like this to merge files 1,2 and 3 to a file merged.pdf.
sudo apt-get install pdftk pdftk 1.pdf 2.pdf 3.pdf cat output merged.pdf
Howto make deb packages
- http://tldp.org/HOWTO/html_single/Debian-Binary-Package-Building-HOWTO/
- http://www.debian.org/doc/maint-guide/
How to restore Ubuntu Gnome panel
Say your kid deleted the menu panel. This restores default:
gconftool-2 --shutdown rm -rf ~/.gconf/apps/panel pkill gnome-panel
List all installed packages
dpkg --get-selections
More info at this link.
Virtual CD from iso
mkdir cdiso sudo mount cd.iso cdiso -o loop
Now cdiso is your virtual cd with the cd.iso image in it.
CUPS 400 Bad Request problem
Fix this by adding ServerAlias * in /etc/cupsd/cupsd.conf . For example:
# Administrator user group... SystemGroup sys root users # Only listen for connections from the local machine. Listen 631 Listen /var/run/cups/cups.sock # Show shared printers on the local network. Browsing On BrowseOrder allow,deny BrowseAllow @LOCAL BrowseAllow All # Default authentication type, when authentication is required... DefaultAuthType Basic DefaultEncryption Never ServerAlias * <-------------------------------------------- ...
Mplayer normalize sound for AC3
Use "-a52drc 1" codec switch to make the loud quieter and the quet louder, look up manpages for the details.
mplayer -a52drc 1 mymovie.mkv
Create a bootable USB disk with Free-DOS in Ubuntu
Get qemu
sudo apt-get install qemu
Partition the USB disk with a single fat16 partition. Maybe fat32 works too.
Get a DOS image. Suppose you found a dos622.iso image, then boot from it with the USB disk at /dev/sdb like this:
qemu -cdrom dos622.iso -boot d -hda /dev/sdb
Then format from qemu-booted-dos the drive C: that is really your USB drive (be careful not to wipe the real hard drive!)
a:> format /s c:
Then exit qemu and test if you can boot from the new USB drive:
qemu -hda /dev/sdb
The idea came from this blog and qemu wiki.
Upgrade bios in Ubuntu
Now, this could be dangerous. Use if you understand and at your own risk. Conceptual info only, not up to date.
Source: http://ubuntuforums.org/showthread.php?t=318789
In essence:
wget http://www.fdos.org/bootdisks/autogen/FDOEM.144.gz gunzip FDOEM.144.gz mkdir /tmp/floppy sudo mount -t vfat -o loop,quiet,umask=000 FDOEM.144 /tmp/floppy unzip my-newBIOS.zip -d /tmp/floppy sudo umount /tmp/floppy rmdir /tmp/floppy sudo mv FDOEM.144 /boot/biosupdate.img sudo apt-get install syslinux sudo cp /usr/lib/syslinux/memdisk /boot/
sudo vim /boot/grub/menu.lst
title BIOS upgrade kernel /boot/memdisk initrd /boot/biosupdate.img
SSD tweaks in Linux
See here
Disable Bluetooth on startup
Put this in "/etc/rc.local" before "exit 0"
rfkill block bluetooth
Get Gnome old desktop on Ubuntu 11.10
You can select Gnome as your desktop environment in the login screen after you do:
sudo apt-get install gnome-panel
Ubuntu wakeup problems after suspend or hibernate
This might be useful:
- From thecodecentral
HDMI troubleshooting
Enable HDMI sound (Ubuntu 11.04) by selecting speaker icon on the top panel -> Sound Preferences -> Hardware -> Profiles -> HDMI output.
Check alsamixer or gnome-alsamixer that SPDIF devices are not muted.
Still no HDMI sound? Find HDMI device(s):
aplay -l
For my Asus i5 with Intel CougarPoint HDMI I get:
**** List of PLAYBACK Hardware Devices **** card 0: PCH [HDA Intel PCH], device 0: ALC892 Analog [ALC892 Analog] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: PCH [HDA Intel PCH], device 1: ALC892 Digital [ALC892 Digital] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1] Subdevices: 1/1 Subdevice #0: subdevice #0
Test sound from command line (note, in my case that was the second HDMI, so I had to use device 0,7 rather than 0,3):
aplay -D plughw:0,7 /usr/share/sounds/alsa/Front_Center.wav
HDMI on mplayer
For the setup above I need to use the second HDMI port, i.e. hw:0.7. This is how you play with mplayer on this port:
mplayer -ao alsa:device=hw=0.7 myvideo.avi
Note, you may need to use the mplayer controls (keys 9 and 0) to decrease or increase the volume. Here are some more mplayer keyboard shortcuts
Remap keyboard keys
I often use the Delete key, therefore on Mac laptop I remapped it to what would be the Right-Control key. To do the same on T61 Lenovo laptop in Ubuntu do the following:
xmodmap -e "keycode 105 = Delete"
If you want to remap other keys, use xev utility to capture the key codes and names that you can later use with xmodmap. Then place the commands in .xsessionrc to make them run on login.