summaryrefslogtreecommitdiffstats
path: root/chapter_16.xml
blob: d51e5d7459452731f54b7081e8e6fcaeb871c7c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
<?xml version="1.0"?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  "/usr/share/xml/docbook/xml-dtd-4.5/docbookx.dtd">

<chapter id="ch_network-utils">
<title>Basic Networking Utilities</title>

<para>
So you've finally managed to setup your network connection, now what?
How do you know that it's working? How do you know that you set it up
correctly? And just what do you do now that it's setup? Well this
chapter is for you.
</para>

<section id="network-utils_network-diagnostics">
  <title>Network Diagnostic Tools</title>

<para>
Slackware Linux includes a great many networking tools for
troubleshooting and diagnosing network connection troubles, or just for
seeing what's out there on the network. Most of these tools are
command-line tools, so you can run them from a virtual terminal or in a
console window on your graphical desktop. A few of them even have
graphical front-ends, but we're going to deal almost exclusively with
command-line tools for now.
</para>

<section id="network-utils_ping">
<title>ping</title>

<para>
<application>ping</application>(8) is a handy tool for determining if a
computer is operational on your network or on the Internet at large.
You can think of as a type of sonar for computers. By using it, you
send out a "ping" and listen for an echo to determine if another
computer or network device is listening. By default,
<application>ping</application> checks for the remote computer once per
second indefinitely, but you can change the interval between checks and
the total number of checks easily, just check the man page. You can
terminate the application at any time with
<keycap>CTRL</keycap>-<keycap>c</keycap>. When
<application>ping</application> is finished, it displays a handy
summary of its activity. <application>ping</application> is very useful
for determining if a computer on your network or the Internet is
available, but some systems block the packets
<application>ping</application> sends, so sometimes a system may be
functioning properly, but still not send replies.
</para>


<screen><prompt>darkstar:~&#35; </prompt><userinput>ping -c 3 www.slackware.com</userinput>
64 bytes from slackware.com (64.57.102.34): icmp_seq=1 ttl=47 time=87.1 ms
64 bytes from slackware.com (64.57.102.34): icmp_seq=2 ttl=47 time=86.2 ms
64 bytes from slackware.com (64.57.102.34): icmp_seq=3 ttl=47 time=86.7 ms

--- slackware.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2004ms
rtt min/avg/max/mdev = 86.282/86.718/87.127/0.345 ms
</screen>

</section>

<section id="network-utils_traceroute">
<title>traceroute</title>

<para>
<application>traceroute</application>(8) is a handy tool for determining
what route your packets take to reach some other computer. It's mainly
of use for determining which computers are "near" or "far" from you.
This distance isn't strictly geographical, as your Internet Service
Provider may route traffic from your computer in strange ways.
<application>traceroute</application> shows you each router between
your computer and any other machine you wish to connect to.
Unfortunately, many providers, firewalls, and routers will block
<application>traceroute</application> so you might not get a complete
picture when using it. Still, it remains a handy tool for network
troubleshooting.
</para>

<screen><prompt>darkstar:~&#35; </prompt><userinput>traceroute www.slackware.com</userinput>
traceroute to slackware.com (64.57.102.34), 30 hops max, 46 byte
packets
 1  gw.ctsmacon.com (192.168.1.254)  1.468 ms  2.045 ms  1.387 ms
 2  10.0.0.1 (10.0.0.1)  7.642 ms  8.019 ms  6.006 ms
 3  68.1.8.49 (68.1.8.49)  10.446 ms  9.739 ms  7.003 ms
 4  68.1.8.69 (68.1.8.69)  11.564 ms  6.235 ms  7.971 ms
 5  dalsbbrj01-ae0.r2.dl.cox.net (68.1.0.142)  43.859 ms  43.287 ms 44.125 ms
 6  dpr1-ge-2-0-0.dallasequinix.savvis.net (204.70.204.146)  41.927 ms 58.247 ms  44.989 ms
 7  cr2-tengige0-7-5-0.dallas.savvis.net (204.70.196.29)  42.577 ms 46.110 ms  43.977 ms
 8  cr1-pos-0-3-3-0.losangeles.savvis.net (204.70.194.53)  78.070 ms 76.735 ms  76.145 ms
 9  bpr1-ge-3-0-0.LosAngeles.savvis.net (204.70.192.222)  77.533 ms 108.328 ms  120.096 ms
10  wiltel-communications-group-inc.LosAngeles.savvis.net (208.173.55.186)  79.607 ms  76.847 ms  75.998 ms
11  tg9-4.cr01.lsancarc.integra.net (209.63.113.57)  84.789 ms  85.436 ms  85.575 ms
12  tg13-1.cr01.sntdcabl.integra.net (209.63.113.106)  87.608 ms 84.278 ms  86.922 ms
13  tg13-4.cr02.sntdcabl.integra.net (209.63.113.134)  87.284 ms 85.924 ms  86.102 ms
14  tg13-1.cr02.rcrdcauu.integra.net (209.63.114.169)  85.578 ms 85.285 ms  84.148 ms
15  209.63.99.166 (209.63.99.166)  84.515 ms  85.424 ms  85.956 ms
16  208.186.199.158 (208.186.199.158)  86.557 ms  85.822 ms  86.072 ms
17  sac-main.cwo.com (209.210.78.20)  88.105 ms  87.467 ms  87.526 ms
18  slackware.com (64.57.102.34)  85.682 ms  86.322 ms  85.594 ms
</screen>
</section>

<section id="network-utils_telnet">
<title>telnet</title>

<para>
Once upon a time, <application>telnet</application>(1) was the greatest
thing since sliced bread. Basically, <application>telnet</application>
opens an unencrypted network connection between two computers and hands
control of the session to the user rather than some other application.
Using <application>telnet</application>, people could connect to shells
on other computers and execute commands as if they were physically
present. Due to its unencrypted nature this is no longer recommended;
however, <application>telnet</application> is still used for this
purpose by many devices.
</para>

