Originally Posted by John1
I assume there's an order to writing commands. What's first? How many spaces are necessary? Sorry, that's two questions. Thanks.
Assuming that you are talking about commands that you want to type into the terminal I could try to answer your questions rather generically:
The order of commands obviously depend on what you want to achieve. Say you want to rename a file that sits in directory /home/joe/my_directory from old_name to new_name.
You could go to that directory using cd and then rename the file using mv like so:
mv old_name new_name
If you typed the commands in the reverse order it would not work. You'd be in the wrong directory while typing the mv command, so the file old_name could not be found, and hence not be renamed.
Typically the number of spaces between to words of a command do not matter, just one will do, but more won't hurt. The only exception are commands that refer to specific strings such as filenames, or commands that search for specific character sequences in text files or in the output of other commands.
E.g. there there is the ls command (ls standing for list), which lists directory content. To just list the files and directories in the current folder, you type
Now, if you want more detailed output, you add a so-called command line option, the -l option (for long list)
In the above line of code there is one space between ls and -l. However, the command would also work with two spaces:
Now, if you do not want to list contents of the current directory, but of a subdirectory called "my directory", you would have to type
The directory name contains a space. Now if you typed
the command would fail, because the directory name was wrongly spelled.
Hope this helps a bit.