cmd.exe for Linux zealots

[ Wednesday, 9 April 2008, Keyto ]

Rationalization (Latin: ratio) is a defense mechanism in which one explains unacceptable behaviors or feelings in a rational or logical manner, thus avoiding the true explanation of the behavior or feeling in question.

For instance: You wanted to buy a sports car, and your spouse wanted an estate. So you bought an estate, and now you are proving yourself that the estate is better.

My example : “You are have no skills in using the command line in Windows, so you are proving to yourself, that it is useless anyway”.


My goal, Dear Reader, is not to prove anyone, that Windows’ command-line features are identical to those of Linux. To be honest, this text does not aim to cover the Windows shell features, at all. It is not a goal, it is a measure. The goal is to present you with a few thoughts about “the human nature”, as would Agatha Christie say.

There are examples in this text. If it is not annotated differently, the Linux commands are executed in a Debian system, using bash. The Windows system means MS Windows XP Professional SP2 working in a MS Windows 2003 Server R2 managed network.

Part one : the command line

There is an opinion, not really wide-spread, but very popular amongst Linux zealots, that Windows command-line cannot compete with Linux one, by no means.

According to many Penguin-badged systems users, the Windows’ “black window” is only fit to execute basic, scarce and weak commands, is not fit for automation, and not fit at all for administering any remote system.

Look at any comments, even articles in any Open Source portal. It reads: “Linux’ command line is almighty, Windows’ is a loser”.

Well, there is a problem: the Windows server administrators do not know about it. Thus, they create sophisticated scripts which they use to perform administrative tasks in their local networks. So, how is it, with the “black window” and the human nature?

First of all, most of computer users catch on a specific superstition, which says, that Windows XP is a descendant of a simple and poor DOS.

This is as true as the “truth” that a human (homo sapiens) is a straight-line descendant of a chimpanzee.

The NT OS line has little in common with the rough 16-bit creature known as Disk Operating System, alone or equipped the Windows [1.x, 2.x, 3.x, 95, 98, ME] graphical shells.

Same age systems, which are NT 3.5 and Windows 95, come from two different worlds. The only thing they have in common is the interface and the name. Well, the real Linux-user should not be shallow, shouldn’t he?

Another superstition, worth mentioning, is that the average Linux administrator uses hundreds of sophisticated commands with thousands of options.

I think, that I won’t find many opponents if I claim, that over eighty percent of administrative tasks are done using no more than twenty percent of available commands.

For the purpose of this article I have tried to estimate the number of commands that I use in Linux and Windows systems. Regarding Linux, I can list around 250 commands, in Windows – around 200. (The rest is waits to be discovered in the documentation.) In both cases, for everyday work it is enough for me to use no more than 50.

There comes but a problem. The operating systems’ theory is a lot older than the personal computers, and both Windows and Linux creators knew it while working on their systems. The designers of both have not been reinventing the wheel – they knew in advance, what features they need to provide. The theory does not state, however, how these features should be implemented. One cannot compare both systems’ commands one-to-one, I mean. Let’s try it:

Linux Windows Comment
cp xcopy Copying
mv move Moving
mkdir mkdir Directory creation
grep findstr Finding a pattern in a file
cat type displaying a file
sort sort sorting a file
cd cd change directory
pwd cd (no parameters) show current directory
date date Show/set time
echo echo Print a line
ls dir List directory contents
ps tasklist Show tasks (processes)
kill taskkill Kill task
shutdown shutdown Turn off computer

Well, that was easy, sort of. Sort of, because – is findstr the same as grep or is Windows’ echo functionally equal to Linux’ echo? I don’t think so, but let’s go further.

Linux Windows Comment
ln fsutil hardlink create Create a hardlink
uptime systeminfo show system uptime

Yes, this is where it starts to get complicated. The first command features creating links. I drag your attention to the fact, that it is indeed possible to do in Windows.

In XP as shown above, there is no soft-link feature, which exists in UNIX-like systems, and is achieved using `ln -s`. It is just straight beyond the capability of the NTFS filesystem used in XP. The higher NTFS versions (Vista, Server >2003) do have this capability, though.

As shown, in Windows there is no command being a reflection of ln. We create links with a sub-command being a part of a bigger program.

The alleged reflection of uptime is a more sophisticated problem, and it shows perfectly, what I want to tell. Windows’ systeminfo is a command returning information on system state. The general system state. It returns the uptime, name, domain where it is attached to, system version together with patching information, machine model, memory information, swap file location and a few more meaningful lines, too.

