dimitris kalamaras

mathematics, social network analysis, free software…

Category: Linux (Page 2 of 3)

top: Πόση μνήμη καταναλώνει κάθε process στο Linux

Θέλετε να δείτε που καταναλώνεται η μνήμη RAM του υπολογιστή σας και ποια διεργασία ή εφαρμογή σας τρώει συστηματικά τους πόρους; Υπάρχουν διάφορες λύσεις είτε από το γραφικό περιβάλλον είτε από τη γραμμή εντολών (bash) αλλά δεν συγκρίνονται μπροστά στο πανταχού παρών top.

Το table oprocesses είναι πολύ περισσότερα από ένας απλός πίνακας των προγραμμάτων που τρέχουμε. Ανανεώνεται συνεχώς και μας δείχνει uptime, κατανάλωση μνήμης, cpu load, αριθμό διεργασιών, κατανάλωση swap και αναλυτική περιγραφή κάθε διεργασίας που τρέχουμε (μνήμη, %cpu, share, niceness, user, pid, πόση ώρα τρέχει και ποια εντολή είναι!). Και όλα αυτά sortable. Για παράδειγμα για να σορτάρετε τις διεργασίες που σας δείχνει ώστε να εμφανίζονται ανάλογα με την κατανάλωση μνήμης πατάτε το πλήκτρο Μ.

To top εν δράσει!

Read More

Revive your Asus EeePC 701 4G and build a media server and torrent client

So, I had this EeePC 701 4G waiting patiently in a box and decided to make something useful with it: A media server + a remote torrent client.

First things first, I decided to install Lubuntu 13.04 in our EeePC. It is a simple, light but ‘full’ linux distro, since it is 100% compatible with Ubuntu. I downloaded the alternate ISO, burned it to a USB flash and rebooted the machine. The installation was smooth (it took ~40 minutes) and after rebooting to LXDE I was happy to see 1GB of free space in the 4GB SSD disk. Furthermore, everything worked OK: sound, graphics, greek support, etc. It was time to start the real fun part…

Read More

How to connect to PPTP-based VPN from Linux

Do you need to connect to a Windows VPN from Linux command line? It’s simple even though the Point-to-Point Tunneling Protocol (PPTP) is proprietary. First, install the pptp client for the linux command line:

sudo apt-get install pptp-linux

Then create a new file called chap-secrets, inside /etc/ppp:

sudo vim /etc/ppp/chap-secrets

This file is where your VPN username and password will be kept. Add this line to it:

your_username      PPTP    your_password        *

Apparently, you need to change ‘your_username’ and ‘your_password’ to your own. The ‘PPTP’ is just a name you give to remote server. You might want to change it to something else. It doesn’t really matter.

Next, create the basic configuration file for pptp-linux. This file must be kept inside /etc/ppp/peers but you can name it anyway you want. Let’s say, you name it ‘cnc’:

sudo vim /etc/ppp/peers/cnc

Inside the new file, add the following lines:

pty "pptp REMOTE_SERVER_IP --nolaunchpppd" 
name your_username    #use the same name you used in chap-secrets
remotename PPTP       #use the same remote name you used in chap-secrets
ipparam cnc           #use the same name you used in naming this file
require-mppe-128      #encrypt all traffic using 128-bit encryption
file /etc/ppp/options.pptp #use standard PPP options when connecting

Apparently, you need to change REMOTE_SERVER_IP to the IP address of your VPN server.

Finally, create a new script inside /etc/ppp/ip-up.d to route traffic through the new ppp0 device. This script will be running every time ppp is up. Use any filename you like. I used ‘my_traffic’.

sudo vim /etc/ppp/ip-up.d/my_traffic

As you see in this example, I use to force the kernel to route all packets directed to the IP range – to go through PPTP:

route add -net dev ppp0

Apparently, you need to change the ‘’ part with the IP range of your remote network.

That’s all! Connect with this simple command:

sudo pon cnc

In parallel, you can watch for PPTP messages with

tail -f /var/log/syslog

You need to see something like that:

Sep 14 02:09:30 vaio pppd[4516]: local IP address
Sep 14 02:09:30 vaio pppd[4516]: remote IP address 10.49.217.

