DEV Community

Anil K Tiwari
Anil K Tiwari

Posted on

The Ultimate Linux Cheatsheet for Beginners

Welcome to the world of Linux! If you're new to this powerful and open-source operating system, you might find it a bit overwhelming at first. But fear not, we've got your back. In this blog post, we'll provide you with a Linux cheatsheet for beginners that includes essential commands and code snippets to help you get started on your Linux journey.

Getting Started

  1. Basic Terminal Commands:
  • ls: List files and directories in the current directory.
  • pwd: Print the working directory (your current location in the file system).
  • cd: Change directory. Use cd <directory> to navigate.
  • mkdir: Create a new directory. For example, mkdir my_folder.
  • touch: Create an empty file. For example, touch my_file.txt.
  • rm: Remove files or directories. Use with caution, as it's irreversible. For example, rm my_file.txt or rm -r my_folder (to remove a directory and its contents).
  1. File and Text Manipulation:
  • cat: Display the content of a file. Example: cat myfile.txt.
  • cp: Copy files or directories. Example: cp file1.txt file2.txt (copies file1.txt to file2.txt).
  • mv: Move or rename files or directories. Example: mv old_name new_name.
  • nano or vim: Text editors for creating and editing files. Example: nano my_file.txt.
  • grep: Search for text within files. Example: grep "search_term" file.txt.

User and Permissions

  1. User Management:
  • whoami: Display your current username.
  • sudo: Execute commands with superuser privileges. Example: sudo apt update.
  1. Permissions:
  • chmod: Change file permissions. Example: chmod 755
  • chown: Change file ownership. Example: chown user:group myfile.txt.

Package Management

  1. Package Managers:
  • apt-get (Debian/Ubuntu) or yum (Red Hat/CentOS): Package managers to install, update, and remove software.
  • Example: sudo apt-get install package_name.

File System

  1. File System Navigation:
  • /: The root directory.
  • ~: The home directory of the current user.
  • ..: Parent directory.
  • .: Current directory.


  1. Network Commands:
  • ping: Check network connectivity. Example: ping
  • ifconfig or ip: Display network interfaces and configurations.
  • ssh: Securely connect to remote machines. Example: ssh username@hostname.

Processes and System Information

  1. Processes:
  • ps: List running processes.
  • top: Display real-time system statistics.
  • kill: Terminate processes by their process ID (PID).
  1. System Information:
  • uname: Display system information. Example: uname -a.
  • df: Show disk space usage.
  • free: Display system memory usage.


This Linux cheatsheet for beginners should serve as a handy reference as you start your Linux journey. Remember that practice makes perfect, and the more you use these commands, the more comfortable you'll become with the Linux command line.

Linux is a versatile and powerful operating system, and mastering it can open up a world of possibilities for software development, system administration, and more. So, don't be afraid to experiment and explore further. Happy Linuxing!

Top comments (0)