Introduction to Linux Command Line: 20 Commands Every Beginner Should Know

Sanjoy SahaSanjoy Saha
4 min read

Here is a beginner-friendly blog on essential Linux commands for beginners to start with Linux command line.


Introduction

The Linux command line might seem a little odd at first, but it’s a powerful tool that gives you full control over your system. Knowing these commands can help you to navigate and manage tasks quickly and efficiently. In this guide, we will walk you through 20 of the most important Linux commands that every beginner should know.

Whether you are Linux OS or using Windows Subsystem for Linux (WSL), these commands will be your foundation.


1. ls - List Files and Directories

  • Usage: ls

  • Description: It lists all files, folders and directories in the current directory.

  • Example:

      ls
    
  • Tip: Use ls -l for detailed information (file permissions, size, date) and ls -a to include hidden files.


2. cd - Change Directory

  • Usage: cd <directory_name>

  • Description: It navigates between directories.

  • Example:

      cd Documents
    
  • Tip: Use cd .. to go up one level in the directory tree.


3. pwd - Print Working Directory

  • Usage: pwd

  • Description: Displays the full path of the current directory.

  • Example:

      pwd
    

4. mkdir - Make Directory

  • Usage: mkdir <directory_name>

  • Description: Creates a new directory.

  • Example:

      mkdir NewFolder
    

5. rmdir - Remove Directory

  • Usage: rmdir <directory_name>

  • Description: Deletes the directory.

  • Example:

      rmdir OldFolder
    

6. touch - Create a New File

  • Usage: touch <file_name>

  • Description: Creates an empty file.

  • Example:

      touch file.txt
    

7. cp - Copy Files and Directories

  • Usage: cp <name of file> <destination>

  • Description: Copies files or directories from one location to another.

  • Example:

      cp file.txt /home/user/Documents/
    

8. mv - Move or Rename Files and Directories

  • Usage: mv <source> <destination>

  • Description: Moves files or renames them.

  • Example:

      mv file.txt /home/user/Downloads/
    

9. rm - Remove Files and Directories

  • Usage: rm <file_name>

  • Description: Deletes files or directories (use with caution!).

  • Example:

      rm file.txt
    
  • Tip: Use rm -r to delete directories and their contents recursively.


10. cat - View File Contents

  • Usage: cat <file_name>

  • Description: Displays the contents of a file.

  • Example:

      cat file.txt
    

11. nano - Edit Files

  • Usage: nano <file_name>

  • Description: Opens the file in the Nano editor.

  • Example:

      nano file.txt
    
  • Press Ctrl + O (not zero) to save the file and Ctrl + X to exit.


12. head - View First Few Lines of a File

  • Usage: head <file_name>

  • Description: Displays the first 10 lines of a file.

  • Example:

      head file.txt
    
  • Tip: Use head -n <number> to display a specific number of lines.


13. tail - View Last Few Lines of a File

  • Usage: tail <file_name>

  • Description: Shows the last 10 lines of a file.

  • Example:

      tail file.txt
    

14. grep - Search Text in Files

  • Usage: grep <pattern> <file_name>

  • Description: Searches for specific text patterns in files.

  • Example:

      grep "Linux" file.txt
    

15. find - Search for Files and Directories

  • Usage: find <directory> -name <file_name>

  • Description: Locates files and directories.

  • Example:

      find /home/user -name file.txt
    

16. chmod - Change File Permissions

  • Usage: chmod <permissions> <file_name>

  • Description: Modifies file permissions.

  • Example:

      chmod 755 script.sh
    

17. chown - Change File Ownership

  • Usage: chown <owner>:<group> <file_name>

  • Description: Changes file ownership.

  • Example:

      chown user:group file.txt
    

18. ps - View Running Processes

  • Usage: ps

  • Description: Shows currently running processes.

  • Example:

      ps aux
    

19. kill - Terminate Processes

  • Usage: kill <process_id>

  • Description: Terminates processes by their ID.

  • Example:

      kill 1234
    

20. man - Manual Pages for Commands

  • Usage: man <command>

  • Description: Provides a detailed manual for a command.

  • Example:

      man ls
    

Conclusion

Learning these 20 commands will give you confidence to work on the Linux command line. As you practice, you’ll find that the command line is not only useful but also efficient. If you want to know how to use Linux commands on your Windows System, refer to my Blog on Installing Ubuntu (https://sanjoysblog.hashnode.dev/using-linux-on-windows-a-beginners-guide-to-installing-ubuntu-via-wsl)


With these commands, beginners will be ready to navigate and learn Linux environment with ease. Let me know if you'd like any further additions. Happy exploring!

0
Subscribe to my newsletter

Read articles from Sanjoy Saha directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Sanjoy Saha
Sanjoy Saha

👋 I'm a B.Tech graduate in Computer Science and Engineering from Netaji Subhash Engineering College, Kolkata. 💻 During my studies, I gained a strong foundation in programming, data structures, and algorithms, along with advanced knowledge in Operating Systems, Database Management, and Computer Networks. 🤝 Outside the classroom, I participated in coding competitions and hackathons, which enhanced my problem-solving skills and fostered teamwork. 💪 Skills: Programming: C++, JavaScript Frontend Development: HTML5, CSS3, JavaScript, Bootstrap, React JS Developer Tools: VS Code, Git, GitHub, MySQL 🔍 I'm passionate about learning and excited to start my career in computer science, aiming to use my skills to create innovative solutions that make a positive difference. 💬 Reach out at: sanjoysaha0524@gmail.com Thank you!