Paul - The Programmer

simple & stupid

Good Linux Tool, find out the biggest file / directory in the system

No matter how big your hard disk is, it can still run out of space someday. So, do some regular cleaning up work is necessary. Free some space by deleting the files which are out of date or not needed anymore.

To get the space consumed by each directory with du and find out the biggest one with sort.


$du --max-depth=1 -h | sort -h -r

Meaning of du options:

--max-depth : print the total size of direcotries on the firest level.

-h  : print the size in human readable format (e.g.  1K, 2M, 3G, etc. ).

Meaning of sort options:

-h : sort human readable format numbers.

-r : reverse the result, the biggest number is on the top.

What I need to do is use this command recursively from the root directory ( / ) . It will finally lead me to the file or directory which consumes most of my storage.

Good Linux tool, netcat

Netcat, as know as nc, is a simple command line tool to send and receive data with TCP or UDP protocal.

There are many tutorials for the netact on the internet, since it has been wildly used as a back-end tool to :

  • Simulate server
  • Scanning ports
  • File transfers
  • Proxy gateway
  • Many other things to transfer data with TCP/UDP from one place to another.

Hence here I'd like to show you something different, an example of how to create a echo server with netcat.

The server side just as simple as one line command:

$ nc -l -p 12345 -c 'while true; do read i && echo [echo] $i; done'

Then the telnet can be used as a client to connect to the nc server

$ telnet localhost 12345
[echo] hello

Once you input any string, the server returns your input with [echo] prefix.

Good Linux tool, Network Manager.

Network Manager is a GUI application powered by dbus for network configuration. Network Manager provides a user-friendly interface to set up the wired and wireless network interface.

Network Manager consists of a background daemon process running as root and a front-end applet application.

Install Network Manager with command,

$ sudo apt-get install network-manager network-manager-gnome

To utilize the Network Manager, for Debian users, the user has to be a member of netdev group. For other distribution users, the similar user privileges are required.

$ sudo usermod -a -G netdev paul

Verify the user group setting with

$ id paul
uid=1000(paul) gid=1000(paul) groups=1000(paul),4(adm),24(cdrom),25(floppy),29(audio),44(video),46(plugdev),109(netdev),110(bluetooth),116(scanner)

By default, Network Manager only handles the interface not declared in /etc/network/interfaces.

Not declared interface means the interface is not described in the interface or the interface is disableed with a #NetworkMangaer# prefix.

For instance,

# The primary network interface
allow-hotplug eth0
#NetworkManager#iface eth0 inet dhcp

To enable Network Manager to handle the interfaces in /etc/network/interfaces, the Network Manager's configuration file /etc/NetworkManager/NetworkManager.conf should be updated as:



Then restart network-manager service:

$ sudo /etc/init.d/network-manager restart


Connect to wireless network with wireless tools

Wireless tools is a package of command line tools for configure wireless network.

With the help of wireless tools, it is no need to install the graphical network configuration tools, such as the wifi-radar.

The wireless tools consists with ifrename, iwconfig, iwgetid and iwlist.

To connect to a wireless network, we only need the help of iwlist.

iwlist can list all the nearby wireless nework access point and their addional information.

$ sudo iwlist ath0 scan 
ath0      Scan completed :
          Cell 01 - Address: 00:25:86:49:16:F4
                    Frequency:2.422 GHz (Channel 3)
                    Quality=21/70  Signal level=-74 dBm  Noise level=-95 dBm
                    Encryption key:on
                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
                              12 Mb/s; 24 Mb/s; 36 Mb/s; 9 Mb/s; 18 Mb/s
                              48 Mb/s; 54 Mb/s

Now, we get the available access point. To access to the wireless network, we need to configure the network interface.

For Debian, the network interface configuration file is /etc/network/interfaces.

To use the interface ath0 to access the acccess point 'TP-LINK_4916F4', the configuration show like below:

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug ath0
iface ath0 inet dhcp
	# wireless-* options are implemented by the wireless-tools package
	wireless-mode managed
	wireless-essid TP-LINK_4916F4
	wireless-key1 s:xxxxxxxx

Connect to the wireless network by restarting the networking init script.

# /etc/init.d/networking restart


Enable Adobe Flash Player GPU acceleration on Linux

Flash Player uses the OpenGL to support GPU acceleration on Linux.

This feature requires the below features from the OpenGL facilities.

  • GL_ARB_multitexture
  • GL_EXT_framebuffer_object
  • GL_ARB_shader_objects
  • GL_ARB_shading_language_100
  • GL_ARB_fragment_shader

Flash player automatically checks the video card and driver combination meet the GPU compositing requirement.

However we can ask the Flash player to skip the GPU valiadation by define option OverrideGPUValidation in mms.cfg.

The mms.cfg is a system wild configuration file for policy setting. For Linux, mms.cfg has to be created with the path /etc/adobe.

So, what I need to do to enable the GPU acceleration is :

  1. Create file /etc/adobe/mms.cfg.
  2. Add  "OverrideGPUValidation = 1" ( without the quotes ) in mms.cfg. 1 is for true, 0 is for false.

Unfortunately, this trick does not work for my ATI X300 card. I didn't notice any improvement. The flash played in a little window still make CPU run over 70%.

After checked with glxinfo, I found only the GL_ARB_multitexture. All the other needed OpenGL features are missing. I thought that is the root cause.

By the way, the option OverrideGPUValidation may need Flash rendering problems or even system crash. You should use it with care.