Intermediate

Intermediate Level

httperf – HTTP performance measurement tool

Connected From This

A UNIX Command
$httperf --hog --server www.youtube.com
httperf --hog --client=0/1 --server=www.youtube.com --port=80 --uri=/ --send-buffer=4096 --recv-buffer=16384 --num-conns=1 --num-calls=1
Maximum connect burst length: 0

Total: connections 1 requests 1 replies 1 test-duration 0.787 s

Connection rate: 1.3 conn/s (787.4 ms/conn, <=1 concurrent connections)
Connection time [ms]: min 787.4 avg 787.4 max 787.4 median 787.5 stddev 0.0
Connection time [ms]: connect 33.0
Connection length [replies/conn]: 1.000

Request rate: 1.3 req/s (787.4 ms/req)
Request size [B]: 68.0

Reply rate [replies/s]: min 0.0 avg 0.0 max 0.0 stddev 0.0 (0 samples)
Reply time [ms]: response 326.2 transfer 428.2
Reply size [B]: header 576.0 content 114914.0 footer 2.0 (total 115492.0)
Reply status: 1xx=0 2xx=1 3xx=0 4xx=0 5xx=0

CPU time [s]: user 0.32 system 0.16 (user 40.1% system 19.8% total 59.9%)
Net I/O: 143.3 KB/s (1.2*10^6 bps)

Errors: total 0 client-timo 0 socket-timo 0 connrefused 0 connreset 0
Errors: fd-unavail 0 addrunavail 0 ftab-full 0 other 0
$

$httperf --hog --server www.beautifulwork.org
httperf --hog --client=0/1 --server=www.beautifulwork.org --port=80 --uri=/ --send-buffer=4096 --recv-buffer=16384 --num-conns=1 --num-calls=1
Maximum connect burst length: 0

Total: connections 1 requests 1 replies 1 test-duration 0.818 s

Connection rate: 1.2 conn/s (818.4 ms/conn, <=1 concurrent connections)
Connection time [ms]: min 818.4 avg 818.4 max 818.4 median 818.5 stddev 0.0
Connection time [ms]: connect 60.2
Connection length [replies/conn]: 1.000

Request rate: 1.2 req/s (818.4 ms/req)
Request size [B]: 74.0

Reply rate [replies/s]: min 0.0 avg 0.0 max 0.0 stddev 0.0 (0 samples)
Reply time [ms]: response 322.8 transfer 435.5
Reply size [B]: header 338.0 content 40114.0 footer 2.0 (total 40454.0)
Reply status: 1xx=0 2xx=1 3xx=0 4xx=0 5xx=0

CPU time [s]: user 0.34 system 0.18 (user 42.0% system 21.5% total 63.5%)
Net I/O: 48.4 KB/s (0.4*10^6 bps)

Errors: total 0 client-timo 0 socket-timo 0 connrefused 0 connreset 0
Errors: fd-unavail 0 addrunavail 0 ftab-full 0 other 0
$

UNIX Explanation
httperf is a tool  to measure web server performance.  It
speaks  the  HTTP  protocol  both  in  its  HTTP/1.0  and
HTTP/1.1  flavors  and   offers  a  variety  of  workload
generators.  While running, it keeps track of a number of
performance metrics  that are  summarized in the  form of
statistics that  are printed  at the end  of a  test run.
The  most basic  operation of  httperf is  to  generate a
fixed number of HTTP GET requests and to measure how many
replies (responses) came back from the server and at what
rate the responses arrived.

nohup – run a command immune to hangups, with output to a non-tty

A UNIX Command
$nohup ls < /dev/null
nohup: appending output to `nohup.out'
$cat nohup.out
Desktop
Downloads
JohnySagariga
LeanBiz.zip
nohup.out
$ls
Desktop  Downloads  JohnySagariga  LeanBiz.zip  nohup.out
$

$nohup top < /dev/null
nohup: appending output to `nohup.out'
$cat nohup.out
Desktop
Downloads
JohnySagariga
LeanBiz.zip
nohup.out
	top: failed tty get

$nohup top < /dev/
nohup: appending output to `nohup.out'
$who
jeffrin  tty7         2011-08-09 19:48 (:0)
jeffrin  pts/0        2011-08-09 21:18 (:0.0)
jeffrin  pts/1        2011-08-09 21:20 (:0.0)
$nohup top < /dev/pts/1
nohup: ignoring input and appending output to `nohup.out'
$cat nohup.out
Desktop
Downloads
JohnySagariga
LeanBiz.zip
nohup.out
	top: failed tty get

	top: failed tty get

	top: failed tty get

$

UNIX Explanation
Usage: nohup COMMAND [ARG]...
  or:  nohup OPTION
Run COMMAND, ignoring hangup signals.

      --help     display this help and exit
      --version  output version information and exit

If standard input is a terminal, redirect it from /dev/null.
If standard output is a terminal, append output to `nohup.out' if possible,
`$HOME/nohup.out' otherwise.
If standard error is a terminal, redirect it to standard output.
To save output to FILE, use `nohup COMMAND > FILE'.

chrt – manipulate real-time attributes of a process

A UNIX Command
$chrt -m
SCHED_OTHER min/max priority	: 0/0
SCHED_FIFO min/max priority	: 1/99
SCHED_RR min/max priority	: 1/99
SCHED_BATCH min/max priority	: 0/0
SCHED_IDLE min/max priority	: 0/0
$chrt -b  -p 0 4555
$chrt -p 4555
pid 4555's current scheduling policy: SCHED_BATCH
pid 4555's current scheduling priority: 0
$chrt -o  -p 0 4555
$chrt -p 4555
pid 4555's current scheduling policy: SCHED_OTHER
pid 4555's current scheduling priority: 0
$

UNIX Explanation
chrt   sets  or retrieves the real-time scheduling
attributes of an existing PID or runs COMMAND with
the given attributes.  Both policy (one of SCHED_OTHER,
SCHED_FIFO, SCHED_RR, SCHED_BATCH, or SCHED_IDLE)
and priority can be set and retrieved.

vdir – list directory contents

A UNIX Command
$vdir symmel/
total 20
drwxr-xr-x  2 jeffrin jeffrin 4096 Jul 27 01:11 Docs
-rw-r--r--  1 jeffrin jeffrin   88 Jul 25 00:57 kernel_start.asm
-rw-r--r--  1 jeffrin jeffrin   78 Jul 25 00:57 kernel_start.s
drwxr-xr-x 10 jeffrin jeffrin 4096 Jul 25 00:57 linux
drwxr-xr-x  2 jeffrin jeffrin 4096 Jul 26 23:55 loader
-rw-r--r--  1 jeffrin jeffrin    0 Jul 25 00:57 README
$ls symmel/
Docs  kernel_start.asm  kernel_start.s  linux  loader  README
$

UNIX Explanation
List information  about the FILEs  (the current directory
by  default).   Sort entries  alphabetically  if none  of
-cftuvSUX nor --sort.

write — send a message to another user

A UNIX Command
$bsd-write jeffrin 8
bsd-write: jeffrin is not logged in on 8
$bsd-write jeffrin tty8
bsd-write: jeffrin has messages disabled on tty8
$mesg y
$bsd-write jeffrin tty8
bsd-write: jeffrin has messages disabled on tty8
$w
 20:08:58 up 23 min,  3 users,  load average: 0.02, 0.15, 0.16
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
root     tty1                      19:46   22:18   0.35s  0.03s wpa_supplicant -iwlan0 -c /etc/wpa_
jeffrin  tty8     :0               19:53   23:20  58.84s  0.09s x-session-manager
jeffrin  pts/0    :0.0             20:01    0.00s  0.30s  0.00s w
$bsd-write jeffrin pts/0

Message from jeffrin@debian.BW on pts/0 at 20:09 ...
hey ... worked ?
hey ... worked ?
EOF
$

UNIX Explanation
If the  user you want  to write to  is logged in  on more
than  one terminal,  you  can specify  which terminal  to
write to  by specifying the  terminal name as  the second
operand to the write command.  Alternatively, you can let
write select one of the  terminals - it will pick the one
with the shortest idle time.  This is so that if the user
is logged  in at work and  also dialed up  from home, the
message will go to the right place.

skill, snice – send a signal or report process status

A UNIX Command
$skill
Usage:   skill [signal to send] [options] process selection criteria
Example: skill -KILL -v pts/*

The default signal is TERM. Use -l or -L to list available signals.
Particularly useful signals include HUP, INT, KILL, STOP, CONT, and 0.
Alternate signals may be specified in three ways: -SIGKILL -KILL -9

General options:
-f  fast mode            This is not currently useful.
-i  interactive use      You will be asked to approve each action.
-v  verbose output       Display information about selected processes.
-w  warnings enabled     This is not currently useful.
-n  no action            This only displays the process ID.

Selection criteria can be: terminal, user, pid, command.
The options below may be used to ensure correct interpretation.
-t  The next argument is a terminal (tty or pty).
-u  The next argument is a username.
-p  The next argument is a process ID number.
-c  The next argument is a command name.
$skill -l
HUP INT QUIT ILL TRAP ABRT BUS FPE KILL USR1 SEGV USR2 PIPE ALRM TERM STKFLT
CHLD CONT STOP TSTP TTIN TTOU URG XCPU XFSZ VTALRM PROF WINCH POLL PWR SYS
$ps aux | grep xine
jeffrin   2844  2.9  1.4 661236 29460 pts/3    Sl   20:44   0:00 xine
jeffrin   2866  0.0  0.0 112944   816 pts/1    S+   20:44   0:00 grep xine
$skill 2844
$ps aux | grep xine
jeffrin   2869  0.0  0.0 112944   820 pts/1    S+   20:44   0:00 grep xine
$

UNIX Explanation
The default  signal for  skill is TERM.  Use -l or  -L to
list  available  signals.   Particularly  useful  signals
include  HUP, INT,  KILL, STOP,  CONT, and  0.  Alternate
signals  may  be specified  in  three  ways: -9  -SIGKILL
-KILL.

hcitool – configure Bluetooth connections

A UNIX Command
$hcitool
hcitool - HCI Tool ver 4.89
Usage:
	hcitool [options]  [command parameters]
Options:
	--help	Display help
	-i dev	HCI device
Commands:
	dev 	Display local devices
	inq 	Inquire remote devices
	scan	Scan for remote devices
	name	Get name from remote device
	info	Get information from remote device
	spinq	Start periodic inquiry
	epinq	Exit periodic inquiry
	cmd 	Submit arbitrary HCI commands
	con 	Display active connections
	cc  	Create connection to remote device
	dc  	Disconnect from remote device
	sr  	Switch master/slave role
	cpt 	Change connection packet type
	rssi	Display connection RSSI
	lq  	Display link quality
	tpl 	Display transmit power level
	afh 	Display AFH channel map
	lp  	Set/display link policy settings
	lst 	Set/display link supervision timeout
	auth	Request authentication
	enc 	Set connection encryption
	key 	Change connection link key
	clkoff	Read clock offset
	clock	Read local or remote clock
	lescan	Start LE scan
	lecc	Create a LE Connection
	ledc	Disconnect a LE Connection

For more information on the usage of each command use:
	hcitool  --help

UNIX Explanation
hcitool  is used to  configure Bluetooth  connections and
send  some special  command to  Bluetooth devices.  If no
command is  given, or if  the option -h is  used, hcitool
prints some usage information and exits.

basename – strip directory and suffix from filenames

A UNIX Command
$basename
basename: missing operand
Try `basename --help' for more information.
$basename /usr/bin/
bin
$basename /usr/
usr
$
$basename /usr/bin/less
less
$basename /usr/include/ma
malloc.h  math.h
$basename /usr/include/math.h
math.h
$basename /usr/include/math.h .
math.h
$basename /usr/include/math.h .h
math
$basename /usr/lib/libgccpp.so.1
libgccpp.so.1
$basename /usr/lib/libgccpp.so.1 .1
libgccpp.so
$

