Advanced CSS
WDD 331
Using the command line on a PC
the command line on a Windows PC can be found by running the cmd app. the easiest way to do that is Start->Run->Cmd. Cmd allows us to run special commands on the computer that cannot be found in the graphical user interface. These commands are usually short words that may be followed by one or more parameters...bits of other information that the command needs to run. These commands in the always run in the current directory. One of the most important tasks you can learn with the command line is changing working directories.
To change directories on a pc we first need to know where we currently are. The prompt will always show you this. If you have just opened up the cmd window you will probably see something like this:
C:\Users\username
If you didn't see something similar to that then type:
cd %userprofile%
That will take you back to your home directory. If I wanted to see what folders and files were in my current directory I could type:
dir
Try that now.
Lets assume that the directory I have my activity files in is at \Documents\web-stuff\scss-demo. When you did the list command earlier you probably saw that the Documents folder is inside the directory we are currently in. In fact the full path to the directory I want is C:\Users\username\Documents\web-stuff\scss-demo
To change directories in the command prompt we use the 'cd' (change directory) command. If I want to enter the Documents directory (and I see it when I type 'dir') I simply type:
cd Documents
If I want to go back to where I was I can type:
cd ..
('..' is a shortcut for parent directory)
I can also change multiple directories at once. like so:
cd Documents\web-stuff\scss-demo
One trick that can help you as you are navigating with the Terminal is the 'tab' key. 'tab' autocompletes what you are typing if it can. So if I started typing
cd Doc
then hit 'tab' it would autocomplete to:
cd Documents
Then I could keep typing:
cd Documents\web-
hit 'tab' again and it should autocomplete to:
cd Documents\web-stuff
If you hit 'tab' and nothing happens then it means the computer either can't find a match or there is more than one match. The command line is also case sensitive...meaning 'doc' is different than 'Doc'. Remember that 'ls' is your friend. It will always show you the contents of whatever directory you are in.
One last tip. Microsoft has actually put a bit of work on making the command prompt aware of what is going on in the Explorer. Another way you can get to a specific folder in the command prompt would be to type
cd
then drag the folder you want from the Explorer window onto the command window. In the case of this example if you have done correctly it should show something like this:
cd C:\Users\username\Documents\web-stuff\scss-demo
The advantage of this is that it doesn't matter what directory you started in...it will always take you to the directory specified.
Here are a couple of additional resources to look over if you feel you need more help.