Basic Linux Commands which makes your life easier

Before learning Linux commands lets talk about what is Linux?

Linux is an open-source operating system that powers many computers, servers, and devices worldwide. Imagine it as the conductor of a grand orchestra — the one who coordinates all the musicians (software programs) to play harmoniously together. Here are some key points:

  1. Open Source: Unlike some other operating systems, Linux is like an open book. Anyone can read it, modify it, and even contribute to it. It’s like a community-driven masterpiece! 📖

  2. Variety of Flavors: Linux comes in different flavors (called distributions or distros). Each distro has its own unique style and features. It’s like having a wardrobe full of different outfits for different occasions! 👗

  3. Command Line Magic: In Linux, you can use special commands (typed in a terminal) to perform tasks. It’s like casting spells to make things happen. For example, ls shows files, and sudo gives you superpowers! 🧙‍♂️

  4. Stability and Security: Linux is like a sturdy castle — it’s reliable and secure. It’s used in servers, smartphones, and even space missions! 🏰

  5. Community Love: Linux enthusiasts are passionate and supportive. It’s like being part of a global family where everyone helps each other out! 🤗

Let’s learn some basic commands in Linux.

  1. ls: List directories. Example: ls -l lists files in a detailed format.

  2. pwd: Print working directory. Example: pwd shows the current directory path.

  3. cd: Navigate through directories. Example: cd /path/to/directory changes to the specified directory.

  4. mkdir: Create directories. Example: mkdir my_folder makes a new folder named “my_folder.”

  5. mv: Move or rename files. Example: mv file.txt new_location/ moves the file to a different location.

  6. cp: Copy files. Example: cp file.txt backup/ makes a copy of the file in the “backup” folder.

  7. rm: Delete files or directories. Example: rm file.txt removes the file.

  8. touch: Create blank files. Example: touch new_file.txt makes an empty file.

  9. ln: Create symbolic links (shortcuts). Example: ln -s target_file link_name creates a symbolic link.

  10. clear: Clear the terminal display. Example: clear removes previous output.

  11. cat: Show file contents. Example: cat file.txt displays what's inside “file.txt.”

  12. echo: Print text. Example: echo "Hello, World!" prints the text you type.

  13. less: View large files page by page. Example: less large_file.txt lets you scroll through big files.

  14. man: Read the manual for commands. Example: man ls shows the manual for the ls command.

  15. uname: Get basic OS info. Example: uname -a shows system details.

  16. whoami: Find out your username. Example: whoami tells you the current user.

  17. tar: Compress or extract files. Example: tar -cvf archive.tar files/ creates a tar archive.

  18. grep: Search for text in files. Example: grep "pattern" file.txt finds lines with the pattern.

  19. head: Show the top lines of a file. Example: head -n 10 file.txt displays the first 10 lines.

  20. tail: Show the bottom lines of a file. Example: tail -n 5 file.txt shows the last 5 lines.

0
Subscribe to my newsletter

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

Written by

Sundaresan Anandan
Sundaresan Anandan

I am a tech enthusiast and have dedicated 5+ years of experience in software development. Currently, I am working as a solution engineer. Here my responsibilities are to directly interact with customers and fellow developers, then identify their pain points and figure out the solutions. Apart from that, I spent plenty of time code along with other developers, writing technical documents and preparing architecture diagrams.