Ultimate Coding Cheat Sheet 2025: Linux, Git, SQL & CMD Commands

By

Liz Fujiwara

Oct 22, 2025

Stylized illustration of hands interacting with code editor windows labeled JAVA and C++, representing essential programming tools, shortcuts, and tips featured in the ultimate coding cheat sheet.
Stylized illustration of hands interacting with code editor windows labeled JAVA and C++, representing essential programming tools, shortcuts, and tips featured in the ultimate coding cheat sheet.
Stylized illustration of hands interacting with code editor windows labeled JAVA and C++, representing essential programming tools, shortcuts, and tips featured in the ultimate coding cheat sheet.

This Linux commands cheat sheet provides a comprehensive collection of essential commands to help you navigate, manage, and troubleshoot your Linux system efficiently. Whether you’re a beginner learning the basics or an experienced user looking for a quick reference, these commands cover everything from file management and system monitoring to process control and user permissions.

By mastering these foundational commands, you can perform everyday administrative tasks more effectively, automate workflows, and increase your overall Linux proficiency. Keep this guide handy to boost your command-line confidence and streamline your work in any Linux environment.

Key Takeaways

  • Mastering essential file, directory, and process management commands in Linux and Windows can significantly boost your coding efficiency.

  • Understanding and managing file permissions, environment variables, and user accounts are crucial for maintaining system security and control.

  • Familiarity with Git, SQL, and CMD commands improves your ability to manage code, work with databases, and navigate system environments effectively.

Essential File and Directory Commands

A cheat sheet displaying essential file and directory commands for Windows and Linux.

Navigating and manipulating your file system is a vital skill in coding. Whether you’re working on Linux or using the Command Prompt in Windows, mastering file and directory commands can significantly boost your efficiency.

The ls command lists the contents of a directory, while cd changes the current directory to a specified path. The cp command allows you to copy files and directories, supporting recursive copying for entire directories. The mv command is used to move or rename files and directories, a handy tool for organizing your workspace. Lastly, the rm command removes files and directories, helping you clean up unnecessary clutter.

Creating directories is a breeze with the mkdir command, which allows you to build a structured folder system from the ground up. By mastering these commands, you’ll effortlessly navigate your current working directory, change directories, and manage your files and folders with confidence.

Managing File Permissions

Linux file permissions are key to maintaining security and control over your files and directories. These permissions dictate user access levels, safeguarding sensitive data. Permissions can be assigned to the owner, group members, and others, offering flexibility in access control.

The chmod command is your go-to tool for changing file permissions, using both numeric and symbolic modes. Numeric mode represents permissions with a three-digit octal value, while symbolic mode uses characters such as r for read, w for write, and x for execute.

Additionally, the chown command changes the owner of a file, and chgrp modifies group ownership, giving you complete control over who can access and modify your files.

Text Processing Commands

Text processing commands are fundamental for handling text files in Linux. They enable efficient searching, modification, and data extraction, making them essential for developers and system administrators.

The cat command displays the contents of a file, making it easy to view and concatenate text files. For searching specific text patterns within files, grep is your best friend. It utilizes regular expressions for powerful and flexible searching, with options like -l to list files containing a pattern and -L for non-matching lines.

awk

It takes text processing to the next level by functioning as a programming language, enabling:

  • Arithmetic operations on text data

  • Comparisons on text data

  • Computing average values within a dataset by accumulating totals and dividing by the number of records in data science

For advanced text manipulation, sed (Stream Editor) is the tool of choice. It allows you to replace specific strings throughout a file using commands like s/old-string/new-string/g. With these commands, you’ll handle text strings and processes like a pro.

Process Management

Managing processes is essential for maintaining system performance and stability. Mastering process management commands allows you to monitor, control, and optimize processes in real time.

The top command provides a dynamic view of running processes, updating in real time with information on CPU and memory usage. For a more detailed snapshot, ps aux displays all processes on the system along with user, CPU, and memory usage. When you need to terminate a process, the kill command sends signals to processes, with the default being the TERM signal for graceful termination. If you need to terminate all instances of a specific process name, killall simplifies the task.

