The following steps will show you how to use the black window all hackers use. It might look a bit scary at first but really it's just a prompt waiting for commands from you.
What is the command line? The window, which is usually called the command line or command-line interface, is a text-based application for viewing, handling, and manipulating files on your computer. It’s much like Windows Explorer or Finder (Mac), but without the graphical interface. Other names for the command line are: cmd, CLI, prompt, console or terminal.
How can I open it?
If you don't know what to do, you can try Google, ask the coach, or you can e-mail us.
When you open the command line, you should see a white or black window that is waiting for your command.
Each command will be prepended by the sign
> (depending on your operating system)
and one space, but you don’t have to type this prompt.
Your computer will do it for you.
Each operating system has slightly different set of commands for the command line, so make sure to follow the instructions for your operating system.
Font size (Windows)
If your font is too small you can click on the small window icon in the up right corner. Then choose Properties and find the Font tab where you can set a different font size.
In other operating systems, you can try: Ctrl++ and Ctrl+- (+ Shift).
We will start with a very easy command.
whoami (who am I?)
and press Enter.
Your user ID will be shown. For example on Alex' computer, it looks like this:
$ whoami Alex
> whoami PCname\Alex
The command line always works from a directory (also folder).
We can print our working directory (also called current directory) by using the command
pwd (Linux, MacOS)
pwd means print working directory and
cd stands for current directory
$ pwd /home/Alex/
> cd C:\Users\Alex
The current directory is often also displayed before
>, but it's
good to know this command in case that you get lost or if you have to
work on a computer that is set to display something different before
dir (list or directory)
will show us what's in the current directory: all files and
$ ls Applications Desktop Downloads Music …
> dir Directory of C:\Users\Alex 05/08/2014 07:28 PM <DIR> Applications 05/08/2014 07:28 PM <DIR> Desktop 05/08/2014 07:28 PM <DIR> Downloads 05/08/2014 07:28 PM <DIR> Music …
You can chnage your current directory by using the command
cd (change directory) -
for all OSs (in Windows, if you don't specify anything after
prints the current directory as we said earlier)
cd we have to write the folder's name where we want to go.
Don't forget to check if you were successful.
If you have Linux or macOS, be careful - those systems are case sensitive,
desktop are two different folders!
$ cd Desktop $ pwd /home/Alex/Desktop
> cd Desktop > cd C:\Users\Alex\Desktop
Note for Windows users
If you change directories to a different disk (to
you have to enter the disk's name (
D:) as a special command before
How about creating a practice directory on your Desktop? You can do this by using the
mkdir (make directory).
After that command, write the name of the folder that you want to create -
in our case
$ mkdir practice
> mkdir practice
Now, look on your Desktop or into some other graphical program for browsing folders, and check if the folder was created!
In your new
practice directory, try to create a subfolder
test and check
if it was created.
dir might help you.
We don't want to leave a mess, so let's remove everything we did until that point.
But you can't delete the folder in which you currently are.
First, we need to get back to the Desktop. We can't use
cd Desctop because in the current
folder, there is no Desktop.
So we have to go to the parent directory which contains the folder that you are
Two dots stand for the parent directory.
$ pwd /home/Alex/Desktop/practice $ cd .. $ pwd /home/Alex/Desktop
> cd C:\Users\Alex\Desktop\practice > cd .. > cd C:\Users\Alex\Desktop
Now it's time to delete the
For that purpose, use
(remove or remove directory).
The command line does not have a Recycle Bin! Everything will be deleted for good. Every time, make sure that you are deleting the right folder.
In Unix, you have to write
rmdir -rv (minus,
v). The parameter deletes everything
r - recursive) inside the folder, and it prints info telling you (
v - verbose)
what the command is doing.
In Windows, you also have to add a switch to the
rm command to delete everything inside a
directory. Here, the switch is
/S (forward slash,
$ pwd /home/Alex/Desktop $ rm -rv practice removed directory: ‘practice’
> cd C:\Users\Alex\Desktop > rmdir /S practice practice, Are you sure <Y/N>? Y
There is a table of basic commands:
||show the current directory||
||copy a file||
||move a file||
||create a new directory||
||delete a file||
||delete a directory||
||close the window||
There are of course a lot more commands.
All the programs that you have installed on your laptop can be
run from the command line - usually by typing their names.
Try for example -
If it's not working, ask your coach and they might help you to find an example command that works.
We will use commands/programs like
git a lot. We will install them
in a while.
Now you can try one more command - the one that closes the command line window -
It works the same in all operating systems.
We will be using
$ to indicate Linux/macOS (in fact, for Unix based OS) commands
> to indicate Windows commands for the rest of our course.
This is the convention in most materials and tutorials you will find.