The command-line interface (CLI) is a powerful tool for interacting with your computer's operating system. Whether you're a beginner or an experienced user, mastering essential shell commands can significantly enhance your productivity and efficiency. In this guide, we'll explore a comprehensive list of essential shell commands that every user should know.
0. System Information
uname: Print system information
uname -a # All information
df: Display disk space usage
df -h # Human-readable format
top: Display Linux processes
top htop
sudo command: to run any command as super user
sudo command
1. Navigation Commands
cd: Change directory
cd directory_name
pwd: Print current working directory
pwd
ls: List directory contents
ls ls -l # Detailed list ls -a # Show hidden files
mkdir: Make Directory
mkdir new_directory
rmdir: Remove Directory
rmdir directory_to_remove
2. Managing files
touch: Create Empty File
touch new_file.txt
cp: Copy Files and Directories
cp file1.txt file2.txt
mv: Move/Rename Files and Directories
mv file1.txt new_directory/file1.txt mv old_name.txt new_name.txt
rm: Remove Files and Directories
rm unwanted_file.txt
3. Viewing and Editing Files
cat: Display File Content
cat file.txt
more: Paginate Through File Content
more file.txt
less: View File Content with Navigation
less file.txt
nano/vi: Simple Text Editor
nano file.txt vi file.txt
4. Process Management
ps: List Running Processes
ps
kill: Terminate a Process
kill process_id
5. Networking
ping: test the reachability of a host on Internet
ping hostname ping https://www.google.com
ifconfig/ip: Display network configuration
ifconfig ip addr show
ssh: Securely connect to a remote server
ssh username@hostname