Command Line Interface :

In today’s fast-growing world. It’s necessary to know about CLI. If you are a Developer knowing about your terminal can increase your efficiency, boost your problem-solving ability, and to understand how the system works.
In this blog, we will understand we will explore essential CLI commands we should know.
What is a command Line Interface?
The shell provides an interface to Linux where you can type or enter commands using the keyboard. It is known as the command-line interface (CLI). It allows users to execute commands and scripts to perform tasks, automate processes, and manage system resources.
Benefits of using CLI Commands :
Speed: CLI tasks are faster than navigating GUIs
Automation: Scripts can automate repetitive tasks, saving time and effort.
Efficiency: CLIs can be faster than GUIs for certain tasks, especially when working with multiple files or running scripts
Accessibility: Some tools and services only offer a CLI interface.
How Does CLI Work?
You type a command in the terminal.
The shell reads it: The shell is a program that reads your command and figures out what you want.
The shell sends instructions to the OS: Based on what you typed it tells the OS what to do.
The OS does the task.
The shell shows the result.
Some Basic CLI Commands:
Bread and Butter Commands - all important:
man:
Usage: Shows the manual for any command.
Example: man ls
cd :
Usage: Changing directories.
Example: cd dir1.
mkdir
Usage: Creating directories.
Example: mkdir dir1.
mv
Usage: Move or rename files.
Example: mv file1.txt dir1/
cp
Usage: Copy files or directories.
Example: cp -r dir1 dir2.
ls
Usage: List directory contents.
Common flags:
-a: show hidden files
-t: sort by time
-r: reverse order
-lh: long list with human-readable sizes
pwd
Usage: Shows present working directories
chmod
Usage: Change file permissions.
Example: chmod 755 a.text
OS/Process Related Commands:
ps, top
ps - view processes
top -real-time system monitoring
df, free
df - disk usage
free - RAM usage
uname
Usage: System Information
Example: uname -a
lspci
Usage: List PCI devices (including sound, and network cards).
Network Related Commands:
ping, ifconfig, ssh
ping: test network
ifconfig: network config
ssh: remote login
Tips for Using Command Line Interface :
Tab: Auto-completes file and folder names
Piping: Use the pipe symbol (|) to connect commands and process output.
history: Shows all the commands you’ve typed recently.
Ctrl + L: clears the terminal screen.
Practice: Experiment with different commands and explore the possibilities of automation.
What is the shell?
Shell = the middleman between you and the OS.
Popular shells you might hear about:
Bash (Bourne Again Shell) is → most common.
zsh (Z Shell) → fancier, customizable.
fish (Friendly Interactive Shell) → very beginner-friendly
If you wanna about your current shell type the below command in your shell
cat /etc/shells
Conclusion
The CLI is a valuable tool for developers, system administrators, and anyone who needs precise control and automation capabilities. While GUIs are more common for general use, CLIs remain essential for specific tasks and remain a powerful interface for interacting with computer systems.
Remember: Every tech giant you admire started by typing ls for the first time.
Subscribe to my newsletter
Read articles from Manav Gupta directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
