List of shell commands for Windows/Linux

Yohhan

Senior member
May 17, 2002
263
0
0
I'd like to get a full list of all native (I guess you could say) commands for the cmd shell and Bash. Just a plain old list. Partially for memory, and partially to learn new ones. Anyone know where I can find something like this?

Thanks ahead.
 

KF

Golden Member
Dec 3, 1999
1,371
0
0
For the XP command line shell, the internal commands can be listed by typing help at the command prompt. To put this listing in the file see.txt, type

help > see.txt


help followed by one of the listed internal commands gives you more info. The "recovery console" has a little different set of commands.

Something like this works for linux shells, I think. However, some commands are utilities and are not built-in, and different shells are different.
 

drag

Elite Member
Jul 4, 2002
8,708
0
0
Sometimes I think that people assume the command line interface is difficult because they've never used a decent one. If you want to compare command line to GUI's, if Windows CLI=Windows 3.0, then Bash = OS X's Aqua.

Good stuff.

Basics
Moderate
Advanced
Refrence

What makes it cool is that the way scripting works is very good. It's like a combination of programming and talking to your computer. Windows stuff you can do some pretty advanced things, but it's all awkward and contrived. It gives you the ability to automate tasks easier and make convenience scripts. I like to have a button on my desktop that I use that will mount or unmount either of my cdrom/dvd drives. That way I don't have to mess around with the occasional issues with automount stuff.

Then you have lots of nice little usability things, like the tab autocompletion rocks. Most commands or applicatoins you don't even have to know how to spell them correctly. If you can spell out the first 2-3 letters you can find any command quickly.

Then you have niceties like being able to hit ctrl-r to call up old commands as you type out stuff. It's a history search and it tries to match what your typing out, like in a browser url thingie.

Also you have the ability to copy and paste commands and stuff into a xterm window, or a virtual terminal when you have gpm running. It's something that's not obvious because you can't right click on anything.

You highlight the text you want to copy, move your mouse over to the xterm and then middle click(or any other place were you input text). Just by the act of highlighting something your doing the same thing as "right-click copy" in Windows. So you can save yourself a lot of typing if you want for stuff like urls and such. The only major issue is that each program in X has control over it's own "copied" data, so that if you highlight something, then close out the program before you paste, then it goes away. (oh, well nothing is perfect, I think kde may have a way around it, and there are clipboard deamons that can save your stuff)

edit:

Other little things, too. The up and down arrows can be used to call up old commands. Also Shift-PageUp or Shift-Pagedown to scroll up and down your shell to see any text that may have rolled off the screen.
 

Booty

Senior member
Aug 4, 2000
977
0
0
drag, you don't happen to be a teacher, do you? Because if you aren't, you really should consider it... there aren't too many people out there willing to help without an attitude.
 

KF

Golden Member
Dec 3, 1999
1,371
0
0
Not to knock linux, since the command line shell of XP/NT (and DOS) is a knockoff of historic unix shells, but a lot (all?) of what drag mentions is available in XP.

"The up and down arrows can be used to call up old commands." works in XP (and optionally in later DOS versions.)
Forward arrow on a blank line brings up the previous command one character at a time. You can back up on the line with back arrow, and selectively change characters. Pressing the Insert key toggles between overwrite and insert modes.

"
Enabling file and directory name completion
File and directory name completion is not enabled by default. You can enable or disable file name completion for a particular process of the cmd command with /f:{on|off}. You can enable or disable file and directory name completion for all processes of the cmd command on a computer or user logon session by setting the following REG_DWORD values:

HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\CompletionChar\REG_DWORD

HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\PathCompletionChar\REG_DWORD

HKEY_CURRENT_USER\Software\Microsoft\Command Processor\CompletionChar\REG_DWORD

HKEY_CURRENT_USER\Software\Microsoft\Command Processor\PathCompletionChar\REG_DWORD

To set the REG_DWORD value, run Regedit.exe and use the hexadecimal value of a control character for a particular function (for example, 0×9 is TAB and 0×08 is BACKSPACE). User-specified settings take precedence over computer settings, and command-line options take precedence over registry settings.
"