Adjusting process priority is crucial for proper resource allocation. The nice command sets the priority of a process, while renice modifies the priority of an already running process. To quickly retrieve the process ID of a running process by name, pgrep is your go-to command. With these commands, you’ll manage processes with precision and efficiency.

System Information Commands

A visual representation of system information commands used in Windows and Linux.

Understanding your system’s state is crucial for effective management and troubleshooting. System information commands offer insights into the operating system, memory usage, disk space, and more.

The uname command provides basic information about the operating system, including the kernel name and version. For memory usage, free gives an overview of total, used, free, and cached memory. The uptime command shows how long the system has been running and the load average over the last 1, 5, and 15 minutes, offering a quick snapshot of system performance.

Disk space management is essential for avoiding storage issues. The df command displays the amount of disk space used and available, with the -h option making the output human-readable. Similarly, du estimates the disk space used by files or directories, helping you manage storage efficiently.

Networking Commands

Networking commands are vital for managing and troubleshooting network connections. They help verify connectivity, manage interfaces, and securely transfer files between hosts.

The ifconfig command is used to configure and display network interfaces, providing critical information about IP addresses and network status. To verify the reachability of a remote host, ping sends ICMP echo requests and checks for responses, confirming host availability. For a more detailed view of network connections and routing tables, netstat is invaluable.

Securely connecting to remote machines is simple with ssh, which provides encrypted connections over a TCP/IP network. When you need to copy files securely between hosts, scp utilizes SSH encryption to ensure data integrity. With these tools, you’ll manage network connections with confidence and security.

Disk Management Commands

Effective disk management is essential for system performance and data integrity. Mastering disk management commands allows you to create, modify, and manage disk partitions easily.

The fdisk command enables you to manage disk partitions interactively, offering options for creating, deleting, and modifying partitions. Once partitions are set up, mkfs creates filesystems on those partitions, with mkfs.ntfs specifically formatting NTFS partitions.

Mounting and unmounting filesystems are essential tasks for accessing and managing data. The mount command integrates a filesystem into the Linux directory structure, while umount safely detaches it, ensuring all data is written before removal. These commands are fundamental for effective disk management.

Environment Variables

Environment variables store configuration settings and system information, making them crucial for development and system administration. They enable applications to retrieve necessary data and customize their behavior.

You can view all current environment variables and their values using the printenv command. To create or update an environment variable, use the export command followed by the variable name and value. If you need to remove an environment variable, the unset command comes into play.

By mastering these commands, you’ll manage your environment variables efficiently, ensuring smooth application performance.

User Management Commands

User management is fundamental to system administration. It involves creating, modifying, and deleting user accounts to ensure proper access control and security.

The useradd command creates new user accounts, with options for setting home directories and default shells. To modify existing user accounts, the usermod command allows changes such as renaming users or locking accounts.

When it’s time to delete a user account and its associated resources, the userdel command handles the task, with options for forcing deletion or removing the user’s home directory. Setting or updating a user’s password is done with the passwd command, ensuring secure access control.

I/O Redirection and Piping

I/O redirection and piping are powerful techniques for managing data flow in Linux, allowing you to redirect input, output, and error streams and chain commands for complex operations.

Standard input, output, and error streams are identified as stdin (0), stdout (1), and stderr (2), respectively. You can overwrite existing files with a single bracket (>), or append data without losing prior content with double brackets (>>). To discard unwanted output, redirect it to /dev/null.

The pipe symbol (|) allows the output of one command to be used as input for another, creating powerful command chains. The tee command enables output to be displayed on the terminal while simultaneously saving it to a file, and standard error messages can be redirected to a file using 2> for error logging.

Shortcuts and Productivity Tips

A collection of productivity tips and shortcuts for command line usage.

Mastering shortcuts and productivity tips can greatly improve your efficiency and workflow, saving you time and effort for more critical tasks.

Opening a terminal quickly is a common need, and in many Linux desktop environments, you can do this using the shortcut Ctrl + Alt + T. Switching between virtual desktops is another productivity booster, achievable with shortcuts like Ctrl + Alt + Arrow keys or Ctrl + Alt + [Number]. For a quick system-wide search for files and applications, the Super key (Windows key) combined with S or Space can be a game-changer.

