Basic CLI commands every developer should know
Working in the command line feels intimidating at first, but once you understand the core idea behind it, basic CLI commands become some of the most powerful tools in your workflow. Before exploring them, it helps to know how the command line works and why developers rely on it.
The Command Line Interface is a text-based way to interact with your computer. Instead of clicking through menus, you type commands to perform actions. Every command you enter follows a simple pattern: command → options → target. For example, ls -a foldername uses ls as the main command, -a as an option and foldername as the target.
Developers use the terminal because it saves time and offers more control. It handles tasks that are slow or difficult through a graphical interface. You can move through folders quickly, automate work, manage servers and run tools with fewer steps. Once you get comfortable with the basic CLI commands helps you work faster and stay focused.
Why Basic CLI commands matters
The CLI keeps your workflow clean and simple. You can create files, handle folders, read logs and run processes without opening any windows. Basic commands give you the foundation. When you understand how navigation and file handling work, advanced commands feel natural.
1. Navigating directories
pwd
Shows your current location in the system.pwd
ls
Lists all files and folders.ls
Add ls -l for details or ls -a to show hidden files.
cd
Moves you into another folder.cd foldername
Move back one level:cd ..
Move to home:cd
Navigation is one of the first things you should master. It helps you move across projects quickly.
2. Working with files and folders
touch
Creates a new empty file.touch index.html
mkdir
Creates a new folder.mkdir project
cp
Copies files or folders.cp file.txt backup.txt
Copy a folder:cp -r folder newfolder
mv
Moves or renames files.
Rename a file:mv oldname.txt newname.txt
Move a file:mv file.txt folder/
rm
Deletes files.rm test.txt
Delete a folder:rm -r foldername
These commands help you manage files quickly. They are faster than opening and clicking through file explorers.
3. Viewing file content
cat
Shows the full content of a file.cat notes.txt
head
Displays the first few lines.head notes.txt
tail
Shows the last few lines.tail notes.txt
These are especially useful for reading logs and checking outputs.
4. Searching and filtering
grep
Finds text inside files.grep "error" logfile.txt
Understanding grep saves you time when searching through large files or locating issues.
5. System and process handling
top
Shows running processes and system usage.top
kill
Stops a running process.kill 1234
(Replace 1234 with the process ID)
clear
Clears the terminal screen.clear
The terminal reads your input through the shell. When you press Enter, the shell interprets the command and sends it to the system. The result appears on your screen.
6. Working with permissions
chmod
Changes file permissions.chmod 755 script.sh
sudo
Runs a command with admin rights.sudo apt update
Use these only when needed because they affect system behaviour.
7. Installing software
Depending on your system, you will use one of these:
Ubuntu or Debian:sudo apt install packagename
CentOS or Fedora:sudo yum install packagename
macOS (Homebrew):brew install packagename
Learning the package manager makes installing and updating tools easier.
Best practices for beginners
- Create a small test folder to practice safely.
- Use
rm -iif you want confirmation before deleting. - Use Tab autocomplete to avoid typing mistakes.
- Keep a simple notes file for commands you use often.
- Start slow and build your confidence with each new task.
Conclusion
The command line feels unfamiliar at first, but it becomes simple once you understand the theory behind how commands work. Start with these basic CLI commands and practice them in small projects. With regular use, the terminal becomes a natural part of your workflow and helps you work faster with more control.