One cannot tell, however, that systeminfo is a reflection of Linux’ commands of hostname, domainname, uname, free or uptime. Almost all of the ‘reflections’ give a bit more information than the systeminfo alone. In turn, it doesn’t mean, that Windows has no capability of providing the extended info…

Side note: “Windows domain” is not the same as “internet domain”, in case it is not obvious for someone. Windows’ Domains is a measure of implementing the local network administration – treating a set of networked workstations as one, transparently, as one entity.

Question: What system is it?

Let’s go back again to fsutil hardlink create. This command depicts in excellent way the Windows’ style of grouping easy commands together. When the UNIX-like systems are built with one problem – one command paradigm in mind, Windows has it reversed – one sophisticated command is to ensure a total solution. fsutil itself accommodates 11 sub-commands, each of them having own options. So we have, for example:

Command: What for ? Linux command:
fsutil file createnew new file touch
fsutil quota modify disk space assign quota
fsutil volume diskfree disk free space df
fsutil fsinfo drives available drives mount (no



fsutil volume dismount unmounting the volume umount

By the way. It is noteworthy, that most of Linux users have absolutely no idea, that NTFS has a feature of mounting partitions, just like Linux’ mount.

The NTFS partition doesn’t have to have a letter assigned at all, please note, by the way, how systeminfo shows the active boot device: for example, ‘\Device\HarddiskVolume1‘.

Similarly the system shows other partitions, which in Explorer’s window are usually displayed as “C:”, “D:”, “E:” and so on, indeed. There is no obstacles, however, to connect the partition to the main filesystem and it will be displayed by Explorer as a part of system partition.

To connect NTFS volumes one needs to use the command like diskpart assign mount=path. The diskpart command is even more sophisticated than the aforementioned fsutil, more complicated and a non-familiar user might easily break his system with it, so we won’t go on describing it to save your life.

Windows contains more of similar kind of “combos”. One of them, largely known, is the net command. While fsutil had 11 sub-commands, net has 22 of them. This command must have been named so to distract the enemy, allegedly, because it can be used even if no network cable is connected to your computer. You can manage services with it ( net start, net stop, or net pause), manage users’ accounts (net accounts, net user), synchronize the computers’ clock (net time) and, of course, manage the remote access to individual machines ( for which you actually need a network cable (or another medium)).

For example, an executable, however a bit dangerous command of:

C:>net use B /user:administrator@B

will grant us practically full access to a remote machine named “B”. It will show handy in the third part of this article.

The Windows’ philosophy is so different, that sometimes one can get the info needed without invoking any commands at all. Examples ? In Linux we use the group of basename, dirname, pathchk commands. dirname is a command returning the sub-directory name when fed a full path. Handy when creating scripts. Under Windows one can extract the directory name alone, but in a bit different way. Let’s assume we have a script named skrypt.cmd which takes a full path as a parameter:

@echo off
echo %1
echo %~p1

Which we execute as follows:

C:>skrypt.cmd "C:\Documents and Settings\Skryba\Pulpit\file.txt"

and it yields:

"c:\Documents and Settings\Skryba\Pulpit\file.txt"
\Documents and Settings\Skryba\Pulpit\

Note the %~p1 part. The variables of scripts are named as follows: %1, %2, %3 and so on. The ~p in question is a modifier that enables extracting the directory name containing the file. Can we live without dirname command, then?

I think this is enough for now. My goal is not to copy the content of Windows help here. Yes, Ladies and Gentlemen. The standard publicly available help contains the description of a few hundred commands and sub-commands, which really do facilitate the management of file system, system services, users, security and all that one can call ‘system administration’. You only need to read (which I know causes problems to some). Of course the commands are not the same as in Linux. I’m not pretending, that working with them is same level of effectiveness as in e.g. Debian, but that it is possible in general. And speaking about Debian…

Part two : Linux your Windows.

If the main topic of this article was the Windows console (which it isn’t, to remind again), this part would not come at all. However, as this text is about users and their attitude to software, before we go on to the part, explaining the Windows way of working with networks, I allow myself to make a few observations.

Usually the remote management makes newbie admins sleepless. Common knowledge is, that Linux features ssh based access and one can perform all administrative tasks on a remote machine, by logging to it and using remote console.

Windows is commonly associated with the RDP protocol. Using the Connect to Remote Desktop program, using Remote Desktop Protocol, it is in fact possible to log in to a server or a client computer and go on administering. He, who tried the “art” of it, knows, that in practice we run into two problems at start. First of all, RDP is not always smooth, often it is a pain to work with it (if possible at all), second: how to restart a hundred of workstations (100) using this approach? (This is not an academic type of problem – similar things one needs to do, for example, for security reasons).

First of all however: the Linux way. Linux is a kernel. The kernel itself does not allow interactive work, not to mention remote. To be able to “type-in” the commands, one needs a shell, like bash, tcsh or zsh, which means just an appropriate program. Side note: cmd.exe which I talk around in this article, is not the only command interpreter in Windows. The much more powerful is e.g. MS PowerShell. I mention it to show that the choice is not only a feature of Linux. For the sake of this article, however, the standard programs are just enough.

Coming back from the side note – we’ve got the operating system, Linux with a shell. Is this enough? Of course, not. The basic program suite, like coreutils or the BusyBox program is essential. It will facilitate basic tasks. However, “there is no miracles”. In this configuration there is no network (yet) available, so remote management is impossible. To manage a Linux system via remote access, one needs additionally the software featuring network access and a program allowing ssh connections. (Well, a telnet can do as well, it’s a free world).

To summarize – the remote access is allowed by a special program, which is needed to be installed and configured. It is however worth pointing out, that an average Linux user can depict the process much more accurately, in portions, front-to-back and inside-out, but when it comes to Windows… This is the end. It is impossible, because WINDOWS has no feature like that. Hey, sorry, are the Slackware user complaining, that Patrick Volkerding in his legendary distribution does not include GNOME by default? Of course not. They know, that one needs to just get and install it, correct? Do the same users complain to Microsoft, that their system does not contain the sshd daemon? Yes, of course. This is a strange phenomenon. Because it is enough merely to install the appropriate program, to be able to work remotely with Windows similarly to how we work with Linux. There is even an open solution: OpenSSH, but who in hell cares…

cmd.exe running on Windows XP via Debian GNU/Linux terminal

To go come on track: this is no different situation to all the commands known to man, which one clearly knows, he needs to download, configure, even compile – for Linux, ’cause this is Free Software and it is our job to do it, nobody’s else.

When it comes to Windows, however, it goes from bad to worse, because Bill didn’t include vim, putty, md5sum or pine on the installation disk. Horrible.

Of course these, and many others, are available for Windows, but one needs to download them themselves; and I’ve got the impression, that for many people, downloading a trivial in action installer for Windows is not at all the same effort they make, for example, while downloading sources, configuring them, compiling, installing and configuring the program, for Linux. Because it cannot be.


Finishing this part, one remark on repositories. Yes, there are none for Windows. I wonder why. Regarding Debian, Fedora, openSUSE or Gentoo there was no miracle, just somebody organized this. It seems to have been a need, probably. In case of Windows there is a noteworthy situation: there is a few thousand Open Source programs for this system, but there is no repository. Now, come on, please, don’t say it’s impossible. Or, that there are some funds needed. It was possible to create all that software, was it? The application for administering the repository is just Yet Another Program, the rest is already done and waiting on the servers. And because the life hates the vacuum, such a program would be created for sure, which implies, that probably nobody simply needs it.

I know, that such a statement is rather uncomfortable for everyone here, but please, do try looking at it this way: to install a program, regardless if just double-clicking the program.msi icon, or using the apt-get install program command, one must know first what to install. Whenever we know “what”, it is not a big problem to “just” do it. I have noticed, that most of the new Linux users have not much use of the fact, that gstreamer libraries are in the repository. The problem is, one must know, that gstreamer exists at all and is needed. Of course, it would be handy to have a program browser, like synaptic or yum (which is not these programs’ main use, obviously). In, say, Ubuntu, we run synaptic, type in “internet browser”, find Firefox, mark it, click Install and there we go. In Windows ? No repository, so, say we use Wikipedia for a prank. We open, type in “Internet browser”, find Firefox, click the hyperlink to the homepage, download, install and … there we go. Is it so much different ? I suppose I know, you will say, it is…

I suppose, that repositories for Linux have not been created because they make the life simpler. I think, that they are rather natural a consequence to distribution partitioning. What, for example, is the gcc compiler for Linux? In reality, we have gcc optimized for Arch, Debian, Fedora, openSUSE, Ubuntu or ZenWalk. If they were to be placed on the FSF site, then – on one hand – it would have to grow by many, many links to the packages for particular distributions, on the other hand – managing the website would become a nightmare. Imagine a few hundred maintainers of the particular distributions, sending emails to FSF webmaster, asking for anything (changing the package, refreshing the mirror, etc.) The maintainers would have to manage a few hundred, or a few thousand, pages of different projects, where one would have to put software packages for their distributions. The situation, where everybody just cares for themselves only, is just easier to manage, and as the Linux-ish package manager caring for the dependencies… Oh well, this is not really a big issue in Windows. (That does NOT mean, there is no problems at all).

And another thing : yes, the global system update, like apt-get update is handy, but at the moment most applications (not only for Windows) check the availability of updates for themselves – then on the other hand, there are distributions with no update manager, on the other other hand – if we install in Linux a program, that doesn’t exist in the repository, the update manager won’t be able to update it – then on the other other other hand, Windows A.D. 2008 updates itself and the MS Applications at one click. (This is what one calls 5-dimensional timespace.)

Let’s go back to some more Windows commands.

Part three : Remote Windows

The way described earlier is not, what the engineers from Microsoft have designed. To rephrase, in Linux, working on “A” station, we log in through ssh (or telnet, it is (still) a free world) onto the “B” machine and type, e.g. ps. Windows has it totally different. First of all, for Microsoft systems,there is a special Windows Domain meaning. To cut a long story short : the domain is created by a group of computers managed by one of them, the domain controller. That machine manages users’ accounts, the controller provides us credentials and so on. It is not better nor worse than what we know from Linux-like systems. It is different. Of course, the computers do not have to belong to a domain, but I myself cannot imagine advanced managing of a few hundred computers without this invention. Oh well, I do, but not with Windows. In Windows it’s been designed that way.

So I sit in front of the aforementioned “A” box, featuring Windows. To display the list of tasks on “B” computer, also featuring Windows, I type in the following on the “A” computer:

C:> tasklist /s B /u administrator

Process name            PID Session name     Session no  RAM used

==================== ====== ================ ======== ============

System Idle Process       0                         0        16 KB

System                    4                         0       208 KB

smss.exe                456                         0        56 KB

csrss.exe               504                         0     3 912 KB

winlogon.exe            528                         0     4 492 KB

services.exe            572                         0     2 120 KB

lsass.exe               584                         0     3 488 KB

svchost.exe             784                         0     2 428 KB

svchost.exe             852                         0     6 308 KB

svchost.exe             916                         0    21 260 KB

Note two facts, please. First, as I mentioned, Windows treats the network a little bit different than Linux, which implies the change of the work principle – controlling one station, we have a potential to control all the others. Second: as in all systems, in Windows you need to have appropriate rights. One cannot just execute the above command, if he doesn’t have the appropriate rights on the “B” computer, and many times – on the domain controller.

Similarly one is able to use many commands, e.g. taskkill, shutdown, systeminfo, or the simple dir, like that. So as one can see, there is life beyond RDP, and of course it is all described in the help system of Windows.


At the end of this article, I want to add and underline, that personally for me, in the comparison of GNU/Linux vs Windows, is won by GNU/Linux by a mile. Not because it introduces some new functionality, however. No. Many “details” decide. I have described a few of them last year, in articles titled Windows vs Linux : architecture comparison. Additionally, one could add there the GPL license, smaller TCO, or that I once had a chance to work on a Debian machine, which displayed 375 days, 10:55 as result of uptime, and the last Windows system, that could be that stable was NT4.0 Server, and the next versions only had it worse. Now having systeminfo display 28 days is a maximum. One could show more examples of Linux supremacy over Windows, but, however it is true, that “Linux console is more work-friendly”, then the “The Windows console is unusable” claim is a total rationalization.

In the principle, the problem is not in the Windows nor in the Linux system, but in the users. The average Linux user does not care for Windows the same as for His-Beloved-System and constantly poses for defense. Why? The fact that users of any software, being accustomed to it, expect different applications (serving similar purpose) to do the same, the same way, might be some explanation. Following this trail, we (falsely) expect that the remote management of Windows to be exactly the same as on Linuxes. This however does not sanitize the rationalization…

Translated-by : el es

About the Author


Keyto is a computer engineer living in Poland. In free time he likes to write longish stories about GNU, Linux and its users :)

New AdTaily ads!

Are you a film buff?

film buffs community, movie recommendations and reviews

RSS: Comments

You can follow the comments to this article through a special channel RSS 2.0 .

Related articles: CLI

 more »

PolishLinux Top Content

Become our fan on Facebook! on Facebook

Follow PolishLinux on Twitter!

Follow polishlinux on Twitter

Google Ads