Introduction
There is no easy path to understanding TCP/IP network communication. Experienced system programmers spend hours each year tuning and improving the basic communication protocols that connect the internet. IT administrators spend thousands of hours configuring hosts, servers, switches, routers, and optimizing network architecture to maximize network throughput. Many of us who simply use applications and programming languages don't dig to deeply into these areas. However, TCP/IP communication makes everything work. Without imbibing some understanding and network troubleshooting techniques, your career as a JavaScript programmer will suffer frustration. As a programmer or IT administrator, you really can't get TCP/IP network administration without using administrative commands from the shell. Graphical suites that help troubleshoot network connectivity are not always available and sometimes they provide more information than needed. The official internet
STDs and RFCs represent an authoritative starting point for greater understanding of TCP/IP; but the internet is awash in tutorials on these subjects. I recommend finding something authoritative.
JavaScript provides functionality to web clients. This makes some network administration and process management skillsets important. The instructions in this post will be abbreviated. The reader is recommended to additional sources of information for more detail. My examples use either OpenBSD 5.2. or Cygwin running on Windows 7. OpenBSD is a free UNIX that is secure and easy to install. Cygwin is a free UNIX emulation terminal that includes many but not all UNIX network commands. As you read this, think about how the commands below might help you test and deploy your JavaScript. In addition, as JavaScript functionality is essentially hosted on web servers, a study of network administration is the appropriate introduction for administrating Apache and other web servers and understanding how your JavaScript code will run or test under web load testing. I will include, as appropriate, as many Windows network administration analogs as possible. However, the reader is warned that additional Windows command line network administration tools such as Powershell and Netsh are covered in summary fashion here.
Commands and
arguments will be in bold. Screen examples and output will
print in blue. Choices will be [enclosed in brackets delineated by commas]. To complete this exercise, start an Xll Terminal on your MAC, UNIX, or Cygwin emulation. For Windows cmds, please start an administrative cmd sessions. If possible, it may be helpful to open multiple terminals or Xterms; one in which to practice the commands, the other in which to run man or info commands to further understand specific arguments. UNIX is at all times cap sensitive.
UNIX commands run under an Operating System shell whose opening prompt will be delineated by a character(s) like
#, $, or bash-. The presence of such a prompt means your are in that particular shell. Normally, you will recognize your shell type by the prompt. You can use the command
echo $SHELL to return the shell type. The
bash command will take you to a bash shell which is the most popular and powerful of administrative UNIX shells. Issuing
exit will leave your shell. To run the commands as a particular user, change to appropriate directory (e.g.
cd /home/rferrisx ), issue an
su username command and provide a password. The
whoami command will tell you what user you are logged in as. Some commands may require a login with administrative or root privileges to run successfully.
Some examples:
whoami
[root]
cd /home/rferrisx
su rferrisx
whoami
[rferrisx]
The command
clear will erase your screen. Your previously typed commands can be found by using the up or down arrows. The keystroke combination
CTRL-C will terminate most commands. Start an X11 Terminal. Lowercase
q will terminate pagination. Space and Enter advance pagination on a command by one screen or one line respectively. With all UNIX commands, the
less and
more commands can be appended and used to page through output. PageUp, PageDown, Enter,Space provide keystroke control pagination for long output. The size of the X11 font can usually be adjusted by holding down the CTRL key and right-clicking your mouse. The properties menu of the application control panel of a cmd or Powershell console provides for similar configuration.