Monday, April 13, 2009

Downloading web pages with Downthemall


If you are using firefox to do internet browsing, DownthemAll is a cool plugin.
You install it from here. Once installed , this plugin adds two items to your right click menu. Look at the following picture.




When browsing a web page you can right click and then select the Down them All button. A new window pops up as shown below.


Set up the target diectory and then select the files/URLs to download. Enjoy easy download.

List of installed packages in Ubuntu 8.10

The list of installed packages in Ubunu/ debian can be see by the following command

# dpkg -l

I you want the list of packages along with the disk space they occupy use this variation.

# dpkg-query -W --showformat='${Installed-Size} ${Package}\n' | sort -nr | less
This can be very useful if you install lot of packages and later decide to remove some of them to recover space.

Tuesday, April 7, 2009

Blocking ads with adbloc extention in firefox

Adblock is a firefox extension which can save lot of internet traffic for you. Don't forget to install it if you have a monthly download limit.
This video shows how to install it.



Alternately you can look at this link

Disassembling programs with dissy

Dissy is a small utility which can be used to disassemble executable programs. It is actually a front end to objdump. On ubuntu objdump is provided by the binutils package.
You can install dissy with

sudo apt-get install dissy.


For trying out dissy, write a small C program as below.
int main()
{
printf("hello\n");
returns 0;
}

Compile it
$ gcc -o hello hello.c

Now invoke dissy as

$ dissy hello

You will get a graphical screen as below.


Hex editors in Ubuntu

Ghex is a cool hex editor that I some times use. You can install ghex like this.

Install it like this.
sudo apt-get install ghex

A menu entry will come under Applications->Programming->Hex Editor
Here is a screen shot of Ghex.



Alternately, you can install khexedit.

sudo apt-get install khexedit


Screen shots of khexedit are shown below.



Thursday, September 4, 2008

Finding large files on ubuntu/debian

Yesterday our LTSP server which runs on debian suddenly stopped working. After some investigation I found out that free hard disk space on the server was very low. The machine has 500+ accounts. I had to locate big files for back up.

The following code can be used for this.
 
$ find /home/sunil -type f -size +20000k -exec ls -lh {} \; | awk '{ print $8 ": " $5 }'


You can replace /home/sunil with what ever path you want to search. Also you can try changing the size from 20000k( 20MB) to some other value.

Sunday, August 17, 2008

Looking at man pages

One of my friends was asking how to look into the correct man page.

The Unix man pages are generally divided into the following sections.

Section Description
1 General commands
2 System calls
3 C library functions
4 Special files (usually devices, those found in /dev) and drivers
5 File formats and conventions
6 Games and screen savers
7 Miscellanea
8 System administration commands and daemon
You can look in various sections

$ man 5 passwd
$ man 1 passwd
The first command above gives you details about the structure of /etc/passwd, whereas the second command above will give you details about passwd command.
If you want to get all man page sections , you must install the following packages on (
debian/ubuntu)
manpages-dev - Manual pages about using GNU/Linux for development
manpages - Manual pages about using a GNU/Linux system


You can also try installing the package funny_manpages

Exploring the proc diretory on Linux

The /proc directory on ubuntu ( or any other linux ) is an interesting place to look at. See this listing.

sunil@debian:~$ ls /proc
1 2043 23019 31945 6893 devices key-users swaps
10 2234 2426 32039 6894 diskstats kmsg sys
10003 2239 2471 4 693 dma loadavg sysrq-trigger
101 2240 24877 5 7014 driver locks sysvipc
1135 2246 24878 591 705 execdomains meminfo tty
1292 2247 2508 5934 885 fb misc uptime
13872 2248 2509 6 9 filesystems modules version
13923 2249 2510 609 969 fs mounts vmstat
142 2250 2511 611 acpi ide mtrr zoneinfo
143 2254 2512 6857 asound interrupts net
1492 2255 2515 6858 buddyinfo iomem partitions
1510 2258 27933 6859 bus ioports scsi
1771 2261 27970 6860 cmdline irq self
2 22998 27971 6876 cpuinfo kallsyms slabinfo
2037 22999 3 6891 crypto kcore stat

This directory is not residing on your hard disk. Instead it is a snapshot of things inside your kernel. You can see a lot of numbers in the listing above. These refer to various processes running on the system. There are several files you can peek at in /proc . Look at cpuinfo.

sunil@debian:/proc/6891$ cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 15
model : 4
model name : Intel(R) Celeron(R) CPU 2.66GHz
stepping : 9
cpu MHz : 2660.155
cache size : 256 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 5
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc up pni monitor ds_cpl tm2 cid cx16 xtpr lahf_lm
bogomips : 5325.03

This file give you all the information the currently running kernel has , about your processor.
You can explore the rest of the files to find out a lot of system and network related information.