Quickly Add/Remove Multiple packages with apt-get (command line hackery)
This is a simply yet effective way I personally add/remove packages in ubuntu when I change distro's and need to reinstall everything other than aptoncd which I have an article for, my site search will bring it up searching for "aptoncd". Basically the idea is to add all your favorite packages to a text file and install them all with a simple command as well as removing them:
simply make a text file with packages you like after you add the right repositories, I simply:echo "deb repository.com repo/">>/etc/apt/sources.list
to add repositories via the terminal
Now make a list like this:
pidgin
opera
firefox
and-any-package you need, save it in a safe location named aptfiles.txt
Now to simply restore/install your list do:
cat aptfiles.txt | xargs sudo apt-get -y install
Now you can also make a list to remove files you dont need named apt-remove.txt
Do the same:
cat apt-remove.txt | xargs sudo apt-get -y remove
I hope you enjoy this simple apt-get trick as much as I do, feel free to add any tips/tricks of your own in the comments.
d e f c o n
Howto Search And Replace Text in files Recursively on Ubuntu Linux

I just found a new tool called regexxer, im sure it has been around for a while but I just discovered it.
regexxer is a nifty GUI search/replace tool featuring Perl-style regular expressions. If you need project-wide substitution and you’re tired of hacking sed command lines together, then you should definitely give it a try.
simply apt-get install regexxer
Remaster And Clone your Ubuntu Install to a live cd
Remastersys will 'remaster' your existing Ubuntu based distro into a live cd/DVD. Tools like PCLinuxOS's mklivecd have been around a while and proved to be very popular but are tricky to get working with the newer releases of debian/ubuntu, so some guy (apologies, forgot your name) over at Linux Mint (an ubuntu-based distribution) made this really cool tool. And although it has only really been in popular use since about March this year, it has already been compared to the maturity of mklivecd.
Install:
Add the Linux Mint repo to your /etc/apt/sources.list
echo "deb http://www.linuxmint.com/repository romeo/" >>/etc/apt/sources.list
do a "sudo apt-get update"
then:
"sudo apt-get install remastersys" and it should install fine.
Then simply type "sudo remastersys" to get the list of options, which include:
backup - backs up your system including your /home folder with your users on it.
dist - omits the /home folder thus making it a distributable cd that you can give to your friends.
clean - removes the temporary folder that was created, including the new iso so burn it and copy it elsewhere before you run "sudo remastersys clean"
Ubuntu Gutsy Beta Release & Download Site
Well the long awaited Ubuntu Gutsy Gibbon Beta is released with a TON of bug fixes,
Check it out and please post the bug fixes on launchpad!
Ubuntu Gutsy Gibbon Download Sites
Download
Get it while it's hot. ISOs and torrents are available at:
-
http://releases.ubuntu.com/releases/7.10 (Ubuntu)
http://releases.ubuntu.com/releases/kubuntu/7.10 (Kubuntu)
http://releases.ubuntu.com/releases/edubuntu/7.10 (Edubuntu)
http://cdimage.ubuntu.com/xubuntu/releases/7.10/beta (Xubuntu)
Local mirrors are also available:
Europe
-
http://se.releases.ubuntu.com/7.10 (Sweden)
-
http://nl.releases.ubuntu.com/7.10 (The Netherlands)
-
http://ftp.snt.utwente.nl/pub/linux/ubuntu-releases/7.10 (The Netherlands)
-
http://ie.releases.ubuntu.com/7.10 (Ireland)
-
http://gb.releases.ubuntu.com/7.10 (Great Britain)
-
http://de.releases.ubuntu.com/7.10 (Germany)
-
http://fr.releases.ubuntu.com/7.10 (France)
Asia/Pacific
-
http://tw.releases.ubuntu.com/7.10 (Taiwan)
Africa
-
http://za.releases.ubuntu.com/7.10 (South Africa)
North America
-
http://ca.releases.ubuntu.com/7.10 (Canada)
-
http://us.releases.ubuntu.com/7.10 (United States)
please post bugs here
be sure to check for updates hourly...
-defcon
Howto Easily Upgrade Dell BIOS in Ubuntu
You should always upgrade your bios like you do software because it provides underlying support for your hardware, this is a quick & easy howto to guide you through the process...
The Dell firmware-tools project provides easy method of BIOS and firmware update.
Packages for firmware-tools and firmware-addon-dell for Debian and Ubuntu are under construction. Here is the main firmware-tools page: BIOS and Firmware Updates
BIOS Update Process for Debian/Ubuntu:
Install libsmbios
# apt-get update (not always necessary)
# apt-get install libsmbios-bin
Get the System ID
# getSystemId
Libsmbios: 0.12.1
System ID: 0x019D
Service Tag: J5TJV71
Express Service Code: 41710831021
Product Name: Dimension 3000
BIOS Version: A03
Vendor: Dell Computer Corporation
Is Dell: 1
Download the latest BIOS ".HDR" file for this system.
Go here: http://linux.dell.com/repo/software/bios-hdrs/
The directory will be named: system_bios_ven_0x1028_dev_SYSTEM_ID_version_BIOS_VERSION. Go into this directory and download the file, "bios.hdr".
ctrl-f and search for your system id, mine is 0x019D; and grab the latest version
load the dell_rbu driver
# modprobe dell_rbu
Update the bios
# dellBiosUpdate -u -f ./bios.hdr-2.3.2
Supported RBU type for this system: (MONOLITHIC)
Using RBU v2 driver. Initializing Driver.
Setting RBU type in v2 driver to: MONOLITHIC
Prep driver for data load.
Writing RBU data (4096bytes/dot): ............................
..............................................................
.......................
Notify driver data is finished.
Activate CMOS bit to notify BIOS that update is ready on next boot.
Update staged sucessfully. BIOS update will occur on next reboot.
Reboot the system
save your work and type:
sudo reboot
Once you boot up, your system will auto-clear your bios and update the bios
Next Generation Optimization for Ubuntu!
Well, prefetching isnt a new topic but there is possibility that it can be optimized into the next generation of computing...
I found an interesting Google SoC Project page that shows some promise, ive been searching around for prefetching and ReadyBoost solutions for Ubuntu and ran accross this...
From here:
In todays computer systems the main bottleneck is not CPU but disk access which is several orders of magnitude slower than CPU and memory. In such circumstances the way to improve application performance is to prefetch data it needs from disk before it even requests it and it is the point of prefetching techniques.
The example of prefetching solution is Windows prefetcher.
Here is a little bit from their thesis:
"In this thesis we develop preload, a daemon that prefetches binaries and shared libraries
from the hard disk to main memory on desktop computer systems, to achieve faster
application start-up times. Preload is adaptive: it monitors applications that the user
runs, and by analyzing this data, predicts what applications she might run in the near
future, and fetches those binaries and their dependencies into memory.
We build a Markov-based probabilistic model capturing the correlation between every
two applications on the system. The model is then used to infer the probability that each
application may be started in the near future. These probabilities are used to choose
files to prefetch into the main memory. Special care is taken to not degrade system
performance and only prefetch when enough resources are available.
Preload is implemented as a user-space application running on Linux 2.6 systems."
Howto test optimizations:
*Warning* This is experimental and I have not tested this yet, I am about to once im done posting this, This may or may not be correct, let me know of any issues!
The following is an edited version of there wiki located here
Testing Boot Prefetching and Applications Prefetching
Introduction
First testing version of kernel with automatic boot prefetching and tracing is available. This version is precompiled for Debian-based systems (tested on Ubuntu Gutsy, other distributions might not work). The kernel is standard Ubuntu kernel with these prefetch patches.
Standard disclaimer applies: this is experimental version, it might damage your system use at your own risk and only on systems where you have backups.
*This Requires Ubuntu Gutsy*
Installation
In order to use kernel with prefetching:
Download kernel linux-image deb
Download linux-headers.deb
Install linux-image deb package
Install linux-headers deb package
Remove readahead package using: sudo apt-get remove --purge readahead -
please note that this will cause removing (x/k/edu)ubuntu-desktop package.
Download userspace prefetch support deb and install it using:
dpkg -i prefetch*.deb
Now reboot and select "kernel 2.6.22.6pf.3" during boot.
Uninstallation
In order to remove kernel with prefetching:
Reboot into standard (non-prefetching) kernel.
Remove prefetch userspace support files using apt-get remove --purge prefetch
Install readahead and (x/k/edu)ubuntu-desktop package.
Remove linux-image package with prefetching support (with "pf" in name).
Resources:
Launchpad Project
Summer Of Code 2007 Progress
Development Discussions
Google Code Page
Ubuntu ReadyBoost for Desktops and Laptops!
With these simple directions you'll be able to use a USB pen prive as an additional swap. As a result, the pen drive will be used in the same way Windows Vista does through the ReadyBoost functionality.
1) Plug the pen drive in your usb slot, usually in front of your tower or side/back of your laptop.
2) Ubuntu should auto-mount the device (usually in /media/usbdisk*), umount the device (ie., sudo umount /media/usbdisk);
3) Find your usb device in your terminal by typing sudo df -h; in this example we will use /dev/sda1
4) sudo mkswap /dev/sda1 (assuming /dev/sda1 is the correct device for the connected usb device)
5) sudo swapon -p 32767 /dev/sda1
Ok now you are using the usb device for swap; when your ram is exhausted it will start using your usb device for ram
To verify that everything is working correctly do a;
cat /proc/swaps
This is the output I recieve on my Desktop;
/dev/sda5 partition 1646620 33952 -1
Just a note:
You will not recieve the same performance as ram, it all depends on the speed of your usb disk, you will notice a big difference in running games, development studio's, audio/video editing and memory hogs like firefox/openoffice.
To turn ReadyBoost for Ubuntu off in a terminal type:
sudo swapoff /dev/sda1
OpenOffice.org OpenXML Translator for Ubuntu
The OpenXML Translator provides support for opening and saving Microsoft* OpenXML-formatted word processing documents (.docx) in OpenOffice.org. So now we all can use the docx extention *yay* although im not very happy about this, id rather have hundreds of companies use *.odf and do away with this addon all together but... This is hot for those that like to use Microsh!t document formats...
Install:
1. echo "deb http://ubuntu.org.ua/ getdeb/" >>/etc/apt/sources.list
2. apt-get update
3. apt-get install odf-converter
or simply download here
Note:You must restart OpenOffice Writer to get the option available on the Load/Save document dialogs.
If you need support for windows or SUSE® Linux Enterprise, SUSE Linux, and openSUSE check out the developer's download site here
Introducing ioSunbird Apple iCal for Ubuntu!

