 |
Command-line NT: It does exist!
Less featureful, less elegant -- but there
Apr 9, 1999
Summary
Do you need to remotely manage NT boxes from your Linux workstation? From native commands to Unix ports and from shells to daemons, you may be surprised how many Linux-like options you really have on NT. Gerald Carter stocks his command-line NT administration toolkit with free and commercial utilities in this month's There and Back Again. (3,400 words)

By Gerald Carter
Page 1 of 4
Suddenly another voice spoke, low and melodious, its sound an enchantment. Those who listened unwarily to that voice could seldom report the words that they heard; and if they did, they wondered, for little power remained in them. Mostly they remembered only that it was a delight to hear the voice speaking, all that it said seemed wise and reasonable, and desire awoke in them by swift agreement to seem wise themselves. --Description of the voice of Saruman in JRR Tolkien's The Two Towers
ne of the major complaints launched against Windows NT from an administrative viewpoint is that it has very weak command-line capabilities. When compared to Linux, this may be true. But Windows NT isn't as crippled as some people claim. Now, I'm not saying the Windows NT command interpreter cmd.exe competes with bash on any level. But there are some functional command-line tools available for Microsoft's premier operating system. Not many of them actually come from Redmond, though...
But that isn't important. By and large, what any administrator wants most are scripts and other features to automate his or her work. Since this is such a noble goal, there are actually many ways you can perform common tasks using console applications. With experience, you can wean yourself from the NT GUI and eventually get to the point where you will prefer using cmd.exe to Windows Explorer. Native command-line tools
First let's look at some of the tools with command-line capabilities that ship as part of the basic operating system. Rather than try to write a command reference section, what I've done is list some Windows NT commands and their functional equivalents under Linux. The functionality may not be an exact match -- for example, the Linux mount command and the NT net use command. However, the match will be close enough to illustrate the general idea.
| Table 1: Linux commands and their Windows NT equivalents |
Description |
Linux command |
Windows NT equivalent |
Mount a remote filesystem |
mount -t nfs bilbo:/export/home /home |
net use h: \\bilbo\users |
List user accounts on the local machine |
cat /etc/passwd |
net users |
List user accounts in the network database |
ypcat passwd.byname |
net users /domain |
List groups on the local machine |
cat /etc/group |
net localgroup |
List groups in the network database |
ypcat group.byname |
net group |
Create an exported share |
vi /etc/exports
killall rpc.mountd
/usr/sbin/rpc.mountd |
net share newshare=c:\export |
Stop/start a service or daemon |
Use the appropriate SystemV init script.
For example,
/etc/rc.d/rc3.d/S30nfs {start|stop} |
net [stop|start] Server |
Gather statistics on shared file service |
netstat or rpcinfo |
net statistics Server |
Synchronize with a remote time server |
use the xntp protocol |
net time \\bilbo /set /yes |
Schedule a job to execute at a some time in the future |
crontab -e
(or use the at command) |
at 10:00pm cmd.exe |
Change permissions on a file |
chmod 700 testfile # sets access perms
chown jerry testfile # set ownership
chgrp users testfile # set group ownership |
cacls testfile /p jerry:c |
Check the integrity of a filesystem |
fsck /usr |
chkdsk c: |
Compare the contents of two files |
diff file1 file2 |
fc file1 file2 |
Edit a text file |
vi file1.txt |
edit file1.txt |
While Table 1 isn't a complete list of all possible things that can be done from the command line with a vanilla NT installation, it does give us a place to start. In addition, Windows NT provides its own versions of:
ping
traceroute (called tracert.exe under NT)
ftp
netstat
route
arp
rsh, rcp, and rexec
One final command that I tend to use a lot under Windows NT is the ipconfig.exe command. This tool allows you to manually release and renew IP address and related information via DHCP. If you assign static IP settings, you can still use ipconfig.exe to view the assigned information without launching the network control panel GUI. It does not however, allow for the setting of static IP address information.
Next page > Page 1 Command-line NT: It does exist! Page 2 Ports of Unix tools Page 3 Windows NT Resource Kit Page 4 Administering remote Windows NT clients from the command line
Copyright © 1998-2003 LinuxWorld.com, an IDG Communications company.
|