<para>
Today, <application>telnet</application> is put to better use as a
network diagnostic tool. Because it passes control of the session
directly to the user, it can be used for a great variety of testing
purposes. As long as you know what ASCII commands to send to the
receiving computer, you can do any number of activies, such as read web
pages or check your e-mail. Simply inform
<application>telnet</application> what network port to use, and you're
all set.
</para>

<screen><prompt>darkstar:~&#36; </prompt><userinput>telnet www.slackware.com 80</userinput>
Trying 64.57.102.34...
Connected to www.slackware.com.
Escape character is '^]'.
<userinput>HEAD &#47; HTTP&#47;1.1
Host: www.slackware.com
</userinput>
HTTP&#47;1.1 200 OK
Date: Thu, 04 Feb 2010 18:01:35 GMT
Server: Apache&#47;1.3.27 (Unix) PHP&#47;4.3.1
Last-Modified: Fri, 28 Aug 2009 01:30:27 GMT
ETag: "61dc2-5374-4a973333"
Accept-Ranges: bytes
Content-Length: 21364
Content-Type: text&#47;html
</screen>

</section>

<section id="network-utils_ssh">
<title>ssh</title>

<para>
As we mentioned, <application>telnet</application> may be useful as a
diagnostic tool, but its unencrypted nature makes it a security concern
for shell access. Thankfully, there's the secure shell protocol. Nearly
every Linux, UNIX, and BSD distribution today makes use of OpenSSH, or
<application>ssh</application>(1) for short. It is one of the most
commonly used network tools today and makes use of the strongest
cryptographic techniques. <application>ssh</application> has many
features, configuration options, and neat hacks, enough to fill its own
book, so we'll only go into the basics here. Simply run
<application>ssh</application> with the user name and the host and
you'll be connected to it quickly and safely. If this is the first time
you are connecting to this computer, <application>ssh</application>
will ask you to confirm your desire, and make a local copy of the
encryption key to use. Should this key later change,
<application>ssh</application> will warn you and refuse to connect
because it is possible that some one is attempting to hijack the
connection using what is known as a man-in-the-middle attack.
</para>

<screen>
<prompt>darkstar:~&#35; </prompt><userinput>ssh alan@slackware.com</userinput>
alan@slackware.com's password: <userinput>secret</userinput>
<prompt>alan@slackware.com:~&#36; </prompt>
</screen>

<para>
The user and hostname are in the same form used by e-mail addresses.
If you leave off the username part, <application>ssh</application> will
use your current username when establishing the connection.
</para>

<!-- add stuff about ssh keys -->
<!-- add stuff about scp -->

</section>

<section id="network-utils_tcpdump">
  <title>tcpdump</title>

<para>
So far all the tools we've looked at have focused on making connections
to other computers, but now we're going to look at the traffic itself.
<application>tcpdump</application>(1) (which must be run as root)
allows us to view all or part of the network traffic originating or
received by our computer. <application>tcpdump</application> displays
the raw data packets in a variety of ways with all the network headers
intact. Don't be alarmed if you don't understand everything it
displays, <application>tcpdump</application> is a tool for professional
network engineers and system administrators. By default, it probes the
first network card it finds, but if you have multiple interfaces,
simply use the <arg>-i</arg> argument to specify which one you're
interested in.  You can also limit the data displayed using expressions
and change the manner in which it is displayed, but that is best
explained by the man page and other reference material.
</para>

<screen><prompt>darkstar:~&#35; </prompt><userinput>tcpdump -i wlan0</userinput>
tcpdump: verbose output suppressed, use -v or -vv for full protocol
decode
listening on wlan0, link-type EN10MB (Ethernet), capture size 96 bytes
13:22:28.221985 IP gw.ctsmacon.com.microsoft-ds &#62; 192.168.1.198.59387:
Flags [P.], ack 838190560, win 3079, options [nop,nop,TS val 1382697489
ecr 339048583], length 164WARNING: Short packet. Try increasing the
snap length by 140
SMB PACKET: SMBtrans2 (REPLY)

13:22:28.222392 IP 192.168.1.198.59387 &#62; gw.ctsmacon.com.microsoft-ds:
Flags [P.], ack 164, win 775, options [nop,nop,TS val 339048667 ecr
1382697489], length 134WARNING: Short packet. Try increasing the snap
length by 110
SMB PACKET: SMBtrans2 (REQUEST)
</screen>

</section>

<section id="network-utils_nmap">
<title>nmap</title>

<para>
Suppose you need to know what network services are running on a
machine, or multiple machines, or you wish to determine if multiple
machines are responsive?  You could <application>ping</application>
each one individually, <application>telnet</application> to each port
you're interested in, and note every detail, but that's very tedious
and time consuming. A much easier alternative is to use a port scanner,
and <application>nmap</application>(1) is just the tool for the job.
</para>

<para>
<application>nmap</application> is capable of scanning TCP and UDP
ports, determining the operating system of a network device, probing
each located service to determine its specific type, and much much
more.  Perhaps the simplist way to use <application>nmap</application>
is to "ping" multiple computers at once. You can use network address
notation (CIDR) or specify a range of addresses and
<application>nmap</application> will scan every one and return the
results to you when it's finished. You can even specify host names as
you like.
</para>

<para>
In order to &#34;ping&#34; hosts, you'll have to use the <arg>-sP</arg>
argument. The following command instructs
<application>nmap</application> to &#34;ping&#34; www.slackware.com and the 16
IP addresses starting at 72.168.24.0 and ending at 72.168.24.15.
</para>

<screen><prompt>darkstar:~&#35; </prompt><userinput>nmap -sP www.slackware.com 72.168.24.0/28</userinput>
</screen>

<para>
Should you need to perform a port scan, <application>nmap</application>
has many options for doing just that. When run without any arguments,
<application>nmap</application> performs a standard TCP port scan on all
hosts specified. There are also options to make
<application>nmap</application> more or less aggressive with its
scanning to return results quicker or fool intrusion detection
services. For a full discussion, you should refer to the rather
exhaustive man page. The following three commands perform a regular
port scan, a SYN scan, and a &#34;Christmas tree&#34; scan.
</para>

