Limit bandwidth in Linux

If you want to limit your bandwidth in Linux you could use trickle or wondershaper, to limit a process use this:

trickle -u[up]  -d [down] [program]

 

for a global limit use:

wondershaper [interface]  [down] [up]

for remove :

wondershaper clear [interface]

Benchmark Bash fastest replace with tr sed awk perl

Test String (10xX):

Test Cases Results must look like:

single char remove:

single char replace:

string/multi char remove:

string/multi char replace:

Times:

run the test string from file 100000 times.

single char remove single char replace multi char remove multi char replace string remove string replace
sed 5.658s 5.774s 3.449s 5.929s 3.476s 5.724s
perl regex 5.604s 5.918s 3.428s 6.027s 3.482s 5.870s
awk gsub 3.469s 5.892s 3.339s 5.942s
tr bash 5.972s 5.897s
perl tr  5.996s  5.837s

 

For bash its the easiest way to use sed because its simpler to use perl and it could do the most things or if you do simple things you could use tr.In perl you could see this benchmark.

SED 4.2.2

single char remove:

single char replace:

multi char remove:

multi char replace:

string remove:

string replace:

 

AWK 4.0.1

single replace with regex not possible.

multi char remove:

multi char replace:

string remove:

string replace:

 

TR 8.21

single replace and remove not possible.

multi char replace:

string replace:

 

PERL REGEX 5

single char remove:

single char replace:

multi char remove:

multi char replace:

string remove:

string replace:

 

PERL TR 5

multi char replace:

string replace:

 

Operating System Infos

To get some infos about your GNU/Linux OS run this:

Result looks like:

APACHE error

“Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName”

add this line:

restart service:

Get IP´s

To get the adapters wit IPs use this:

Result: