60 Linux Commands you NEED to know (in 10 minutes)
3 min read
2 months ago
Published on Sep 03, 2024
This response is partially generated with the help of AI. It may contain inaccuracies.
Table of Contents
Introduction
This tutorial covers 60 essential Linux commands that every user should know, whether you're a beginner or a seasoned pro. Mastering these commands will enhance your efficiency and productivity while using the Linux terminal.
Step 1: Connecting to Remote Servers
- ssh: Secure Shell, used to connect to remote servers.
- Example:
ssh user@hostname
- Example:
Step 2: Navigating the File System
- ls: List directory contents.
- Usage:
ls -l
for detailed listing.
- Usage:
- pwd: Print the current working directory.
- cd: Change directory.
- Example:
cd /path/to/directory
- Example:
Step 3: File and Directory Management
- touch: Create an empty file.
- Example:
touch filename.txt
- Example:
- mkdir: Create a new directory.
- Example:
mkdir new_directory
- Example:
- cp: Copy files or directories.
- Example:
cp source.txt destination.txt
- Example:
- rm: Remove files.
- Example:
rm filename.txt
- Example:
- rmdir: Remove an empty directory.
- Example:
rmdir empty_directory
- Example:
- ln: Create a symbolic link.
- Example:
ln -s target_file link_name
- Example:
Step 4: Viewing and Editing Files
- cat: Display file contents.
- Example:
cat file.txt
- Example:
- nano: Simple text editor.
- Usage:
nano filename.txt
- Usage:
- vim: Advanced text editor.
- Usage:
vim filename.txt
- Usage:
- less: View file contents one screen at a time.
- Example:
less file.txt
- Example:
- head: View the top lines of a file.
- Example:
head -n 10 file.txt
- Example:
- tail: View the bottom lines of a file.
- Example:
tail -n 10 file.txt
- Example:
Step 5: System Information
- whoami: Display the current user.
- uname: Show system information.
- Usage:
uname -a
for detailed info.
- Usage:
- free: Display memory usage.
- df: Show disk space usage.
- top: Monitor system processes in real-time.
- htop: Enhanced version of top (requires installation).
Step 6: User Management
- useradd: Create a new user.
- Example:
useradd newuser
- Example:
- passwd: Change user password.
- sudo: Execute commands with superuser privileges.
- Example:
sudo command
- Example:
- su: Switch user.
- adduser: Add a user with a home directory.
Step 7: Networking Commands
- ping: Check connectivity to a host.
- Example:
ping google.com
- Example:
- ifconfig: Display network interfaces (may require installation).
- ip address: Show IP address information.
- netstat: Display network connections.
- ss: Socket statistics.
- iptables: Manage firewall rules.
- ufw: Uncomplicated Firewall, easier firewall management.
- Example:
ufw enable
- Example:
Step 8: File Compression
- zip: Compress files into a ZIP archive.
- Example:
zip archive.zip file1 file2
- Example:
- unzip: Extract files from a ZIP archive.
- Example:
unzip archive.zip
- Example:
Step 9: Searching and Sorting
- grep: Search for text in files.
- Example:
grep 'search_term' file.txt
- Example:
- awk: Pattern scanning and processing language.
- find: Search for files in a directory hierarchy.
- Example:
find /path -name filename
- Example:
- sort: Sort lines of text files.
- Example:
sort file.txt
- Example:
- diff: Compare files line by line.
- Example:
diff file1.txt file2.txt
- Example:
Step 10: System Management
- systemctl: Control the systemd system and service manager.
- Example:
systemctl restart service
- Example:
- reboot: Restart the system.
- shutdown: Shut down the system.
- Example:
shutdown now
- Example:
Conclusion
This guide covers vital Linux commands that will streamline your workflow and enhance your command-line skills. Practice regularly to become proficient, and consider exploring more advanced topics as you become comfortable with these basics. For further learning, consider diving into Linux tutorials or courses to deepen your knowledge.