<screen><prompt>darkstar:~&#35; </prompt><userinput>nmap www.example.com</userinput>
<prompt>darkstar:~&#35; </prompt><userinput>nmap -sS www.example.com</userinput>
<prompt>darkstar:~&#35; </prompt><userinput>nmap -sX www.example.com</userinput>
</screen>

<warning>
  <para>
    Be warned! Some Internet Service Providers frown heavily on port
    scanning and may take measures to prevent you from doing it.
    <application>nmap</application> and applications like it are best
    used on your own systems for maintenance and security purposes,
    not as general purpose Internet scanners.
  </para>
</warning>

</section>

<section id="network-utils_host">
<title>host</title>

<para>
Often network problems stem from a failure of DNS (Domain Name Service)
which maps domain names to IP addresses. An easy way to perform quick
DNS lookups is the <application>host</application>(1) command. When
this is run, your computer will perform a few common DNS lookups and
return the results.
</para>

<screen><prompt>darkstar:~&#35; </prompt><userinput>host www.slackware.com</userinput>
www.slackware.com is an alias for slackware.com.
slackware.com has address 64.57.102.34
slackware.com mail is handled by 1 mail-mx.cwo.com.
</screen>

</section>

<section id="network-utils_dig">
<title>dig</title>

<para>
More complex DNS lookups can be manually performed with the
<application>dig</application>(1) tool.  <application>dig</application>
is "the meanest dog in the pound" when it comes to troubleshooting DNS
issues. With this tool, you can perform virtually any DNS lookup from
reverse lookups to A, CNAME, MX, SP, TXT records and more. There are
far too many command-line options and lookup types to go into depth
here, but the man page lists all the common use cases.
</para>

<screen><prompt>darkstar:~&#35; </prompt><userinput>dig @207.69.188.185 www.slackware.com a</userinput>

&#59; &lt;&lt;&gt;&gt; DiG 9.4.3-P4 &lt;&lt;&gt;&gt; @207.69.188.185 www.slackware.com a
&#59; (1 server found)
&#59;&#59; global options:  printcmd
&#59;&#59; Got answer:
&#59;&#59; -&gt;&gt;HEADER&lt;&lt;- opcode: QUERY, status: NOERROR, id: 57965
&#59;&#59; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 2, ADDITIONAL: 0

&#59;&#59; QUESTION SECTION:
&#59;www.slackware.com.		IN	A

&#59;&#59; ANSWER SECTION:
www.slackware.com.	86400	IN	CNAME	slackware.com.
slackware.com.		86400	IN	A	64.57.102.34

&#59;&#59; AUTHORITY SECTION:
slackware.com.		86400	IN	NS	ns2.cwo.com.
slackware.com.		86400	IN	NS	ns1.cwo.com.

&#59;&#59; Query time: 348 msec
&#59;&#59; SERVER: 207.69.188.185#53(207.69.188.185)
&#59;&#59; WHEN: Sat Jul  3 16:25:10 2010
&#59;&#59; MSG SIZE  rcvd: 105

</screen>

<para>
Let's take a took at the command-line options used above.  The
<arg>@207.69.188.185</arg> argument tells
<application>dig</application> what DNS server to query. If it is not
specified, <application>dig</application> will simply use whatever
servers are listed in <filename>&#47;etc&#47;resolv.conf</filename>.  The
<arg>a</arg> argument at the end is the type of DNS record to lookup.
In this case we looked for an "A" record which returned an IPv4 address.
</para>

</section>

<section id="network-utils_finger">
<title>finger</title>

<para>
<application>finger</application>(1) isn't exactly a network diagnostic
tool as much as it is a network-user diagnostic tool. Using
<application>finger</application>, you can gather a handful of useful
information about users on servers running the
<application>fingerd</application>(8) daemon. Today very few servers
still offer <application>fingerd</application>, but for those that do
it can be a useful tool for keeping track of your friends and
co-workers.
</para>

<screen><prompt>darkstar:~&#35; </prompt><userinput>finger alan@cardinal.lizella.net</userinput>
[cardinal.lizella.net]
Login: alan           			Name: Alan Hicks
Directory: &#47;home&#47;alan               	Shell: &#47;bin&#47;bash
Office: 478 808 9919, 478 935 8133
On since Wed Apr 13 17:43 (UTC) on pts&#47;9 from
75-150-12-113-atlanta.hfc.comcastbusiness.net
    32 minutes 24 seconds idle
     (messages off)
On since Wed Apr 13 17:45 (UTC) on pts&#47;10 from :pts/9:S.0
   48 minutes 56 seconds idle
Mail forwarded to alan@lizella.net
No mail.
No Plan.
</screen>

</section>

</section>

<section id="network-utils_web-browsers">
  <title>Web Browsers</title>

<para>
Slackware includes a variety of web browsers. If you're using a
graphical desktop, you'll find <application>Firefox</application>,
<application>Seamonkey</application>, and others you may already be
familiar with, but what about console access? Fortunately, there are a
number of capable web browsers here as well.
</para>

<section id="network-utils_lynx">
  <title>lynx</title>

<para>
The oldest console-based web browser included with Slackware is
definitely <application>lynx</application>(1), a very capable if
somewhat limited web browser.  <application>lynx</application> does not
support frames, javascript, or pictures; it is strictly a text web
browser. Navigation is performed using your keyboard's arrow keys and
optionally, a mouse. While it lacks many features that other browsers
support, <application>lynx</application> is one of the fastest web
browsers you'll ever use for gathering information. For example, the
<arg>-dump</arg> argument sends the formatted web page directly to the
console, which can then be piped to other programs.
</para>

<imagedata fileref="img/lynx.png" format="PNG"/>

</section>

<section id="network-utils_links">
<title>links</title>