If you want to know about batch files and scripts, bring up HELP from the start menu and put "command shell" in the search box. And follow out the links. There is an amazing pile of material there. Also try "cmd".

"You can also use the Windows Script Host, CScript.exe, to run more sophisticated scripts in the command shell."

You can run a shell within a cmd shell if you like. There were a lot of add-on unix knock-off shells for DOS, and I imagine there are for XP if you search for them. One favorite was Midnight Commander.
Midnight Commander port to Windows
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
For bash you can do 'man builtins' for a manual page on built-in commands, things like loops, if statements, job management, variable manipulation, history manipulation, etc.

Not to knock linux, since the command line shell of XP/NT (and DOS) is a knockoff of historic unix shells, but a lot (all?) of what drag mentions is available in XP.

No offense but if you think that the shells are anything like each other you should use a real bash shell for a while, cmd is an extremely poor shell in comparison.
 

chorner

Member
Oct 29, 2003
134
0
0
Hey Drag:

Bash isnt the only command line system that allows you to do what you've listed.

Since Windows NT 4 you could do everything you mentioned :)

Such as --->

1)No need to mount and unmout drives (haha how lame)
2)TAB - complete
3)Hit F7 to pull up a list in an overdrawn 'window' to chose from the last 7 or so commands or hit up, down, left or right keys
4)highlight the text, copy and paste to and from the command prompt
5)start and stop services quite easily
6) .... whatever Linux can tdo but with intuitive names such as : ipconfig etc. instead of ipchains? or bahlah-gahlah-konkor or whatever for your notepad :)

You Linux dweebs kill me :p *wow Linux can almost do what Windows does .. and its free!* hahaha uhhhh, what!?
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
1)No need to mount and unmout drives (haha how lame)

There are automounters but a lot of people don't use them, it's called having options.

2)TAB - complete

Which is very annoying because of the fact that you have to keep hitting tab to cycle through the options

3)Hit F7 to pull up a list in an overdrawn 'window' to chose from the last 7 or so commands or hit up, down, left or right keys

The the arrows only give you a history of 7 too? Either way I know it doesn't save the history anywhere which sucks, bash lets you specify how big of a history to keep and it's stored in your home directory so you can login weeks later, hit the up arrow and still have the same history you had when you left.

4)highlight the text, copy and paste to and from the command prompt

This is built into X and if you're using a non-X console you use screen which has a lot more functionality than cmd.

5)start and stop services quite easily

Only some of them, the ones that are needed for the system to run can only be restarted with a reboot. With Linux any service can be restarted without a reboot.

6) .... whatever Linux can tdo but with intuitive names such as : ipconfig etc. instead of ipchains? or bahlah-gahlah-konkor or whatever for your notepad

iptables/ipchains and ipconfig serve completely different functions, I think it's ifconfig you're thinking of and it makes more sense on Linux because it's interface config, you can do a lot more than just new a DHCP lease with ifconfig.

*wow Linux can almost do what Windows does .. and its free!* hahaha uhhhh, what!?

You Windows dweebs kill me because most of the time you don't have a clue about Linux and none of your ramblings make any sense. I dare you to find me a command line way to disable/enable an interface in Windows.
 

drag

Elite Member
Jul 4, 2002
8,708
0
0
Linux can do everything Windows does, but windows can't do everything that linux does.


I am well aware what the Windows CLI is capable off. I did state that you can do some advanced stuff with it, but it's badly designed interface. Trying to get it to do something remotely usefull is about as fun as pulling teeth. And it's not just the CLI itself, but also the enviroment imposes some severe restrictions on what you can and cannot do.

Try to do these things from windows command line:

1. Write a script to make a shortcut on your desktop.

2. Write a script to test your internet connection, have it run the test every five minutes, and have it log the results so that you can see how reliable your ISP is.

3. Write a script that will do a backup of your home folder into a compressed archive that stores it on a local FTP server.


All these things are possible, but they aren't easy in Windows CLI. It's just not designed to be a operating enviroment, it's just a augmentation to the GUI, something a poweruser can do to get certian things done quickly. You can use other things like visual basic type stuff to get advanced sudo-programming done, but those types of solutions generally cost extra.
 

