Table of contents
No headings in the article.
The Command Line Interface (CLI) is a bit like a Pitbull, it may seem intimidating at first, but once you overcome the fear and intimidation, you'll quickly discover how easy it is to fall in love with it.
WHAT IS A COMMAND LINE INTERFACE?
CLI (command-line interface) is a text-based user interface (UI) used to run programs, manage computer files, and interact with computers. A command-line interface can also be called a console interface. Even though CLI has become a little less popular with the introduction of GPU it is still a useful tool for developers.
Let’s get one thing straight, developers are lazy and they will always find a way to make life easy while saving time- getting things done in less time woohoo!
WHAT CAN YOU DO WITH CLI?
Version Control
Did someone say, Git? yes!
Using the CLI, you can initialize repositories, clone remote repositories, create branches, stage and commit changes, merge code, and interact with remote repositories.
File and Directory Management
You can create, delete, copy, move, and rename files and directories using the CLI.
Testing and Debugging
Run tests, perform code analysis, and debug applications with the CLI's tools and frameworks.
There are so many things you can do with the CLI, I just highlighted a few for the sake of time, If you are interested research some more.
HOW TO USE THE CLI?
1 . Opening the CLI:
Depending on the operating system you use, you'll find different ways to open the CLI:
Windows: Look for the "Command Prompt" or "PowerShell" application. You can search for "cmd" or "PowerShell" in the Start menu.
macOS: Use the "Terminal" application. You can find it in the "Utilities" folder within the "Applications" folder, or search for "Terminal" in Spotlight.
2 . Navigating the File System: Once your CLI is open, you will see a command prompt. Here are some basic navigation commands:
pwd
: Prints the current working directory (the directory you're currently in).ls
(ordir
on Windows): Lists the contents of the current directory.cd [directory]
: Changes the current directory. You can specify either an absolute path (e.g.,/home/user/Documents
)- Exploring Common Commands:
There are many commands available in the CLI for different purposes. Here are a few common ones to start with:
File and Directory Manipulation:
mkdir
: Creates a new directory.touch
: Creates a new file.cp
: Copies files or directories.mv
: Moves or renames files or directories.rm
: Removes files or directories.
File Viewing and Manipulation:
cat
: Displays the contents of a file.less
: Allows viewing file content with pagination.Nano
(orVim
): Text editors for modifying files.
Here are a few examples:
Using the command mkdir- This command lets you create a new directory
To create a new directory with the name my_docx
mkdir my_docx
Now let's use the command name: touch*- This command lets you create a new file*
touch my_docx
These are just a few basic commands I am practicing today, there are many more to learn!
Here is a cool resource to learn more:
https://flashcards.github.io/command_line/introduction.html
Like any other software you learn, using the command line interface is a skill that you build with time. I am still learning and making mistakes as I go and I have seen how useful the CLI is, it is worth learning.
Happy Exploring!!!
Disclaimer: I am on a learning journey! I do not claim to be an expert, feel free to kindly correct or make suggestions.