All About the Unix and DOS Command Lines for Developers
by Alexandra Kropova from Mammoth Interactive INC.
Covered in this tutorial:
- What is the terminal
- Why all developers must know how to use the terminal
- What is the terminal on Mac, Windows and Linux operating systems
- Basic terminal commands you must know
What is the Terminal
The terminal allows you to interface with your operating system. You can do a lot of development tasks like connect to Github, install packages like nodemon, run servers for websites, automate tasks, run scripts and more.
Why all developers need to know the Terminal
Whether you’re a front-end, back-end or other developer, you need to know how to use the command prompt (also commonly called the shell, terminal, command line or console.) Using the terminal WILL be required for some project that you work on, guaranteed. Many jobs REQUIRE command line proficiency.
Mac vs Windows vs Linux Terminals
Mac Terminal
- Mac’s Terminal application comes with your Mac.
- Find the Terminal in your Applications folder or via Spotlight Search.
Windows Terminal
- Windows’ Command Line application comes with your Windows operating system.
- This is a DOS shell, which uses mostly different commands from a Unix or Linux shell.
Get a Linux Shell on Windows
- Get 64-bit Windows (32-bit is outdated and won’t work)
- In your Control Panel, search for “Turn Windows Features On Or Off”
- Enable the “Windows Subsystem for Linux” option in the list.
- Click OK.
- You must restart your computer for changes to come into effect.
Linux
- You can install a Linux operating system as a replacement for your Mac or Windows operating system if you wish.
- Linux is free and open source.
Hint for the Terminal
Use the up/down arrow keys to re-do a prompt.
Enter a folder
cd path/to/project/folder
Hint: On Mac, right-click on a folder. You’ll see a list of functionalities, including ‘Copy’. Press and hold the Alt key on your keyboard. This will turn the ‘Copy’ button into the ‘Copy as pathname’
Warning: Make sure to use forward slashes vs backslashes if you’re on Mac vs Windows.
Print a statement
echo "Hello world!"
See the path you are at
Unix or Linux (Mac or Linux/Ubuntu)
pwd
DOS (Windows)
chdir
List out all the folders that exist where you currently are
Unix or Linux (Mac or Linux/Ubuntu)
ls
DOS (Windows)
dir
Make a new directory (folder)
mkdir newdirectory
Go up one folder (to the parent folder)
cd ..
Build a new file
Unix or Linux (Mac or Linux/Ubuntu)
touch newFile
DOS (Windows)
notepad newFile.txt
or
copy con newFile.txt
Copy a file
Unix or Linux (Mac or Linux/Ubuntu)
cp toCopy.txt copyName.txt
DOS (Windows)
copy toCopy.txt copyName.txt
Edit a file
Unix or Linux (Mac or Linux/Ubuntu)
nano file.txt
Steps to editing a file on Unix:
- Enter text
- Press Control+X to exit
- Press Y to save
- Press Enter to return to Terminal
DOS (Windows)
notepad newFile.txt
or
copy con newFile.txt
Move a file
Unix or Linux (Mac or Linux/Ubuntu)
mv fileToMove.txt pathOfNewFolder
DOS (Windows)
move fileToMove.txt pathOfNewFolder
Want to learn more? Learn cryptocurrency, blockchains, algorithmic trading, financial analysis, algorithmic trading, the stock market, and more in The Complete Python for Finance: Learn to Trade in 99 Days.