Directory Disk Usage

Disk Usage command

Sometimes it’s useful to be able to find out how much disk space a directory is taking. While there are some web interfaces or desktop applications that allows you to do that, it’s always useful to know how it can be done through a command shell.
The DU Command

To find out how much space is being used, you can use the DU (Disk Usage) command. Here a few examples of the DU command usage.

Listing a disk space summary of directory

 # du -sh [directory]

Listing the disk space used for a directory and its subdirectories, sorted by disk usage

 # du -h [directory] | sort -rn

Take note that the “h” switch allows displays the disk usage in human readable format (ie. kylobytes, megabytes, etc.).

TCPdump

TCPdump

TCPdump is a very powerful command line interface packet sniffer.

It must be launched as root or with superuser rights because of the its use of the promiscuous mode or to be sure to have sufficent privilileges on a network device or a socket.

Wireshark (formerly ethereal) can be used as an alternative to TCPdump but with a GUI interface. Wireshark can be used to read the logs captured by TCPdump too.

refer to this site for more info: http://openmaniak.com/tcpdump.php#tcp_use

grep regular expression

grep command

The grep program is a standard UNIX utility that searches through a set of files for an arbitrary text pattern, specified through a regular expression. By default, grep is case-sensitive (use -i to ignore case). By default, grep ignores the context of a string (use -w to match words only). By default, grep shows the lines that match (use -v to show those that don’t match).

Continue reading

How to restrict certain extentions to call international numbers only

Custom Context

This is done using custom context module. If you’re using Elastix you must install this module (refer to Elastix witout tears)

Custom Contexts creates contexts that can be used to allow limited access to dial-plan
applications.
Features:

  • Allows for time restrictions on any dialplan access.
  • Allows for pattern matching to allow/deny.
  • Allows for failover destinations, and PIN protected failover.
  • This can be very useful for multi-tenant systems.
  • Inbound routing can be done using DID or zap channel routing, this module
  • allows for selective outbound routing.
  • Phones can be placed in a restricted context allowing them only internal calls.

Continue reading