Barnaby W. Füi

Elite Member
Aug 14, 2001
12,343
0
0
Originally posted by: chorner
You Linux dweebs kill me :p *wow Linux can almost do what Windows does .. and its free!* hahaha uhhhh, what!?

Difference being that most "Linux dweebs" have experience in both windows and linux, and understand the differences. Most windows gurus such as yourself know windows and little, if anything, else.

edit: to be more clear: If you really think that windows has anywhere near the power of nearly any unix on the command line, then you are painfully ignorant.
 

CTho9305

Elite Member
Jul 26, 2000
9,214
1
81
Originally posted by: Nothinman
Not to knock linux, since the command line shell of XP/NT (and DOS) is a knockoff of historic unix shells, but a lot (all?) of what drag mentions is available in XP.

No offense but if you think that the shells are anything like each other you should use a real bash shell for a while, cmd is an extremely poor shell in comparison.

Originally posted by: groovin
bash is to windows CLI as assault rifles are to throwing pebbles
| sed -e "s/bash/tcsh/g;"
Originally posted by: BingBongWongFooey
Originally posted by: chorner
You Linux dweebs kill me :p *wow Linux can almost do what Windows does .. and its free!* hahaha uhhhh, what!?

Difference being that most "Linux dweebs" have experience in both windows and linux, and understand the differences. Most windows gurus such as yourself know windows and little, if anything, else.

edit: to be more clear: If you really think that windows has anywhere near the power of nearly any unix on the command line, then you are painfully ignorant.

For getting stuff done (where stuff = work), I find a powerful commandline and the customizability of *nix very useful. For surfing the web and playing games at home, I prefer Windows. I agree with everything the linux dweebs said above, even though I don't like "linux on the desktop". "cmd.exe" is a half-assed shell.
 

KF

Golden Member
Dec 3, 1999
1,371
0
0
Originally posted by: Nothinman


Not to knock linux, since the command line shell of XP/NT (and DOS) is a knockoff of historic unix shells, but a lot (all?) of what drag mentions is available in XP.

No offense but if you think that the shells are anything like each other you should use a real bash shell for a while, cmd is an extremely poor shell in comparison.

OK, bash contains gobs of superfluous, extraneous complications that Windows doesn't need because it accomplishes these things in other ways. But notice all I said was that what drag mentioned as great features in bash are the same in cmd. So what is the complaint? IAC, it should be obvious that the XP style CLI was derived from unix. If you don't see it, you aren't looking.

But lets be frank. Command line processors are relics. They are crap. Their only rationale is their ease of implementation. You can try to take the nasty edges off, with conveniences like help, command completion, line editing and scripts, but the idea is bad. It's only nerdy oddballs who like that type of thing, the kind who enjoy twiddling with the OS internals as a blood sport. No offense. I only use a command line when I can't find another way, which surprisingly is fairly often. I think its because once they put a decent user interface on a shell, the programmers start worrying that civilians might use it, and they take all the meat out of it and cripple it, so no one can reek havoc by accident. That's why the XP desktop is the way it is.

As for bash, I have in the past listed the internals for myself, and 90% or more are things, to the extent that I understand what they are, that I don't want to have anything to do with, ever. The same goes for the command line switches of common unix untilities. I look in vain for the one I need, if it exists. I don't want a lifelong career learning how to do things the supposedly "easy way" in linux. In comparison, cmd, as limited as it may be, is well-thought-out and organization.
 

CTho9305

Elite Member
Jul 26, 2000
9,214
1
81
Originally posted by: KF
Originally posted by: Nothinman


Not to knock linux, since the command line shell of XP/NT (and DOS) is a knockoff of historic unix shells, but a lot (all?) of what drag mentions is available in XP.

No offense but if you think that the shells are anything like each other you should use a real bash shell for a while, cmd is an extremely poor shell in comparison.

