Time to create some directories and files! Let's start a small website project with the help of mkdir to create a new directory and touch to create some empty files. Let's give it a try, using our last example as the starting point: pwd On macOS, "home" is the user's directory under /Users. You can quickly navigate to your home directory by just typing ~ (tilde). (the two dots stand for the path to the parent of that directory). You can also navigate up one folder by typing cd. To change to a different directory, you can use cd and the name of the folder you're looking for. You can combine the two by typing ls -la. For example, ls -l will provide more information for each file, and ls -a will include entries that begin with a dot (hidden files). You can use different flags to get more options, and even combine them. Now would be a good time to introduce you to flags. Here's an example - the # represents the output after running each command: pwd Then, ls (list) will list all the directories and files available in that directory.
You can type pwd (print working directory) to view the full path name of your current working directory. Let's start with the basics: navigating through directories and creating (or deleting) directories and files.
You can have a look at the "Efficient Editing" section in this article to get started. When working with a CLI, it's a good idea to become familiar with the list of shortcuts provided by the Readline library. This website should be a good starting point.
You can also check the tldr project for a simpler manual with practical examples. You can press f to move one page forward, b to go back, and q to quit. Command Line cheat sheetĭocumentation is always useful, and the command line has plenty! You can type man to access the manual to learn more about each specific command. We have one ready for you with the most essential commands, which you can download here. Terminal commands call for some practice (and a bit of patience), so a good way to start is to download and keep a cheat sheet close to you.
The following list of essential commands will work on any UNIX-based terminal, so feel free to use whatever you prefer. PowerShell, while also cross-platform, is a more popular choice among Windows users. Many macOS users prefer iTerm2 due to its extra features, or Hyper, a more modern, cross-platform terminal based on Electron. Regardless of your operating system, there are many other alternatives. This will add a compatibility layer to run Linux operating systems without the need of a virtual machine, enabling an authentic terminal experience.
Since Windows 10 was released (version 2004 and higher), the modern approach is to install Windows Subsystem for Linux (WSL). For this reason, many Windows users rely on Git Bash, which is part of Git for Windows.
For a very long time, launching the command prompt (cmd) was the solution, but since it was based on the old Windows DOS prompt, some Unix commands would not work. Windows is a bit trickier, but it's thankfully getting better. If you're on macOS or Linux, you can find a Terminal among your other applications.
The terms "terminal" and "command line" are often used interchangeably, but technically, the terminal is the software that starts and connects you to a shell (more on that later), while the command line is the actual line with the blinking cursor where you enter commands. An Introduction to the TerminalĪ terminal is used to execute text-based programs. We have a lot of ground to cover, so let's get started! The interface may not be the prettiest to look at, but you can get a lot done by typing the correct set of commands.Īfter reading this guide, I’m sure the terminal will feel a bit more welcoming! Here is what's in store for you today. This is partly due to the numerous CLI tools that are at your disposal some come pre-installed, while others can be found in package registries, which work in a similar way to app stores.Īutomating the use of these tools through scripting will guarantee an increase in your productivity. Many modern web development tools, like Node.js or React, rely on the CLI (Command Line Interface) to get up and running.īut the CLI is not just for Web Development - it's also a reliable solution for task automation, as it enables you to perform complex tasks rapidly. As developers, we are expected to be proficient in the terminal (or, if you prefer, on "the command line"). You can find a terminal available on pretty much any device servers, desktop machines, Raspberry Pis, and mobile phones all provide access to this powerful tool.