My friend Luca Cappelletti is kicking ass rolling out yet another fine release for mobile or non-root users or people that just want to download a program and start running it without wasting time installing a thing.
ioMozilla Sunbird® is a cross-platform calendar application, built upon Mozilla Toolkit. Our goal is to bring Mozilla-style ease-of-use to your calendar, without tying you to a particular storage solution.
pic by markcarson.com
Luca has told me he has modified Sunbird to have the ease of use and look of Apple iCal, stay tuned for screenshots from me! Or beat me to it and post em :)
Easy install:
Simply grab ioSunbird here
chmod +x ioCalendarSunbird0.5-feisty_InfodomesticObjects0.8.6
or simply right click on the file to change properties to executable.
mv oCalendarSunbird0.5-feisty_InfodomesticObjects0.8.6 ioCalendarSunbird
or right click rename :)
Then double click or ./ioCalendarSunbird
Introducing ioGftp 2.0.18-feisty

Check this out, same great Gftp client but without the headache of installing, this is another InfomesticObjects Linux Release.
Benefits:
Easily access ftp sites on the go or run gftp without installing at a computer with no root privileges.
Here is Gftp's Main Features:
First grab ioGftp here
chmod +x ioGftp2.0.18-feisty_InfodomesticObjects0.8.7
or right click change permissions to executable
mv ioGftp2.0.18-feisty_InfodomesticObjects0.8.7 ioGftp
./ioGftp
or simply double click to run
thats it enjoy :)
Introducing ioOpera 9.2.3