OK, bash contains gobs of superfluous, extraneous complications that Windows doesn't need because it accomplishes these things in other ways. But notice all I said was that what drag mentioned as great features in bash are the same in cmd. So what is the complaint? IAC, it should be obvious that the XP style CLI was derived from unix. If you don't see it, you aren't looking.
Rename every file of the form "foo*.mp3" to "bar*.mp3" in a directory on your windows box. You can do it (hint: for /?, takes a while to figure it out, there's some stupid inconsistent uses of % in variable names), but it isn't easy.


But lets be frank. Command line processors are relics. They are crap. Their only rationale is their ease of implementation.
You ever try to write one? Writing a decent one isn't easy. How do I know? I wrote one. It took most of the class most of the week to get an almost-functional implementation, and the CS majors at CMU are nerds who spend all day writing programs (us ECEs are really cool though ;)). I would think writing a simple GUI environment (given a framework that lets you create buttons/etc... like in VB or Java + SWT) wouldn't take as long.

You can try to take the nasty edges off, with conveniences like help, command completion, line editing and scripts, but the idea is bad. It's only nerdy oddballs who like that type of thing, the kind who enjoy twiddling with the OS internals as a blood sport.
No, people who actually get work done on computers use command line interfaces too...

No offense. I only use a command line when I can't find another way, which surprisingly is fairly often. I think its because once they put a decent user interface on a shell, the programmers start worrying that civilians might use it, and they take all the meat out of it and cripple it, so no one can reek havoc by accident. That's why the XP desktop is the way it is.
You're saying the commandline is good now?
rolleye.gif


As for bash, I have in the past listed the internals for myself, and 90% or more are things, to the extent that I understand what they are, that I don't want to have anything to do with, ever.
That's because you just surf the web and play games. And maybe run MS Word.

The same goes for the command line switches of common unix untilities. I look in vain for the one I need, if it exists. I don't want a lifelong career learning how to do things the supposedly "easy way" in linux. In comparison, cmd, as limited as it may be, is well-thought-out and organization.
Nobody said unix was well-documented.

MS's commandline is well-thought-out? Try "netstat -?". Then try "dir -?". When do you use a / and when do you use a -?. cmd doesn't even support job control - once you launch a background app from it, you can know NOTHING about what happened to it, what it's doing, and you can't control it.

At home I use Windows... at work I use Linux (or Solaris). For large amounts of file manipulation, windows is a PITA. Run a circuit simulator, dump the results to a text file, sort the file by various columns, and print the best 5 in a GUI. Odds are that in order to do that fast, you'd end up using the command interface for the application (like in matlab).

source run_spice.csh -log foo.txt && sort -n +18 foo.txt |head -n 5

Ok, so maybe it took me half an hour to figure out how to do that the first time. But once I do it the first time, I can just do "!sou" to run it again in the same shell. If that was a GUI, you'd be clicking... and clicking... and clicking.

Let's say my circuit generator gives me a file that isn't exactly the same as what my spice (the dominant type of circuit simulator in use) engine wants.
cat "generated.circuit" |sed -e "s/nmos/nfet/g;" > spice.circuit
Do a search and replace over and over again in a GUI. You could open the file in notepad and "replace all", but after a couple dozen times, that gets pretty tedious.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
So what is the complaint?

That cmd is ass compared to bash, csh, etc.

IAC, it should be obvious that the XP style CLI was derived from unix. If you don't see it, you aren't looking.

I never said otherwise, but the fact that it was inspired by unix doesn't mean it tries to be like a unix shell.

But lets be frank. Command line processors are relics. They are crap.

Hardly. I use Linux every day at work and at home and I use the cli for probably 3/4 of the things I do because it works and it's easier than clicking around a GUI, for the most part.

I don't want a lifelong career learning how to do things the supposedly "easy way" in linux.

That's too bad, because in the long term the easy way in Linux is generally easier than any way in Windows.

Do a search and replace over and over again in a GUI. You could open the file in notepad and "replace all", but after a couple dozen times, that gets pretty tedious.

Add on the fact that notepad is like 1000% times slower than vi at search and replace functions and you don't even get regexps in notepad.
 

drag

Elite Member
Jul 4, 2002
8,708
0
0
Originally posted by: KF
Originally posted by: Nothinman


Not to knock linux, since the command line shell of XP/NT (and DOS) is a knockoff of historic unix shells, but a lot (all?) of what drag mentions is available in XP.

No offense but if you think that the shells are anything like each other you should use a real bash shell for a while, cmd is an extremely poor shell in comparison.

OK, bash contains gobs of superfluous, extraneous complications that Windows doesn't need because it accomp.....
*snip*
....how to do things the supposedly "easy way" in linux. In comparison, cmd, as limited as it may be, is well-thought-out and organization.

Everybody is entitled to a opinion, but as far as stuff like tab completion in windows CLI, it's not anywere nearly as decent as Bash's. Those examples were just tips to help out so that when you first starting using the Bash shell it's not frustrating, I could of gone on for pages about different.

Yes I was well aware that cmd has tab auto-complete, but guess what? It's very half-assed. Most of the time it doesn't even work correctly.

And if "well-thought-out and organized" = fairly useless, then by all means cmd is well-thought-out and organized.

Scripts and crap like that aren't just "to take the edge off" it's a nicety. A way to automate. It makes things EASIER, not more difficult. So what you have to spend a extra fifteen minutes to make sure that scripts work properly, you can save hours of work.

It's not a coincedence that it takes 3-4 windows adminstrators to get the same amount as work done as one Unix Guru.

One example is what if you need to add a bunch of users? In a GUI the best you have is the ability to create a template you can use to make it easier to type in every name. What if you could just have the computer do the work instead? Make a script that can do it and you can get 200-500 new users inputed and correctly setup in under ten minutes. Of course this depends on how well your OS is designed.

If you haven't noticed lately, but as windows gets more and more complicated and unix-like, people are becomming more and more dependant on the command line. It's not the command line that is becoming a dinosaur, it's being completely dependant on a GUI or a command line is becoming a relic.

Hell, look at OS X and Macs. Now that you have the command line, guess what? OS X is actually usefull for something other then editing graphics. Whoopie.

Its also funny how you depend on the command line to accomplish many things that you can't do in your "superior" gui interface. So much that it suprises you, but it's the Command line that sucks and is a relic.

I'd bet ya that in ten years after the "windows explorer" and varients will be long dead, their code rotting away on old cdroms that nobody cares about except as jokes and museum peices, people will still be using and depending on the command line every single day. Probably not bash, but people were using sh long ago, and stuff like that just evolves and gets better and better as time goes on. Gui interfaces just die.
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
Originally posted by: KF
OK, bash contains gobs of superfluous, extraneous complications

BASH is a "features" shell. Try ash, zsh, ksh, sh, csh, etc. There are smaller shells with less features, that can work just as well. I prefer ksh.

that Windows doesn't need because it accomplishes these things in other ways. But notice all I said was that what drag mentioned as great features in bash are the same in cmd. So what is the complaint? IAC, it should be obvious that the XP style CLI was derived from unix. If you don't see it, you aren't looking.

Microsoft gets plenty of source from Free software. Look at the Unix services. That's why BSD software is free. ;)

I only use a command line when I can't find another way, which surprisingly is fairly often.

Obviously, it isn't a relic. It's a necessity.

I think its because once they put a decent user interface on a shell, the programmers start worrying that civilians might use it, and they take all the meat out of it and cripple it, so no one can reek havoc by accident. That's why the XP desktop is the way it is.

You want to complicate things, try and give a gui as much power as you can get through a command line. Talk about big and bloated.

As for bash, I have in the past listed the internals for myself, and 90% or more are things, to the extent that I understand what they are, that I don't want to have anything to do with, ever.

But other people do. Write your own shell if you want something that only conforms to what you need. Or just modify one of the shells that are out there.

The same goes for the command line switches of common unix untilities.

One man's trash is another man's treasure.

I look in vain for the one I need, if it exists. I don't want a lifelong career learning how to do things the supposedly "easy way" in linux.

I don't either. I want something functional NOW. The command line is there for just about everything I do (except trolling on message boards and downloading massive amounts of porn).

Ever had to apply an emergency patch to a server while you're out with friends and all you have access to is a crappy old machine on dialup? I can't imagine it would be fun with a gui.

In comparison, cmd, as limited as it may be, is well-thought-out and organization.

I think it is a lot tougher. Maybe it's on of those subjective things though. Who knows?
:p