Basics of CLI (Command Line Interface)

Sadat Jubayer

Sadat Jubayer

January 13, 2022

2 min read

CLI is an essentail thing that should know by every developer. It helps to run/execute commands which are provided by the operating system.

Where to run the commands

  • For Linux: Your default terminal
  • For windows users: You can use WSL or Git Bash to execute the basic commands, download the git for all platforms
  • For Mac Users: Almost all of the commands you use in the macOS terminal are extremely similar to the ones Linux uses.

Hello to CLI

# hello world
echo hello world

# know who you are


This command give you a list of all files that a folder contains.

ls on CLI

ls accepts many options, -l is one of them, it gives much more details of the files.

ls -l
ls on CLI


It is used to change directory/folder where cd .. indicates the parent directory.

# to move to hello folder
cd hello

# to back to the previous folder
cd ..


You can create folder/directory with this command

# to create a folder name react
mkdir react

## to crate mutiple folders
mkdir react nodeJS

## too create nested folders (react folder inside project folder) use the flag -p
mdkir -p project/react


To remove a directory we use rmdir. But the condition is the folder must be empty.

# to remove react folder
rmdir react


To remove files and folder we use this command with -rf flag. Which means forcefully and recursively.

# this will remove all files and folders of the project folder
rm -rf project


This commmand is for creating files

# to create a txt file
touch secret.txt


For moving and renaming files and folders we use this command.

mkdir react projects

# to move the react folder into the projects folder
mv react projects
# to rename a file
touch secret.txt
mv secret.text open.text
# this will rename the file secret to open

These are the most basic commands of Command-Line that every developer should know. I hope you may find this helpful.