Reverse command search in the terminal using Ctrl + R is a powerful feature that allows you to quickly find previously entered commands, saving you from retyping complex commands. Custom keyboard shortcuts can also be created to bind frequently used commands to specific key combinations, further increasing your productivity.

Desktop widgets and extensions provide quick access to functions and shortcuts without cluttering your workspace, making your workflow smoother.

Vim Editor Commands

The Vim editor, favored by many developers for its efficiency and capabilities, can greatly enhance your text editing speed and accuracy once mastered.

Basic movement within Vim is done using h, j, k, and l for left, down, up, and right, respectively. To quickly navigate through a file, you can use gg to jump to the top and G to jump to the bottom. Deleting text is straightforward with commands like x to delete the character under the cursor and dw to delete a word.

Undoing and redoing actions are essential, with u for undo and Ctrl + R for redo. To save your changes, type :w, and to quit, type :q. Combine them as :wq to save and quit in one command. These commands form the foundation of efficient text editing in Vim.

Git Commands Cheat Sheet

A Git commands cheat sheet highlighting essential commands for version control.

Git commands are vital for version control, allowing you to manage codebase changes effectively. This cheat sheet provides key commands to get you started and stay productive.

To initialize a new repository, use git init, and to clone an existing repository, the command is git clone <url>. Pushing your changes to the remote repository is done with git push origin <branch>, while pulling changes and merging them into your current branch is achieved with git pull origin <branch>.

Staging changes for all files is done with git add ., and to discard all unstaged changes in a file, use git restore <file>.

Creating and managing branches is straightforward with git switch -c <name> to create a new branch and git branch -d <name> to delete one. To undo the most recent commit while keeping your changes, git reset HEAD^ comes in handy.

Viewing the differences between staged and unstaged changes is done with git diff HEAD, and for a concise history of a branch, use git log --oneline. These commands will help you manage your repositories with ease.

SQL Commands Cheat Sheet

SQL commands are essential for managing and querying databases. This cheat sheet covers the key commands for working with SQL databases effectively.

To create a new database, use the CREATE DATABASE command. Inserting new records into a table is done with INSERT INTO, and modifying existing records is achieved with the UPDATE command. Retrieving data from one or more tables is the primary function of the SELECT command, while filtering results based on specific conditions is done with WHERE.

Sorting results in ascending or descending order is handled by the ORDER BY clause, and grouping records with shared values is done using GROUP BY. Combining rows from two or more tables based on a related column is achieved with the JOIN command. Mastering these commands will enable you to manage and query your databases efficiently.

Windows CMD Commands Cheat Sheet

A cheat sheet for Windows CMD commands providing quick reference for users.

Windows CMD commands are vital for navigating and managing your Windows system from the command prompt. This cheat sheet provides key commands to boost your command-line proficiency.

The dir command lists files and directories in the current directory, while cd changes the current directory. Copying files to a different location is done with the COPY command, and moving files between directories is achieved with MOVE. To remove files from the system, use DEL or ERASE.

For process management, the TASKLIST command provides a list of active processes running on the system. These commands will help you navigate and manage your Windows environment effectively from the command prompt.

Summary

We’ve covered a comprehensive range of commands across Linux, Git, SQL, and Windows CMD. Each section provided essential commands and their applications, empowering you to navigate, manage, and optimize your systems with confidence. By mastering these commands, you’ll greatly enhance your productivity and efficiency.

Remember, these skills are not only valuable for individual development but also crucial for maintaining and managing systems. Keep this cheat sheet handy, and you’ll be well on your way to becoming a command-line pro!

FAQ

How can I navigate directories in Linux?

How can I navigate directories in Linux?

How can I navigate directories in Linux?

What command is used to change file permissions in Linux?

What command is used to change file permissions in Linux?

What command is used to change file permissions in Linux?

How do I view active processes in Linux?

How do I view active processes in Linux?

How do I view active processes in Linux?

How can I securely copy files between hosts?

How can I securely copy files between hosts?

How can I securely copy files between hosts?

What is the command to create a new Git repository?

What is the command to create a new Git repository?

What is the command to create a new Git repository?