ioOpera9.23 is a recompilation of Opera for Infodomestic Objects Linux. It is developed and tested under Ubuntu Linux, and can be run with just one click without installation on your system."
Benefits:
Faster than Opera
Same as Opera
None-root Users can download and run Opera
Secure
Something new
Same benefits of Opera just no install needed
ioOpera is secure as well, since it runs in ram, so you dont have to worrie about people sn00ping your browser history. Apon reboot all history is gone.
Howto:
Download here
chmod +x ioOpera9.23_InfodomesticObjects0.8.7
mv ioOpera9.23_InfodomesticObjects0.8.7 ioOpera
./ioOpera
or simply double click to run :)
Introducing ioPidgin 2.2

ioPidgin is the same great application for non-root users or people that dont like to install all the libraries and compile from scratch. You dont have to apt-get a thing. This one simple file is all you need and dont worrie about installing since it is already installed in the file :)
"ioPidgin is a recompilation of Pidgin 2.2 for Infodomestic Objects Linux. It is developed and tested under Ubuntu Linux, and can be run with just one click without installation on your system."
ioPidgin is secure as well, since it runs in ram.
Howto:
Download here
chmod +x ioPidgin2.2-feisty_InfodomesticObjects0.8.7
mv ioPidgin2.2-feisty_InfodomesticObjects0.8.7 ioPidgin
./ioPidgin
or double click on the executable :)
check out my screenshot
Introducing ioAmarok 1.47