<para>
A more feature-rich alternative is the popular
<application>links</application>(1), a console-based web browser that
supports frames and has better table rendering than
<application>lynx</application>. Like its predecessor,
<application>links</application> is navigable with the arrow keys, and
the use of a mouse is supported.  Unlike
<application>lynx</application>, it also includes a handy menu (simply
click on the top line with your mouse to activate) and generally
formats web pages better.
</para>

<imagedata fileref="img/links.png" format="PNG"/>

</section>

<section id="network-utils_wget">
  <title>wget</title>

<para>
Unlike the other browsers we've looked at,
<application>wget</application>(1) is non-interactive. Rather than display
HTTP content, <application>wget</application> downloads it. This takes
the "browsing" out of the web browser. Unlike the dump modes of other
browsers, <application>wget</application> does not format its
downloads; rather it copies the content in its exact form on the web
server with all tags and binary data in place. It also supports several
recursive options that can effectively mirror online content to your
local computer.  <application>wget</application> need not operate
exclusively on HTTP content; it also supports FTP and several other
protocols.
</para>

<screen><prompt>darkstar:~&#35; </prompt><userinput>wget ftp:&#47;&#47;ftp.osuosl.org&#47;pub&#47;slackware&#47;slackware-current&#47;ChangeLog.txt</userinput>
--2010-05-01 13:51:19--
ftp:&#47;&#47;ftp.osuosl.org&#47;pub&#47;slackware&#47;slackware-current&#47;ChangeLog.txt
           =&#62; `ChangeLog.txt'
Resolving ftp.osuosl.org... 64.50.236.52
Connecting to ftp.osuosl.org|64.50.236.52|:21... connected.
Logging in as anonymous ... Logged in!
==&#62; SYST ... done.    ==&#62; PWD ... done.
==&#62; TYPE I ... done.  ==&#62; CWD &#47;pub&#47;slackware&#47;slackware-current ...  done.
==&#62; SIZE ChangeLog.txt ... 75306
==&#62; PASV ... done.    ==&#62; RETR ChangeLog.txt ... done.
Length: 75306 (74K)