UNIX Explanation
`basename' removes any leading directory components from NAME.
Synopsis:

     basename NAME [SUFFIX]

If SUFFIX  is specified  and is identical  to the  end of
NAME, it is  removed from NAME as well.   Note that since
trailing  slashes are removed  prior to  suffix matching,
SUFFIX   will  do   nothing  if   it   contains  slashes.
`basename' prints the result on standard output.

Together, `basename' and `dirname' are designed such that
if `ls  "$name"' succeeds, then the  command sequence `cd
"$(dirname  "$name")";  ls  "$(basename "$name")"'  will,
too.   This  works   for  everything  except  file  names
containing a trailing newline.

POSIX allows the implementation  to define the results if
NAME  is  empty  or   `//'.   In  the  former  case,  GNU
`basename' returns the empty string.  In the latter case,
the result is `//' on platforms where // is distinct from
/, and `/' on platforms where there is no difference.


grog – guess options for groff command

A UNIX Command
$groff /usr/share/man/man7/pipe.7 | more
%!PS-Adobe-3.0
%%Creator: groff version 1.21
%%CreationDate: Fri Jul 15 18:18:46 2011
%%DocumentNeededResources: font Times-Roman
%%+ font Times-Bold
%%+ font Times-Italic
%%DocumentSuppliedResources: procset grops 1.21 0
%%Pages: 1
%%PageOrder: Ascend
%%DocumentMedia: Default 595 842 0 () ()
%%Orientation: Portrait
%%EndComments
%%BeginDefaults
%%PageMedia: Default
%%EndDefaults
%%BeginProlog
%%BeginResource: procset grops 1.21 0
%!PS-Adobe-3.0 Resource-ProcSet
/setpacking where{

$grog /usr/share/man/man7/pipe.7 | more
groff -man /usr/share/man/man7/pipe.7 
$groff -man /usr/share/man/man7/pipe.7 | more
%!PS-Adobe-3.0
%%Creator: groff version 1.21
%%CreationDate: Fri Jul 15 18:22:07 2011
%%DocumentNeededResources: font Times-Roman
%%+ font Times-Bold
%%+ font Times-Italic
%%DocumentSuppliedResources: procset grops 1.21 0
%%Pages: 2
%%PageOrder: Ascend
%%DocumentMedia: Default 595 842 0 () ()
%%Orientation: Portrait
%%EndComments
%%BeginDefaults
%%PageMedia: Default
%%EndDefaults
%%BeginProlog
%%BeginResource: procset grops 1.21 0
%!PS-Adobe-3.0 Resource-ProcSet

UNIX Explanation
grog reads  the input (file names or  standard input) and
guesses  which  of the  groff(1)  options  are needed  to
perform   the  input   with  the   groff   program.   The
corresponding groff command is outp