Wow, I just found another truly unique application that runs fast as hell right from memory and does not require root access to install, so you non-root users can download this single file and you dont have to install a thing, it runs straight from ram and /tmp and believe it or not, it is faster than amarok because it is all pre-linked. No compiling, installing or anything is necessary.
This is for mobile users that use flash drives as well...
"Does not require KDElibs nor
QTlibs nor any mp3/4 adaptor."!
"ioAmarok is a recompilation of Amarok 1.47 for Infodomestic Objects Linux. It is developed and tested under Ubuntu Linux, and can be run with just one click without installation on your system."
ioAmarok is secure as well, since it runs in ram.
Howto:
Download here
chmod +x ioAmarok1.4.7-feisty_InfodomesticObjects0.8.7
mv ioAmarok1.4.7-feisty_InfodomesticObjects0.8.7 ioAmarok
./ioAmarok
Recover Forgotten Ubuntu Password without reinstalling
If you forgot you password for your ubuntu system you can recover using the following steps
Turn your computer on.
Press ESC at the grub prompt.
Press e for edit.
Highlight the line that begins kernel ………, press e
Go to the very end of the line, add rw init=/bin/bash
press enter, then press b to boot your system.
Your system will boot up to a passwordless root shell.
Type in passwd username
Set your password.
Type in reboot
If this doesnt work you can alternatively try this:
Turn on your computer, and as soon as you the Press Esc to enter grub message, press the escape key.
Select the option that says (recovery mode).
Your PC will boot into a shell. Once you get a command prompt, type "passwd username" where the username is your username.
Enter a new password when prompted, and again when prompted again
Type reboot to reboot your system
Another way is to boot into the system via a live cd open up Applications->Accessories->Terminal
then mount your ubuntu drive if its on /dev/sda1 do this:
mount /dev/sda1/ /media/sda1
Then we chroot into the system:chroot /media/sda1passwd user
Now change the password, and reboot your box!
Upgrade to the Latest Kernel.org Kernel with 1 click in Ubuntu
Now, a short description. KernelCheck is a project that is designed to easily build the latest kernel for your distribution using the instructions provided in the Master Kernel Thread. This automated process is a fork of AutoKernel by Robert Wolterman (xtacocorex), Timothy Janssen (mentok), and Kristof Verbeken (PinguinZ). KernelCheck is currently under the GNU Public License.
Installation
Download it here (recommended)
ORwget http://kcheck.sourceforge.net/pool/latest-stable/kernelcheck-latest.tar.gz
tar -xzf kernelcheck-*.tar.gz
cd kernelcheck-*
sudo python setup.py install
kernelcheck
Notes on KernelCheck
KernelCheck can be used for several purposes:
KernelCheck can install either the latest stable kernel, or the latest stable prepatch. Usually the prepatch is less stable than the kernel, but it is still widely used.
Usage
KernelCheck can be used in a variety of ways, most commonly by opening a terminal and typing inkernelcheck

If you click yes, after a few moments one like the one below should appear:
The 'Build Latest Kernel' button will download, compile, and install the latest stable kernel from kernel.org. By selecting the checkbox 'Apply prepatch instead of normal patch', it will apply the listed prepatch (development).
The 'Check for Program Updates' button will go to the KernelCheck website and parse finger_banner2 for the latest version of KernelCheck. If you are running the latest version, it will say so, and if you are not, it will ask you to update.
You can edit the /usr/bin/kernelcheck files to your needs, changing anything you like, because my program is under the GNU Public License Version 3 released June 2007.
KernelCheck 1.0.5 has been released!
Changelog (Key features only):
The 'Check for Updates' button in KernelCheck 1.0.4 (or patched 1.0.3r1) should automatically detect this upgrade. This has been tested with version 1.0.4.
Download at SF.net, or the download page.
Post questions, comments, etc. here.
Introducing Linux Multimedia Studio For Ubuntu!

