The following page describe basic commands to get familiar in working with a CLI.
After having started your CLI the way it was explained before, a good idea is to see ‘where’ we are: A CLI points to a so-called working directory
. Type pwd
to, well, Print the Working Directory or Dir:
pwd
(enter
always executes the command, as you probably know, so we will not repeat that. Remember: we will not repeat that)
Some people nowadays say Folder
instead of Directory
, that is mainly just another word… For details fire up your favorite search engine and search for ‘directory vs folder’.
The answer to pwd
will be a path, like:
/Users/frens
Note that in Windows, paths look different than other operating system. In this case, the path will be C:/Users/frens
After knowing ‘where’ we are, we want to enjoy the view, by asking for a list of files and directories
in the current working directory:
ls
Note that the following parameters do not work in PowerShell
A lot of commands have endless variations if we add parameters
, like -l
, you will get 1 item per row:
ls -l
or -a
(All) to also show hidden items:
ls -a
and you can also combine parameters:
ls -al
mkdir MyVeryOwnDir
If you do ‘ls’ again you will see there is a new item in the list with the name you chose.
We can move to a directory using the cd
(change directory) command:
cd MyVeryOwnDir
Once you a couple of characters, the CLI will often be able to complete it for you when you hit the TAB
key.
Sometimes it is convenient to go back to the home directory. This the directory that is connected to the account you are logged in to. To go to your Home directory, type the following command:
cd ~
(there is a space
after cd
)
If you are currently in /Users/frens
and you want to go up to /Users
, use ..
:
cd ..
If you are currently in the /Users/frens/repos/project
directory, but you want to back to your previous directory /User/frens/Downloads
, use -
:
cd -
touch someSillyFilename.py
New-Item someSillyFilename.py
open someSillyFilename.py
In Windows you can open any file with Notepad by using notepad
:
notepad someSillyFilename.py
To open Visual Studio Code to edit this file you may need to do some work , but afterward you can:
code someSillyFilename.py