100%[======================================&#62;] 75,306       110K/s   in 0.7s    

2010-05-01 13:51:22 (110 KB/s) - `ChangeLog.txt' saved [75306]
</screen>

</section>

</section>

<section id="network-utils_mail-clients">
<title>Mail Clients</title>

<para>
Slackware also includes a variety of email clients. If you're using a
graphical desktop, you'll find <application>Thunderbird</application>,
<application>Kmail</application>, <application>sylpheed</application>
and others. As with web browsers, there are also applications that
function within the shell. Once you start using an email client in the
console, you may find yourself not wanting to use anything else; the
flexibility and configurability can be addicting.
</para>

<section id="network-utils_pine">
<title>pine</title>

<para>
<application>pine</application> is one of the oldest command-line
interface mail clients still in existance and remains one of the most
user-friendly. <application>pine</application> was created by the
University of Washington and carries with it both a trademark and a
copyright license that are difficult to work with. Thankfully back in
2005, the university saw fit to re-write it without the trademark and
with a more open license, so <application>alpine</application>(1), the
pine-clone distributed with Slackware, was born.
</para>

<para>
To start using <application>alpine</application>,
simply type <application>pine</application> at the command line.
Using it is very simple due to its menu-driven system as well as the
command reference neatly located at the bottom of the screen. See for
yourself&#58;
</para>

<screen>
  ALPINE 2.00   MAIN MENU              Folder: INBOX               No
Messages  


          ?     HELP               -  Get help using Alpine           

          C     COMPOSE MESSAGE    -  Compose and send a message      

          I     MESSAGE INDEX      -  View messages in current folder 

          L     FOLDER LIST        -  Select a folder to view         

          A     ADDRESS BOOK       -  Update address book             

          S     SETUP              -  Configure Alpine Options        

          Q     QUIT               -  Leave the Alpine program        


                  Copyright 2006-2008 University of Washington
                    [Folder "INBOX" opened with 0 messages]
? Help                     P PrevCmd                 R RelNotes                 
O OTHER CMDS > [ListFldrs] N NextCmd                 K KBLock                  
</screen>

 <para>
   Before configuring any mail client, you should check the
   documentation of your mail server to gather all of the pertinent
   information about what protocols and security measures your mail
   service uses. This will help you configure
   <application>pine</application> correctly.
</para>

 <para>
   To start configuring <application>pine</application>, you should be
   able to enter the [S]ettings menu, and then the [C]onfig
   screen. There are about a hundred different options, but the most
   common and most important ones would be your Personal Name, Inbox
   Path, and SMTP Server.
</para>

<variablelist>
  <title>Pine Settings</title>

  <varlistentry>
    <term>
      Personal Name
    </term>
    <listitem>
      <para>
	The name you wish people to see in the "From" field of your
	emails.
    </para>
  </listitem>
  </varlistentry>

  <varlistentry>
    <term>
      Inbox Path
    </term>

    <listitem>
      <para>
	Your mail server.  The server itself is often something like
	mail.example.com (although it may not be; check with your
	host to be sure), but if that server requires login information then you
	may need to set it to something like bob@mail.example.com
	or similar.
      </para>
    </listitem>
  </varlistentry>

  <varlistentry>
    <term>SMTP Server</term>
    <listitem>
      <para>
	The server through which you will send your email; often this
	is smtp.example.com or outgoing.example.com or some variation
	on that theme.  It often requires authentication, but you
	should be prompted for this in
	<application>pine</application> when sending mail.
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
  A sample configuration might look a little something like this:
</para>

<table>
  <title>Sample Pine Configuration</title>
  <tgroup cols="2">
    <tbody>
      <row>
	<entry>Personal Name</entry>
	<entry>Alan Hicks</entry>
      </row>
      <row>
	<entry>SMTP Server</entry>
	<entry>smtp.lizella.net</entry>
      </row>
      <row>
	<entry>Inbox Path</entry>
	<entry>{imap.lizella.net/user=alan@lizella.net}inbox</entry>
      </row>
      <row>
	<entry>Warn if Blank Subject</entry>
	<entry>X</entry>
      </row>
      <row>
	<entry>Sort Key: Arrival</entry>
	<entry>X</entry>
      </row>
    </tbody>
  </tgroup>
</table>

<para>
  And so on.  Once you have it configured according to your mail
  server&#39;s settings, you will be able to navigate the application from
  the main menu.  It&#39;s quite intuitive, with a persistent list of
  keyboard shortcuts at the bottom of the screen.
</para>

</section>

<section id="network-utils_mutt">
  <title>mutt</title>

<para>
Some people don't like <application>pine</application>. Some people
want more control. Some people want a fully-configurable mail client
with plugin support and a no-nonsense attitude. Those people use
<application>mutt</application>(1). <application>mutt</application>
isn't as user friendly as <application>pine</application>, but makes up
for it with power. You won't find the user-friendly command reference
at the bottom of the screen, <application>mutt</application> uses every
last inch of real-estate for mail processing duty. It's feature support
is extensive: threaded displays are no problem for the mighty
mixed-breed! You can configure <application>mutt</application> with a
<filename>.muttrc</filename> file in your home directory. With all the
many different possible configuration options, there's even a man page
for that, muttrc(5). You might want to read up on it.
</para>

<screen>
3172 N   Jan 17 Thomas Morper   (2.8K)     │ └─>Re: [Slackbuilds-users] Exim Sbo
3173 N   Jan 17 TuxaneMedia     (2.5K)     └─>Re: [Slackbuilds-users] Exim Sbo
3174 N   Jan 06 Uli Sch?fer     (4.6K) [Slackbuilds-users] mrtg-2.15.2 breaks wi
3175 N   Jan 06 Willy Sudiarto  (4.0K) └─>
3176 N   Jan 06 Audrius Ka??uka (3.9K)   └─>
3177 N   Jan 06 Niels Horn      (4.4K)     └─>
3178 N * Jan 09 King Beowulf    (6.5K) [Slackbuilds-users]  libreoffice (3.3.0rc
3179 N * Jan 09 Niels Horn      (4.8K) └─>Re: [Slackbuilds-users] libreoffice (3
3180   * Jan 09 Niels Horn      (  73)   └─>                                    
3181 N * Jan 09 King Beowulf    (5.9K)     └─>
3182 N   Jan 10 Robby Workman   (7.8K) [Slackbuilds-users] Updates - 20110110
3183 N   Jan 10 B Watson        (3.6K) [Slackbuilds-users] Fwd: nted slackbuild
3184 N   Jan 11 SlackBuilds@cat (2.5K) [Slackbuilds-users] /usr/share/ package s
3185 N   Jan 11 Robby Workman   (3.4K) └─>
3186 N   Jan 12 SlackBuilds@cat (3.4K)   └─>
3187 N   Jan 11 Robby Workman   (4.5K)     └─>
3188 D   Jan 12 Klaatu          (3.5K) [Slackbuilds-users] LiVES updates
3189 N   Jan 12 Robby Workman   (2.3K) [Slackbuilds-users] Unavailability of mai
3190 N   Jan 13 Mr. B-o-B       (3.7K) └─>
3191 N   Jan 13 Josiah Boothby  (3.2K) [Slackbuilds-users] Ted's Word Processor
3192 N   Jan 14 Adam Swift      (7.4K) [Slackbuilds-users] Web submission failur
3193 N   Jan 14 Rob McGee       (3.5K) └─>
</screen>

<para>
  Using <application>mutt</application> is unique because it is by
  nature a Mail User Agent (MUA), meaning its true purpose is to read
  and sort email. This was its only job originally, although some
  additional features such as retrieving mail via POP3 and even very
  basic transfering messages via SMTP have snuck into the application.
</para>

<para>
  As is so often the case with robust console-based applications, the
  configuration options are myriad, and there is no &#34;right&#34; or
  &#34;wrong&#34; way of using <application>mutt</application> as long
  as it does what you want it to do. Here is a simple example of a
  system utilizing <application>mutt</application>, with a toolchain
  consisting of:
</para>

<itemizedlist>
  <listitem>
    <para>
      <application>fetchmail</application> to pull mail from your mail server
      via POP3
    </para>
</listitem>

  <listitem>
    <para>
      <application>procmail</application> to sort the mail as needed.
  </para>
  </listitem>

  <listitem>
    <para>
      <application>mutt</application> to read, sort, and send email.
    </para>
</listitem>

  <listitem>
    <para>
      Optionally, <command>formail</command> to re-format your mail if needed
      &#40;depending on your mail server settings&#41;
    </para>
</listitem>
</itemizedlist>

<para>
  <application>fetchmail</application> is a simple application that exists
  only to pull mail from mail servers and copy those email messages to
  your local hard drive.  The configuration is fairly simple:
</para>

<screen>
  <prompt>darkstar:~&#36; </prompt> cat ~&#47;.fetchmailrc
poll pop.example.com with proto pop3
  user "bob@example.com" there has password "secretpassword" is bdobbs here and wants mds "/usr/bin/procmail"
</screen>

<variablelist>
<title>Fetchmail Configuration Explained</title>    

<varlistentry>
  <term>poll</term>
  <listitem>
    <para>
      Defines the mail server to check
    </para>
  </listitem>
</varlistentry>

<varlistentry>
  <term>with proto</term>
  <listitem>
    <para>
      Defines the protocol used; in this case, POP3.
  </para>
  </listitem>
</varlistentry>

<varlistentry>
  <term>user</term>
  <listitem>
    <para>
      Your email username. Sometimes this is just the string in front
      of the @ at symbol, othertimes it is your whole email address.
      Again, see your provider&#39;s documentation to find out what
      you should be using.
    </para>
  </listitem>
</varlistentry>

<varlistentry>
  <term>there has password</term>

  <listitem>
    <para>
      Your email password.  This is entered as plaintext into your
      config file, but since this is in your home directory, it is only
      readable by you. For good measure though, it is safe to 
      <prompt> chmod 0600 ~/.fetchmailrc </prompt>
    </para>
  </listitem>
</varlistentry>

<varlistentry>
  <term>is username here</term>
  <listitem>
    <para>
      Defines which user on your local computer this email account
      actually belongs to.  For instance, if my email account is
      bob@example.com, but my username on my Slackware box
      is bdobbs, then obviously there would be no way for
      <application>fetchmail</application> to know who
      bob@example.com is.  This defines it.
    </para>
  </listitem>
</varlistentry>

<varlistentry>
  <term>and wants mda &#34;&#47;usr&#47;bin&#47;procmail&#34;</term>

  <listitem>
    <para>
      Tells <application>fetchmail</application> what application will
      be sorting the email once it is pulled from the mail server.
      <application>Procmail</application> ships with Slackware, so this
      will probably not change for you and is not dependent upon your
      mail server whatsoever.
    </para>
  </listitem>
</varlistentry>
</variablelist>

<para>
  Now that <application>fetchmail</application> is configured, it will
  successfully pull your email from the server.  But what will your
  computer do with all of that mail?  This is the job of
  <application>procmail</application>.
</para>

<para>
  The settings for <application>procmail</application> can be stored
  in ~&#47;.procmailrc and is also fairly simple; for example:
</para>

<screen>
    PATH=/usr/bin
    MAILDIR=$HOME/Mail
    DEFAULT=$MAILDIR/Inbox
    LOGFILE=$MAILDIR/logs
</screen>

<para>
  Now <application>procmail</application> is configured, so your mail
  will be sent to the right place.  There is much more you can do with
  <application>procmail</application> so feel free to investigate its
  many filtering functions (or &#34;recipes&#34;) later, once you have
  everything working.
</para>

<para>
  At this point, your email will be pulled from the server by
  <application>fetchmail</application> and sorted on your local system
  by way of <application>procmail</application>.  All that's left to
  do is to configure <application>mutt</application> so that it knows where to
  find your email messages so that you can view them.
</para>

<para>
  Because <application>mutt</application> is such an extensible program, it&#39;s
  a good idea to make a folder for its configuration file.  Your
  initial configuration will be frightfully simple, but if you ever
  look for new configurations of mutt you might be happy to have a
  whole folder to play around in.
</para>

  <screen>
    <prompt>darkstar:~&#36; </prompt> <command>cat</command> ~&#47;.mutt&#47;.muttrc
    set realname=&#34;Bob Dobbs&#34;
    set from=&#34;bob@example.com&#34;
    set spoolfile=&#47;home&#47;bdobbs&#47;Mail&#47;Inbox
    set mbox=&#47;home&#47;bdobbs&#47;Mail&#47;mbox
    set record=&#47;home&#47;bdobbs&#47;Mail&#47;sent
    set postponed=&#47;home&#47;bdobbs&#47;Mail&#47;postponed
    set sort=reverse-date
    set editor=emacs
    set smtp_url=&#34;smtp:&#47;&#47;bob:secretpassword@smtp.example.com:465&#34;
  </screen>

<para>
  In this sample configuration, the <varname>spoolfile</varname>
  defines the incoming messages that you have not read yet &#40;you
  might recognize it as the end destination for
  <application>procmail</application>&#41;, while <varname>mbox</varname>
  defines where mail that you have read and responded to will be
  stored. All other settings are self-explanatory, and all have been
  drawn directly from the muttrc man page; refer to it for more options.
</para>

<note>
<para>
  If your mail server delivers your email in a format that
  <command>mutt</command> cannot understand, use the
  <application>formail</application> mailbox converter, a part of the
  <application>procmail</application> distribution. For example:
</para>

<screen>
  <prompt>darkstar:~&#36; </prompt> formail -ds &lt; ~&#47;Mail&#47;Inbox &#62;&#62; ~&#47;Mail&#47;Muttbox
  </screen>

  <para>
    Rather than performing this conversion every time you check your
    email, you might want to script it to happen automatically after
    procmail is finished its job.
  </para>
</note>

<para>
  The commands used to navigate around in <application>mutt</application> are highly
  customizable but the defaults can be listed by typing
  <keycap>?</keycap>.
</para>

<section id="network-utils_ssl">
  <title>Adding SSL Support</title>

  <para>
    If your mail server supports SSL then you can and should use SSL
    for better security. Most graphical clients have common SSL
    certificates built into them; <application>mutt</application> does
    not but it's trivial to configure.
  </para>

  <para>
    Download an SSL trust certificate &#40;the most common set is from
    Thawte&#41; and place it in your Mutt or Mail folder, and list it
    as a <varname>certificate_file</varname> in your
    <filename>.muttrc</filename> file.  If your mail server is not using
    Thawte, then they may be using either another SSL certificate
    authority or they may be their own certificate authority, but
    if an unknown certificate is encountered,
    <application>mutt</application> will prompt you to accept it (or
    not). If you do accept it, the certificate can be saved into
    this certificate file.
  </para>

  <para>
    To obtain the Thawte certificate:
  </para>

  <screen>
    bash$ wget
    http://www.thawte.com/roots/thawte_Premium_Server_CA.pem -P
    ~/Mail/
  </screen>

</section> <!-- closing SSL --> 

</section> <!-- closing mutt -->

<section id="network-utils_mailx">
  <title>mailx</title>

<para>
So those are great and everything, but what if you just want a mail
client that isn't menu-driven? Thankfully
<application>mailx</application> is here to save you. 
</para>

<para>
  <application>mailx</application> is based on the Berkeley Mail
  application, with a <application>mail</application> command
  appearing as early as Version 1 of AT&#38;T&#39;s UNIX. It can be
  used either interactively or non-interactively.
</para>

<para>
  To launch <application>mailx</application>, type
  <command>mail</command> at a shell prompt.
  <application>mailx</application> reads mail from your computer's
  mail spool and displays the usual combination of sender, subject,
  status, and size in a list, leaving the user at an interactive
  prompt. In fact, it might look familiar to you if you bothered
  checking your mail immediately after installing Slackware and read
  Pat Volkerding's greeting.
</para>

<screen>
root@darkstar:&#47;home&#47;bdobbs&#35; mail
Heirloom mailx version 12.4 7&#47;29&#47;08.  Type ? for help.
"&#47;var&#47;spool&#47;mail&#47;root": 2 messages 2 new
&#62;N  1 To root            Thu Mar 10 23:33   52&#47;1902  Register with the Linux counter project
 N  2 To root            Thu Mar 10 23:35  321&#47;15417 Welcome to Linux (Slackware 13.37)!
&#63;
</screen>

<para>
  To read a message, enter the number of the message at the
  prompt. This displays the message using
  <application>more</application>, so use the <keycap>RETURN</keycap>
  key to view the next page. Once the end of the message has been
  reached, press <keycap>q</keycap> to return to the list view, or
  <keycap>RETURN</keycap> to continue to the next message.
</para>

<para>
  To see a list of available commands, type &#63; at the
  <application>mail</application> prompt; using the commands provided,
  you can view the headers of mail in the spool, reply, delete, save,
  and many other common email tasks.
</para>

<para>
  <application>mailx</application> is most powerful when used in
  scripting. For all of the options available for
  <application>mailx</application>, view its man page. A simple way to
  send an email to someone requires only the command itself and the
  destination address&#58;
</para>

<screen>
  <prompt>darkstar:~&#36; </prompt> <command>mail</command>
  alan@lizella.net
</screen>

<para>
  After the command has been issued, an interactive prompt appears for
  a subject line, the message body, and the end character (a single
  dot on an otherwise empty line).
</para>

<para>
  <application>mailx</application> can be used entirely without human
  intervention, however. Generally, it's safe to assume that any
  attribute you can define in the interactive shell for
  <application>mailx</application> can also be defined while scripting
  it or using it as one non-interactive command&#58;
</para>

<screen>
  <prompt>darkstar:~&#36; </prompt> <command>mail</command> -n -s "Test message" alan@lizella.net &#60; ~&#47;message.txt
</screen>

<para>
  In this example, the contents of the file
  <filename>message.txt</filename> would be sent as the message body
  to the specified recipient. No interaction from the user is required.
</para>

<para>
  Within one's own computer (localhost) or one's own network, sending
  email in this manner is entirely possible. But over the internet a
  few more steps are usually required along the way. Of course, most
  notably there is usually an smtp server handling the delivery of your
  email. This, too, can be specified as part of your
  <application>mail</application> command&#58;
</para>

<screen>
  <prompt>darkstar:~&#36; </prompt> env MAILRC=&#47;dev&#47;null
  from="bob@example.com (Bob Dobbs)"
  smtp=relay.example.com <command>mail</command> -n -s "Test message" connie@example.com &#60; ~&#47;message.txt
</screen>

<para>
  In this case, the <varname>MAILRC</varname> variable is set to
  &#47;dev&#47;null in order to override any system defaults, and the
  smtp server as well as the <parameter>FROM&#58;</parameter> line are
  defined. The rest of the command is the same as using
  <application>mailx</application> internally within one's own
  computer or network.
</para>

<para>
  Over all, <application>mailx</application> is usually viewed as a
  mail client with the bare-minimum features; this is largely true,
  but when you need to be able to script sending notification emails
  or important update messages, it quickly becomes a lot more valuable
  than a fully interactive application like
  <application>pine</application> or <application>mutt</application>.
</para>

</section>

</section>

<section id="network-utils_ftp">
<title>FTP Clients</title>

<para>
Lots of data is stored on FTP servers the world over. In fact,
Slackware Linux was first publically offered via FTP and continues to
be distributed in this fashion today. Most open source software can be
downloaded in source code or binary form via FTP, so knowing how to
retrieve this information is a handy skill.
</para>

<section id="network-utils_bsd-ftp">
<title>ftp</title>

<para>
The simplest FTP client included with Slackware is named simply,
<application>ftp</application>(1) and is a reliable if somewhat simple
means of sending and retrieving data. <application>ftp</application>
connects to an FTP server, asks for your username and password, and
then allows you to put or get data to and from that server.
<application>ftp</application> has fallen out of favor with more
experienced users do to a lack of features, but remains a handy tool,
and much of the documentation you see online will refer you to it.
</para>

<para>
Once an FTP session has been initialized, you'll be placed at a prompt
somewhat like a shell.  From here you can change and list directories
using the "cd" and "ls" commands, just like a shell.  Additionally, you
may issue the "put" command to send a file to the server, or a "get"
command to retrieve data from the server. If you're connecting to a
public FTP server, you'll want to use the "anonymous" username and
simply enter your e-mail address (or a fake one) for the password.
</para>

<screen><prompt>darkstar:~# </prompt><userinput>ftp ftp.osuosl.org</userinput>
Name (ftp.osuosl.org:alan): <userinput>anonymous</userinput>
331 Please specify the password.
Password: <userinput>secret</userinput>
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> <userinput>cd pub/slackware/slackware-current/</userinput>
250 Directory successfully changed.
ftp> <userinput>get ChangeLog.txt</userinput>
local: ChangeLog.txt remote: ChangeLog.txt
200 PORT command successful. Consider using PASV.
150 Opening BINARY mode data connection for ChangeLog.txt (33967
bytes).
226 File send OK.
33967 bytes received in 0.351 secs (94 Kbytes/sec)
ftp> <userinput>bye</userinput>
221 Goodbye.
</screen>

</section>

<section id="network-utils_ncftp">
<title>ncftp</title>

<para>
<application>ncftp</application>(1) (pronounced nick-f-t-p), is a more
feature rich successor to <application>ftp</application>, supporting
tab completion and recursive retrieval. It automatically connects to a
server as the anonymous user, unless you specify a different username
on the commandline with the <arg>-u</arg> argument. The primary
advantage over <application>ftp</application> is the ability to send
and retrieve multiple files at once with the "mput" and "mget"
commands. If you pass the <arg>-R</arg> argument to either of them,
they will recursively put or get data from directories.
</para>

<screen><prompt>darkstar:~# </prompt><userinput>ncftp ftp.osuosl.org</userinput>
Logging in...                                                                   
Login successful.
Logged in to ftp.osuosl.org.                                                    
ncftp / > <userinput>cd pub/slackware/slackware-current</userinput>
Directory successfully changed.
ncftp ...ware/slackware-current > <userinput>mget -R isolinux</userinput>
isolinux/README.TXT:                                     4.63 kB 16.77 kB/s  
isolinux/README_SPLIT.TXT:                             788.00 B    5.43 kB/s  
isolinux/f2.txt:                                       793.00 B    5.68 kB/s  
isolinux/initrd.img:                                    13.75 MB 837.91 kB/s  
isolinux/iso.sort:                                      50.00 B  354.50 B/s   
isolinux/isolinux.bin:                                  14.00 kB 33.99 kB/s  
isolinux/isolinux.cfg:                                 487.00 B    3.30 kB/s  
isolinux/message.txt:                                  760.00 B    5.32 kB/s  
isolinux/setpkg:                                         2.76 kB 19.11 kB/s  
ncftp ...ware/slackware-current > <userinput>bye</userinput>
</screen>

</section>

<section id="network-utils_lftp">
<title>lftp</title>

<para>
The last client we're going to look at is
<application>lftp</application>(1).  Like
<application>ncftp</application>, it supports tab completion and
recursive activity, but has a more friendly license.  Rather than user
"mget" and "mput", all recursive operations are handled with the
"mirror" command.  "mirror" has many different options available, so
I'll have to refer you to the man page and the built-in "help" command
for complete details.
</para>

<screen><prompt>darkstar:~# </prompt><userinput>lftp ftp.osuosl.org</userinput>
lftp ftp.osuosl.org:~> <userinput>cd /pub/slackware/slackware-current</userinput>
cd ok, cwd=/pub/slackware/slackware-current            
lftp ftp.osuosl.org:/pub/slackware/slackware-current> <userinput>mirror isolinux</userinput>
Total: 2 directories, 16 files, 1 symlink                                      
New: 16 files, 1 symlink
14636789 bytes transferred in 20 seconds (703.7K/s)
lftp ftp.osuosl.org:/pub/slackware/slackware-current> <userinput>bye</userinput>
</screen>

</section>

</section>

<section id="network-utils_rsync">
<title>rsync</title>

<para>
Ready to see something cool? Have you ever found yourself needing just
a handful of files from a large directory, but you're not entirely sure
which files you already have and which ones you need? You can download
the entire directory again, but that's duplicating a lot of work. You
can pick and chose, manually check everything, but that's very tedious.
Perhaps you've downloaded a large file such as an ISO, but something
went wrong with the download? It doesn't make sense that you should
have to pull down the entire file again if only a few bits have been
corrupted.  Enter <application>rsync</application>(1), a fast and
versatile copying tool for local and remote files.
</para>

<para>
<application>rsync</application> uses a handful of simple, but very
effective techniques to determine what needs to be changed. By checking
file size and time stamps, it can determine if two files are different.
If something has changed, it can determine what bytes are different,
and simply download that handfull of data rather than an entire file.
It is truly a marvel of modern technology.
</para>

<para>
In its simplist form, <application>rsync</application> connects to an
rsync protocol server and downloads a list of files and directories,
along with their sizes, timestamps, and other information. It then
compares this to the local files (if any) to determine what it needs to
transfer. Only files that are different will be synced.  Additionally,
it breaks up large files into smaller chunks and compares those chunks
using a quick and simple hash function. Any chunks that match are not
transferred, so the amount of data that must be copied can be
dramatically reduced.  <application>rsync</application> also supports
compression, verbose output, file deletion, permission handling, and
many other options. For a complete list, you'll need to refer to the
man page, but I've included a small table of some of the more common
options.
</para>

<table pgwide="0">
<title>rsync Arguments</title>
<tgroup cols="2">
  <thead>
    <entry>Argument</entry>
    <entry>Explaination</entry>
  </thead>
  <tbody>
    <row>
      <entry>-v</entry>
      <entry>Increased verbosity</entry>
    </row>
    <row>
      <entry>-c</entry>
      <entry>Checksum all files rather than relying on file size and timestamp</entry>
    </row>
    <row>
      <entry>-a</entry>
      <entry>Archive mode (equivilant to -rlptgoD)</entry>
    </row>
    <row>
      <entry>-e</entry>
      <entry>Specify a remote shell to use</entry>
    </row>
    <row>
      <entry>-r</entry>
      <entry>Recursive mode</entry>
    </row>
    <row>
      <entry>-u</entry>
      <entry>Update - skip files that are newer on the receiving end</entry>
    </row>
    <row>
      <entry>-p</entry>
      <entry>Preserve permissions</entry>
    </row>
    <row>
      <entry>-n</entry>
      <entry>Dry-run - perform a trial run without making any changes</entry>
    </row>
    <row>
      <entry>-z</entry>
      <entry>Compress - handy for slow network connections</entry>
    </row>
  </tbody>
</tgroup>
</table>

<para>
Due to the power and versatility of <application>rsync</application>,
it can be invoked in a number of ways.  The following two examples
connect to an rsync protocol server to retrieve some information and to
another server via ssh to encrypt the transmission.
</para>

<screen><prompt>darkstar:~# </prompt><userinput>rsync -avz rsync://ftp.osuosl.org/pub/slackware/slackware-current/ \
/src/slackware-current/</userinput>
<prompt>darkstar:~# </prompt><userinput>rsync -e ssh ftp.slackware.com:/home/alan/foo /tmp/foo</userinput>
</screen>

</section>

</chapter>