This means that you have acquired a VPN IP and you are probably OK. Check ifconfig to be sure.

If you manage to connect to your VPN, you will be able to ping to the above IP range, ssh to them, etc, just like as you were in office.

When you are done, disconnect with this command:

sudo poff cnc

How-to configure file sharing in KDE4/Samba

Simple. At least in Debian, Kubuntu and other Debian-derivatives. Install Samba server and the appropriate KDE4 module as root:

# apt-get install samba kdenetwork-filesharing

The kdenetwork-filesharing package installs a nice System Settings panel to configure network file-sharing using NFS and Samba. It also adds (the initially missing) functionality in the Properties > Share tab of each file and folder in Dolphin.

So, install the above packages, then open Dolphin, select a folder, right-click on it and select Properties then go to Share tab. Click on Configure File Sharing button and a new dialog appears. Let the “Simple Sharing” option intact and click on the Add button. A new dialog appears where you select and add the desired folder. Click OK twice. You are done.

Name-based Virtual Hosts in Apache

Name-based virtual hosting enables us to serve different domains from a single server. All we need is to add this line to /etc/apache2/sites-available/default:

NameVirtualHost *

The * specifies that Apache will serve requests for all IP addresses; optionally we can specify only a certain IP on the server.

Next, we create a new for each different domain we want to serve.

This can be done either by adding a few lines inside /etc/apache2/sites-available/default

<VirtualHost *>
    ServerName www.lxf.gr
    ServerAlias lxf.org
    DocumentRoot /media/oxy/www/lxf

or by creating a new file (i.e. lxf.gr) inside /etc/apache2/sites-available

<VirtualHost *>
 ServerAdmin [email protected]
 ServerName lxf.gr
 ServerAlias lxf.gr
 DocumentRoot /media/oxy/www/lxf
 <Directory /media/oxy/www/lxf>
  Options Indexes FollowSymLinks
  Options -MultiViews
  AllowOverride All
  Order allow,deny
  Allow from all
 CustomLog /var/log/apache2/lxf-access.log combined
 ServerSignature On

and symlinking it to /etc/apache2/sites-enabled:

sudo ln -s /etc/apache2/sites-available/lxf  /etc/apache2/sites-enabled/

Technorati Tags: ,

free space is important!

That is the lesson I have learned today.

Despite my eagerness to update my N900 to Maemo 5 v10.2010, the software update tool kept giving me the following cryptic message:

not enough memory in target location

Wtf? The message was a surprise for me, since I thought the 32GB of my N900 would be more than enough for an 113.1MB update. But…Rootfs partition in n900 amounts only to 227MB, which apparently was nearly consumed by all the silly tools I have installed recently (mc, gnu-tar, openssh, lighttpd (yep, I run a web server on my mobile phone!), numpty-physics, bouncy, scummvm etc), along with ovi maps, micro-blogging app, etc.

After a while searching the Internet, I ended up in the maemo.org excellent wiki which of course was giving some usual-space-saving linux tips:

apt-get clean
apt-get autoremove

along with some more unusual (to me!) ‘opt-ifications’.

What’s that? The maemo slang for “move whatever can be moved from /usr to /home/opt”. For instance, you can easily mv nokia-maps from /usr/share to /home/opt and then ln -s back to where it was, so that the relevant application could run. Using this technique I managed to free almost 60MB in rootfs.

Now the update is underway and I am eager to see what’s new.


I’ve got Linux in my pocket too!

Yeeeeeeeeeeah! I am now yet another proud Nokia N900 owner!

Nokia N900 (Image from NOKIA)

Nokia N900 (Image from NOKIA)

This device runs Linux on an ARM Cortex 600MHz CPU, 1GB RAM and 32GB HDD, and it is more a portable computer than a mobile phone, thanks to its 3.5” touch screen (800×480 resolution) and the embedded keyboard. Right now, my N900 is still charging (minimum 6 hours initial charge I was told!) so I haven’t had the chance to play with it yet, but I plan to explore it tomorrow evening. Stay tuned!

Page 2 of 3

Powered by WordPress & Theme by Anders Norén