20 Essential Linux Commands for Beginners

min read

20 Essential Linux Commands for Beginners

Linux is a powerful and versatile operating system, widely used for servers, development, and personal computing. For beginners, the command-line interface (CLI) can seem daunting, but mastering a few essential commands can greatly enhance your Linux experience. This blog post introduces 20 fundamental commands to get you started.

1. `pwd` (Print Working Directory)

pwd displays the current directory you are in.

bash
pwd
   # Output: /home/user/documents

2. `ls` (List)

ls lists files and directories in the current directory. Useful options include -l for detailed output, -a to show hidden files, and -h for human-readable sizes.

bash
ls
   # Output: file1.txt file2.txt directory1
   ls -la

3. `cd` (Change Directory)

cd changes the current directory. Use cd .. to go up one level.

bash
cd documents
   cd ..

4. `mkdir` (Make Directory)

mkdir creates a new directory.

bash
mkdir new_directory

5. `rmdir` (Remove Directory)

rmdir removes an empty directory.

bash
rmdir empty_directory

6. rm (Remove)

rm deletes files. Use -r to remove directories and their contents recursively, and -f to force removal (without prompting). Use with caution!

bash
rm file.txt
   rm -rf directory

7. cp (Copy)

cp copies files and directories. Use -r to copy directories recursively.

bash
cp file.txt new_file.txt
   cp -r directory new_directory

8. `mv` (Move/Rename)

mv moves or renames files and directories.

bash
mv file.txt new_location/
   mv old_name.txt new_name.txt

Working with Files

9. `cat` (Concatenate)

cat displays the content of a file. It can also concatenate multiple files.

bash
cat file.txt
   cat file1.txt file2.txt > combined.txt

10. `less` (Less is More)

less displays file content page by page, allowing navigation within the file. Use Space to go forward, b to go back, and q to quit.

bash
less large_file.txt

11. `head`

head displays the first lines of a file (default: 10 lines).

bash
head file.txt
   head -n 20 file.txt # Display the first 20 lines

12. `tail`

tail displays the last lines of a file (default: 10 lines). Useful with -f to follow changes in a file (e.g., log files).

bash
tail file.txt
   tail -f log_file.log

13. `touch`

touch creates an empty file or updates the access and modification time of an existing file.

bash
touch new_file.txt

14. `find`

find searches for files and directories based on various criteria (name, size, etc.).

bash
find . -name "file.txt"  # Find files named "file.txt" in the current directory and subdirectories
    find /path/to/search -type d # Find all directories

System Information and Processes

15. `man` (Manual)

man displays the manual page for a command, providing detailed information and options.

bash
man ls

16. `echo`

echo displays text or variables to the terminal.

bash
echo "Hello, world!"
    echo $HOME # Display the value of the HOME environment variable

17. history

history displays a list of previously executed commands.

bash
history

18. ps (Process Status)

ps displays information about running processes. Common options include aux for a detailed list of all processes.

bash
ps aux

19. top

top displays a dynamic real-time view of running processes, including CPU and memory usage.

bash
top

20. kill

kill sends a signal to a process. The most common signal is SIGTERM (15) to request termination. You'll need the process ID (PID), which you can get from ps or top. Use kill -9 (SIGKILL) as a last resort, as it forcefully terminates the process.

bash
kill 1234
    kill -9 5678

Conclusion

These 20 commands provide a solid foundation for navigating and interacting with the Linux command-line. Practice using them regularly, and you'll quickly become more comfortable and efficient in your Linux environment. Remember to consult the man pages for more detailed information about each command and its options. Happy Linuxing!

---

🚀 Continue Your Linux Journey

This essential commands guide connects to our comprehensive Linux mastery series!

Ready for Structured Learning? Start with our complete Linux series:

📚 Complete Linux Series Navigation

Beginner Skills (Start Here!):

  • Part 1: Linux Introduction - Start your Linux journey
  • Part 2: Terminal Commands - Master the command line
  • Part 3: File Management - Organize files and directories
  • Part 4: Permissions & Security - Control access and security
  • Part 5: Filesystem Hierarchy - Understand Linux structure

    This guide covers similar concepts to Parts 2-3 of our structured series. Continue with the organized curriculum for systematic learning!

  • - Linux Terminal Commands - Detailed command explanations

  • File Management - Advanced file operations
  • Linux Permissions - Security and access control

  • 🏆 Next Steps

    After mastering these basics, explore:

  • Intermediate: Text processing, package management, user administration
  • Advanced: System administration, networking, automation
  • Expert: Performance tuning, security hardening, shell scripting

    ---

    Ready for systematic Linux mastery? Start with our structured series to build comprehensive skills step-by-step!

  • Made With Love on