Command Line Interface

Savneet Kaur
2 min readMar 27, 2024

--

Photo by Clément Hélardot on Unsplash

A command line interface (CLI) is a way of communicating with a computer’s operating system by typing text-based commands. Unlike graphical user interfaces , which rely on visual elements like icons and buttons, CLI requires users to input commands directly into a text-based environment.

In simpler terms, it’s like having a conversation with your computer using written instructions instead of clicking around with a mouse. You type out specific commands, and the computer responds accordingly by performing tasks such as navigating folders, opening files, or running programs.

Let’s see some commonly used commands:

cd Desktop #change directory to Desktop

echo "Hello" #to print The string

touch a.txt #to create an empty file named a.txt

pwd # tells the present working directory

cp a.txt b.txt # to copy content of one file into another file

mkdir hello # to create a directory named hello

clear #command used to clear the terminal

mv a.txt f4 # moves the file a.txt into f4 directory

rm a.txt # deletes the file a.txt

cat a.txt # To see the content of the file

man ls # man commands displays the manual pages for specific command

These commands illustrate how to manipulate, create, print, and navigate files and directories using the CLI.

Moreover, a lot of other operations can be executed via the command line interface, such as running multiple commands consecutively using a pipe

cat a.txt | less #less command displays 1 scroll length of article

‘|’ is a pipe character. The pipe character ‘|’ directs the output of one command to another. In this case, the ‘less’ command displays one scroll length of the article.

In conclusion, the Command-Line Interface may appear complex initially, but it’s a valuable tool worth delving into. By entering commands, users can efficiently control their computers, manage files, and complete tasks.

--

--