Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Linux Ask!

Mar 242008
 

List processes by memory usage

Answer:

To list all of your current system's running processes, and sort by memory usage, try

# ps -e -o pcpu,cpu,nice,state,cputime,args --sort pcpu | sed '/^ 0.0 /d'

    0 [aio/0]
    0 [ata/0]
    0 [ata_aux]
    0 [cqueue]
    0 [events/0]
    0 [kacpi_notify]
    0 [kacpid]
    0 [kblockd/0]
    0 [khelper]
    0 [kintegrityd/0]
.
.
.
29528 /usr/sbin/apache2 -k start
29536 /usr/sbin/apache2 -k start
29860 /usr/sbin/apache2 -k start
30320 /usr/sbin/apache2 -k start
32588 /usr/sbin/apache2 -k start
Mar 182008
 

Search the history of commands you have executed

Answer:

You typed a lot of commands, and you want to search them, the simplest method is to press Ctrl+r

# [press Ctrl+r]

(reverse-i-search)`da': date

In the above example, I typed the characters "da" and the shell auto matched the command "date" for me - which I have typed in an earlier session.

Mar 042008
 

What is the maximum length of a valid UTF-8 character?

Answer:

A valid UTF-8 character take up 1 to 4 bytes (and within each octet, only the first 128 US-ASCII characters is used, so it can compatible with legacy systems).

A subset of UTF-8 called UTF-8 Basic Multilingual Plane (BMP), which only takes 3 bytes and can represent most frequently used characters and is compatible with UTF-16/UCS-2.

Reference: http://en.wikipedia.org/wiki/UTF-8

Mar 022008
 

Audible ping

Answer:

Sometimes you want to listen your machine pinging another machine (remote machine), especially you want to know when the remote machine is alive when you have issued a reboot.

It is easy with the ping command.

# ping -a google.com

Open your speaker to listen.