Damn!, just found a sweet application on getdeb.net, its truly chillin for you dj's out there and people that like to mess around with beats like I do. It looks like you can now create great music with Ubuntu Linux. Check it...
LMMS aims to be a free alternative to popular (but commercial and closed- source) programs like FruityLoops, Cubase and Logic giving you the ability of producing music with your computer by creating cool loops, synthesizing and mixing sounds, arranging samples, having more fun with your MIDI-keyboard and much more...
How to Install:
1. open up a terminal
2. sudo -s
3. echo "deb http://ubuntu.org.ua/ getdeb/" >> /etc/apt/sources.list
4. apt-get install lmms
5. Launch
Or if you want the latest version grab the subversion installation instructions here
Resources:
Wiki & tips/tricks
Play videos within *.rar files without unpacking/extracting them in Ubuntu
If you download your movies and tv series only as scene releases, then you'll have to extract the release's video file from its multiple rar files. That can take some time... Not a horrible long time. You can live with it... But I learned a cool thing and thought I could share it just because I have nothing better to do...
You'll need the packages "unrar" and "vlc" (or "mplayer" or any other video player you may prefer).
Write this in a terminal if you haven't got the required packages:sudo apt-get install unrar vlc
unrar p -inul /example/path/to/Some.Scene.Release/some.sr.r00 | vlc -
unrar = starts unrar
p = outputs the extraction data of the file
-inul = disables error messages
/example/path/to/Some.Scene.Release/some.sr.r00 = path to one of the scene release's rar files
| vlc - = pipes the output of the extraction into vlc that starts to play the output, and therefore plays the video file that is within the rar files. Don't forget the ending "-", or it won't work. You can use another video player if you want, just replace "vlc" with what you want. I have only tested this with vlc and mplayer.
One bad thing with this trick is that you can only pause and play the file, but not rewind or fast forward.
I only write "rarvideo somerarfile.r00". How to do that:
Open ~/.bashrc in a text edior, using for example this command:gedit ~/.bashrc
PATH=$PATH:$HOME/bin
(This makes your Bash looking in the ~/bin folder for executeable files.)
Make a folder in your home folder called "bin":mkdir ~/bin
gedit ~/bin/rarvideo
#! /bin/sh
unrar p -inul $1 | vlc -
Make the file executeable with this command:chmod u+x ~/bin/rarvideo
bash
you can also right click a rar file in nautilus and choose "open with" and type in rarvideo
Howto install the subversion mplayer + gmplayer + all the codecs.
This guide intends to show how to successfully compile a fully featured svn mplayer with all the codecs and with the GUI player gmplayer. It is a bit of a difficult one so make a cup of tea and get your keyboard ready!!
Firstly install subversion, compiling tools and checkinstall and secondly download the svn mplayer plus the full codec pack:$ sudo apt-get install build-essential checkinstall subversion
$ cd Desktop
$ svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
$ wget http://www.mplayerhq.hu/MPlayer/releases/codecs/all-20061022.tar.bz2
$ tar xjvf all-20061022.tar.bz2
$ sudo mkdir /usr/local/lib/codecs/
$ sudo cp $HOME/Desktop/all-20061022/*.* /usr/local/lib/codecs/
$ sudo apt-get install liblame-dev libdvdread3-dev libdvdnav-dev libogg-dev \
libvorbis-dev libxv-dev libtheora-dev libpng12-dev libmpcdec-dev \
libcdparanoia0-dev libxinerama-dev x11proto-xinerama-dev libjpeg62-dev \
libgdk-pixbuf-dev libfreetype6-dev libexpat1-dev libfontconfig1-dev \
libcaca-dev libfaac-dev libmp4v2-dev libaa1-dev libavcodec-dev \
libavifile-0.7-dev libsdl1.2-dev libesd0-dev libfaad2-dev libice-dev \
libmatroska-dev libmad0-dev libmp4v2-dev libmikmod2-dev libpostproc-dev \
libspeex-dev libxvidcore4-dev libxvidcore4 avifile-xvid-plugin \
avifile-divx-plugin ladspa-sdk libsvga1-dev libsvga1 libungif4-dev \
libungif4g libenca-dev libdfb++-0.9-22 libdfb++-dev libdirectfb-0.9-22 \
libdirectfb-dev libavformat-dev libfame-0.9 libfame-dev zlib1g-dev \
liblivemedia-dev libfribidi-dev libdvdnav4 libdvdplay0 libasound2-dev \
libdv4-dev libpopt-dev zlib1g-dev xlibs-dev libflac++-dev libflac-dev \
liboggflac++-dev liboggflac-dev toolame ttf-bitstream-vera \
libdbus-glib-1-dev libx264-dev libggi2-dev libxvmc-dev libxxf86vm-dev \
libxxf86dga-dev libfontconfig-dev libartsc0-dev libglu-dev \
libglu1-mesa-dev libdts-dev libdvdread-dev libdv-dev libpng3-dev \
libpng12-dev libsmbclient-dev gawk sharutils libaudiofile-dev liblzo-dev \
libc6-dev libggimisc2 libggimisc2-dev libggiwmh0 libggiwmh0-dev \
libatk1.0-dev libcairo2-dev libgtk2.0-dev libpango1.0-dev \
libxcursor-dev libxfixes-dev x11proto-fixes-dev liba52-0.7.4-dev
$ cd $HOME/Desktop/mplayer/
$ ./configure \
--prefix=/usr/local \
--enable-largefiles \
--enable-gui \
--codecsdir=/usr/local/lib/codecs
$ make && sudo checkinstall -D
$ mkdir $HOME/.mplayer/
$ sudo cp /usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf ~/.mplayer/subfont.ttf
$ cd Desktop
$ wget http://www.mplayerhq.hu/MPlayer/skins/Blue-1.7.tar.bz2
$ tar xjvf Blue-1.7.tar.bz2
$ mkdir $HOME/.mplayer/skins/default/
$ cp $HOME/Desktop/Blue/*.* $HOME/.mplayer/skins/default/
original credits for this here
How To Mount Your iPhone Filesystem On Ubuntu
Do you want to browse your iPhones’ filesystem on your Ubuntu machine? Follow these instructions and you’ll have it working in no time flat. You’re in! Now upload ringtones, compile hello world, slice dice and serve http via apache - whatever floats your boat.
This article assumes your iPhone is “out of jail” and has Installer.app installed. If you have not already gotten this part taken care of, click here for steps you need to follow first.
1. Install SSH on your phone by the following proceedure:
2. Tap the Installer on your home screen.
3. Install the following utilities:
* Community Sources
* BSD Subsystem
* OpenSSH
4. Once your iPhone has these installed, find your IP address by going into Settings, Wi-Fi and then click the blue arrow next to the network your iPhone and your Ubuntu machine are on.
5. Turn off Auto-Lock on your iPhone, which will interrupt the OpenSSH server by going into Settings, General and Auto-Lock. Set Auto-Lock to never.
6. Now, on your Ubuntu machine, simply click on Places, Connect to Server and follow these screenshots:
7.
8.
9.
10.
www.fsckin.com
Advanced lsof Usage in Ubuntu or any linux Operating system
lsof
lsof is the Linux/Unix über-tool. I use it most for getting network connection related information from a system, but that's just the beginning for this amazing and little-known application. The tool is aptly called lsof because it "lists open files". And remember, in Unix just about everything (including a network socket) is a file.
** lsof is also the Linux/Unix command with the most switches. It has so many it has to use both pluses and minuses.
usage: [-?abhlnNoOPRstUvV] [+|-c c] [+|-d s] [+D D] [+|-f[cgG]]
[-F [f]] [-g [s]] [-i [i]] [+|-L [l]] [+|-M] [-o [o]]
[-p s] [+|-r [t]] [-S [t]] [-T [t]] [-u s] [+|-w] [-x [fl]] [--] [names]
As you can see, lsof has a truly staggering number of options. You can use it to get information about devices on your system, what a given user is touching at any given point, or even what files or network connectivity a process is using. lsof replaces my need for both netstat and ps entirely. It has everthing I get from those tools and much, much more.
Show Your Network Connections
Show all connections with -i
lsof -i
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
dhcpcd 6061 root 4u IPv4 4510 UDP *:bootpc
sshd 7703 root 3u IPv6 6499 TCP *:ssh (LISTEN)
sshd 7892 root 3u IPv6 6757 TCP 10.10.1.5:ssh->192.168.1.5:49901 (ESTABLISHED)
Show only TCP (works the same for UDP)
lsof -iTCP
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
sshd 7703 root 3u IPv6 6499 TCP *:ssh (LISTEN)
sshd 7892 root 3u IPv6 6757 TCP 10.10.1.5:ssh->192.168.1.5:49901 (ESTABLISHED)
-i :port shows all networking related to a given port
lsof -i :22
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
sshd 7703 root 3u IPv6 6499 TCP *:ssh (LISTEN)
sshd 7892 root 3u IPv6 6757 TCP 10.10.1.5:ssh->192.168.1.5:49901 (ESTABLISHED)
To show connections to a specific host, use @host
lsof -i@192.168.1.5
sshd 7892 root 3u IPv6 6757 TCP 10.10.1.5:ssh->192.168.1.5:49901 (ESTABLISHED)
Show connections based on the host and the port using @host:port
lsof -i@192.168.1.5:22
sshd 7892 root 3u IPv6 6757 TCP 10.10.1.5:ssh->192.168.1.5:49901 (ESTABLISHED)
Grepping for "LISTEN" shows what ports your system is waiting for connections on
lsof -i| grep LISTEN
iTunes 400 daniel 16u IPv4 0x4575228 0t0 TCP *:daap (LISTEN)
Grepping for "ESTABLISHED" shows current active connections
lsof -i| grep ESTABLISHED
firefox-b 169 daniel 49u IPv4 0t0 TCP 1.2.3.3:1863->1.2.3.4:http (ESTABLISHED)
Working with Users, Processes, and Files
You can also get information on various users, processes, and files on your system using lsof:
Show what a given user has open using -u
lsof -u daniel
-- snipped --
Dock 155 daniel txt REG 14,2 2798436 823208 /usr/lib/libicucore.A.dylib
Dock 155 daniel txt REG 14,2 1580212 823126 /usr/lib/libobjc.A.dylib
Dock 155 daniel txt REG 14,2 2934184 823498 /usr/lib/libstdc++.6.0.4.dylib
Dock 155 daniel txt REG 14,2 132008 823505 /usr/lib/libgcc_s.1.dylib
Dock 155 daniel txt REG 14,2 212160 823214 /usr/lib/libauto.dylib
-- snipped --
See what files and network connections a command is using with -c
lsof -c syslog-ng
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
syslog-ng 7547 root cwd DIR 3,3 4096 2 /
syslog-ng 7547 root rtd DIR 3,3 4096 2 /
syslog-ng 7547 root txt REG 3,3 113524 1064970 /usr/sbin/syslog-ng
syslog-ng 7547 root mem REG 0,0 0 [heap]
syslog-ng 7547 root mem REG 3,3 105435 850412 /lib/libpthread-2.4.so
syslog-ng 7547 root mem REG 3,3 1197180 850396 /lib/libc-2.4.so
syslog-ng 7547 root mem REG 3,3 59868 850413 /lib/libresolv-2.4.so
syslog-ng 7547 root mem REG 3,3 72784 850404 /lib/libnsl-2.4.so
syslog-ng 7547 root mem REG 3,3 32040 850414 /lib/librt-2.4.so
syslog-ng 7547 root mem REG 3,3 126163 850385 /lib/ld-2.4.so
-- snipped --
Pointing to a file shows what's interacting with that file
lsof /var/log/messages
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
syslog-ng 7547 root 4w REG 3,3 217309 834024 /var/log/messages
The -p switch lets you see what a given process ID has open, which is good for learning more about unknown processes
lsof -p 10075
-- snipped --
sshd 10068 root mem REG 3,3 34808 850407 /lib/libnss_files-2.4.so
sshd 10068 root mem REG 3,3 34924 850409 /lib/libnss_nis-2.4.so
sshd 10068 root mem REG 3,3 26596 850405 /lib/libnss_compat-2.4.so
sshd 10068 root mem REG 3,3 200152 509940 /usr/lib/libssl.so.0.9.7
sshd 10068 root mem REG 3,3 46216 510014 /usr/lib/liblber-2.3
sshd 10068 root mem REG 3,3 59868 850413 /lib/libresolv-2.4.so
sshd 10068 root mem REG 3,3 1197180 850396 /lib/libc-2.4.so
sshd 10068 root mem REG 3,3 22168 850398 /lib/libcrypt-2.4.so
sshd 10068 root mem REG 3,3 72784 850404 /lib/libnsl-2.4.so
sshd 10068 root mem REG 3,3 70632 850417 /lib/libz.so.1.2.3
sshd 10068 root mem REG 3,3 9992 850416 /lib/libutil-2.4.so
-- snipped --
The -t option returns just a PID
lsof -t -c Mail
350
ps aux | grep Mail
daniel 350 0.0 1.5 405980 31452 ?? S Mon07PM 2:50.28 /Applications/Mail.app
Advanced Usage
Using-a allows you to combine search terms, so the query below says, "show me everything running as daniel connected to 1.1.1.1"
lsof -a -u daniel -i @1.1.1.1
bkdr 1893 daniel 3u IPv6 3456 TCP 10.10.1.10:1234->1.1.1.1:31337 (ESTABLISHED)
Using the -t and -c options together you can HUP processes
kill -HUP `lsof -t -c sshd`
You can also use the -t with -u to kill everything a user has open
kill -9 `lsof -t -u daniel`
lsof +L1 shows you all open files that have a link count less than 1, often indicative of a cracker trying to hide something
lsof +L1
(hopefully nothing)
Conclusion
This primer just scratches the surface of lsof's functionality. For a full reference, run man lsof or check out the online version. I hope this has been useful to you, and as always, comments and corrections are welcomed.
References
The lsof man page:
http://www.netadmintools.com/html/lsof.man.html
The original information for this is from: http://dmiessler.com/study/lsof/
Easy linux hosting on Ubuntu Feisty Fawn with Easy Hosting Control Panel
Hey I dont do my own hosting but I found out a great hosting solution for ubuntu, check it out and let me know what you think..
Easy Hosting Control Panel is designed for hosting of multiple domains on single machine.
It uses LAMP(LinuxApacheMysqlPhp).
Its aim:easily installable,easy usage, non-complex,functional.
Why use a control panel? Because hosting a domain in an ubuntu/linux system requires many settings to be done. hosting control panel makes these tasks easy, with webbased interface.
hosting means putting web pages on the internet for general use, as you do now..
ehcp is the first control panel in this field with its unique features such as: complete php based, object oriented, opensource and free. even install is using php, so it is extremely easy to learn and extensible..
There are many free hosting control panels, but none of them have these features. some have non-opensource code, some other then php, some is not object oriented..
ehcp is in beta stage. there are many things to do. but the main skeleton is built in a straight forward way.
version 0.18.1 released !
feature overview:
* php and apt-get based simple install,
* automatically installs and works: dns, apache, mysql, ftp, email, domains,
* most easy install: copy & paste in console and watch
* ready to use after install - at ubuntu
* adodb and phpmyadmin included
* object oriented programming using php,
* easily extendable/modifiable...
future plans:
* reseller implementation (soon),
* subdomain implementation(soon),
* server/services status,
* different language support.. (currently english/turkish mixed)
* plugin system using php
* auto detection of apt-get and install if not present...
Installation:
simply copy and paste followin in your root console,
wget http://www.ehcp.net/ehcp_0.18.1.tgz
tar -zxvf ehcp_0.18.1.tgz
cd ehcp
./install.sh
You may find additional information at following project sites:
home page: www.ehcp.net
http://freshmeat.net/projects/ehcp/
http://www.sourceforge.net/projects/ehcp
http://code.google.com/p/ehcp/
http://www.ubuntuforums.org/forumdisplay.php?f=180
http://www.freewebhostingtalk.com/showthread.php?t=4191
http://www.webhostingtalk.com/showth...hreadid=519724
http://forum.iyibirisi.com/viewforum.php?f=3
http://forum.iyibirisi.com/viewforum.php?f=15
ehcp hosting control panel primarily supports ubuntu, tested on ubuntu 7.04lts
but virtually work on any other linux distributions with apt-get installed as well.
currently it supports linux'es only with apt-get.
in future, i will also add a feature so that it will detect and install apt-get automatically if not present. this is not the case now.
but. the control panel will always be focused and tested on ubuntu.
Ubuntu will be the primary platform for it.
in fact this is natural because Ubuntu is so easy to maintain...
you can find demo at: http://www.ehcp.net/demo
since it is demo, daemon is not running, if it runs, demo becomes real... ![]()
demo username: admin
pass: 1234
here is the developers information for your info/questions:
msn/email: bvidinli@iyibirisi.com
gmail/skype/yahoo: bvidinli
you may also find some info here:
http://forum.iyibirisi.com/viewforum.php?f=3
http://forum.iyibirisi.com/viewforum.php?f=15
Howto: Extend the Life of Your Thinkpad's Battery (tp_smapi) on Ubuntu Feisty and Gutsy
You may or may not be aware that lithium ion batteries (like those present in the newer Thinkpad models) survive best when kept charged between 30%-85%. They should not be kept fully charged, and should be left off for long periods of time charged to ~%40. See here for more tips on Thinkpad battery treatment.
One way to extend the life of your Thinkpad's battery is to control the way it charges -- that is, to make sure that you keep it in the 30%-85% charged range whenever possible. This is possible easily and quickly through the tp_smapi kernel module.
(1) Download the tp_smapi code here. For the examples presented here, let's assume that you download the tarball to your home directory (~/):wget http://easynews.dl.sourceforge.net/sourceforge/tpctl/tp_smapi-0.32.tgz ~/tp_smapi-0.32.tgz
sudo aptitude install build-essential linux-source-2.6.22
sudo -s
cd /usr/src
tar -xjf linux-source-2.6.22.tar.bz2
(2c) Now go into /lib/modules/`uname -r`. Both the "build" and "source" symbollic links should point to your source folder. You can check this by observing the output of ln -l, or just create it this way with the following:sudo -s
rm -i /lib/modules/`uname -r`/source /lib/modules/`uname -r`/build
ln -s /usr/src/linux-source-2.6.22 /lib/modules/`uname -r`/source
ln -s /usr/src/linux-source-2.6.22 /lib/modules/`uname -r`/build
tar -xzf ~/tp_smapi-0.32.tgz
cd tp_smapi-0.32 && make && sudo make install