So far we've mostly interacted with software by using buttons, also known as the GUI - General User Interface. The other way to use software is through CLI, which stands for - Command Line Interface.
Once again, what's the official meaning? Or atleast, what does Wikipedia say?
A command-line interface (CLI) processes commands to a computer program in the form of lines of text.
That's it! Imagine writing one-liners instead of pages of code and you'll be fine.
The simplest example I can think of currently, would be to interact with your computer via CLI. You will be interacting with your code soon, don't worry.
Prepare for things to get real Matrix-y, real fast.
The following instructions are for Windows users (Mac and Linux users are suggested to read this blog post by Tania Rascia).
Press the "Windows" key and (if on Windows 10) just start typing
cmd and "Command Prompt" should show up in the results, open it. Alternatively, you can just use search to find it.
You should see something similiar to the above screenshot. This is a CLI aka a Command Prompt, because it's just literally a prompt where you enter commands.
To execute a command, simply click on the command prompt, so you can type and type:
then press "Enter" to execute.
Now you should see your IP configuration get listed.
Congrats! You just executed your first CLI command! 🎉
What can you now do with this IP information? For one, you could get to your routers admin panel, as long as your computer is connected to it.
To do so, just copy the IP next to "Default Gateway" in your browser and press "Enter".
While you're at it, you might wanna improve your router security. Feel free to search around for more tips on how to secure your router, after all, it does handle many of your interactions with the web.
So this is a very.. vintage way of using software. It's nonetheless super powerful when you want to automate stuff.
Imagine wanting to update 50 servers. You're probably going to want to pass on having to do it manually, with a mouse and a keyboard. Even remotely connecting to them all would take ridiculously long.
Using a CLI you can just execute a command or a file that contains many commands, known as a "script file", since code is aka "scripting" in some corners of the internet.
You probably noticed that you don't write entirely empty lines, there's always what seems to be a folder path to the left of where you type?
That's the current directory, your current position in the file system. This is used to execute commands inside a directory aka a folder.
Let's try it!
(which is just an abbrevation of "directory") and press "Enter".
You should see a list of files and folders marked with
<DIR>, along with their last modified date and time and size in bytes. With a summary added at the bottom.
You can open the same directory as you see it in your command prompt, with the File Explorer and see it side-by-side. Regardless of whether you're a GUI or a CLI person, I strongly advise learning both.
Naturally since you are currently in a folder in your file system, you can navigate around.
cd "folder name"
like, for example:
and hit "Enter".
Now notice that your position was updated and now you're in the folder you selected. Typing
dir again will show you the files in this folder instead.
To go back or more precisely up one level, type:
and, you guessed it - hit "Enter".
Chances are you have the default colors set up for your command prompt. If you wan't to get all Matrix-y or feel like Hackerman, this is what you do: