Linux "tc" Command Line Options and Examples
show / manipulate traffic control settings

Tc is used to configure Traffic Control in the Linux kernel. Traffic Control consists of the following: SHAPING When traffic is shaped, its rate of transmission is under control. Shaping may be more than lowering the available bandwidth - it is also used to smooth out bursts in traffic for better network behaviour.


Usage:

tc [ OPTIONS ] qdisc [ add | change | replace | link | delete ] dev DEV [ parent qdisc-id | root ] [ handle
qdisc-id ] qdisc [ qdisc specific parameters ]




Command Line Options:

-b
read commands from provided file or standard input and invoke them. First failure will cause termina‐tion of tc.
tc -b ...
-n
switches tc to the specified network namespace NETNS. Actually it just simplifies executing of:ip netns exec NETNS tc [ OPTIONS ] OBJECT { COMMAND | help }totc -n[etns] NETNS [ OPTIONS ] OBJECT { COMMAND | help }
tc -n ...
-cf
specifies path to the config file. This option is used in conjunction with other options (e.g. -nm).FORMATThe show command has additional formatting options:
tc -cf ...
-s
output more statistics about packet usage.
tc -s ...
-d
output more detailed information about rates and cell sizes.
tc -d ...
-r
output raw hex values for handles.
tc -r ...
-p
decode filter offset and mask values to equivalent filter commands based on TCP/IP.
tc -p ...
-iec
print rates in IEC units (ie. 1K = 1024).
tc -iec ...
-g
shows classes as ASCII graph. Prints generic stats info under each class if -s option was specified.Classes can be filtered only by dev option.
tc -g ...
-j
Display results in JSON format.
tc -j ...
-nm
resolve class name from /etc/iproute2/tc_cls file or from file specified by -cf option. This file isjust a mapping of classid to class name:# Here is comment1:40 voip # Here is another comment1:50 web1:60 ftp1:2 hometc will not fail if -nm was specified without -cf option but /etc/iproute2/tc_cls file does not exist,which makes it possible to pass -nm option for creating tc alias.EXAMPLEStc -g class show dev eth0Shows classes as ASCII graph on eth0 interface.tc -g -s class show dev eth0Shows classes as ASCII graph with stats info under each class.HISTORYtc was written by Alexey N. Kuznetsov and added in Linux 2.2.
tc -nm ...