> ## Content Index
> Fetch the complete content index at: https://artofinfra.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Linux Cheatsheet - General Commands
- URL: https://artofinfra.com/tldr/linux-cheatsheet-general-commands/
- Published: 2025-07-25T18:06:50.000Z
- Updated: 2026-02-10T19:46:38.000Z
- Description: We've put together a list and a PDF cheatsheet of the most commonly used Linux commands (of any flavour) as a reference for all.
- Author: Dan Jones
- Tags: TLDR, #dan-2, Linux, #Import 2025-08-21 13:12

Here, I've put together some of the most used commands you'll use when working with Linux, in any flavour, in a neat cheat sheet.

Below, you'll find the commands in code-blocks as well as a nifty PDF that you can print off to hang on your wall and show off to all your friends! *(if that's your thing)*

[Linux General CheatsheetA nifty looking Linux cheatsheet to hang on your wall.Linux General Cheatsheet.pdf101 KBdownload-circle](https://artofinfra.com/content/files/2025/07/Linux-General-Cheatsheet.pdf "Download")

## File and Directory Commands

```bash
$ ls       [ls -la]                  # List directory contents
$ cd       [cd /var/log]             # Change the current directory
$ pwd      [pwd]                     # Print the current directory path
$ mkdir    [mkdir new_folder]        # Create a new directory
$ cp       [cp file.txt /backup/]    # Copy files or directories
$ mv       [mv old.txt new.txt]      # Move or rename files/ directories
$ rm       [rm file.txt]             # Deletes files or directories
$ touch    [touch myfile.txt]        # Create an empty file
$ find     [find / -name '*.log']    # Search files in a directory tree

```

## File Viewing and Text Processing

```bash
$ cat      [cat file.txt]                 # Display file content
$ nano     [nano config.cfg]              # Simple terminal text editor
$ less     [less file22.txt]              # View file one page at a time
$ head     [head -n 20 file.txt]          # Show first X amount of lines
$ tail     [tail log.txt]                 # Show last lines of file
$ grep     [grep 'error' logfile.txt]     # Search text patterns in files
$ sort     [sort names.txt]               # Sort lines in text
$ wc       [wc file.txt]                  # Count lines, words, bytes
$ sed      [sed 's/old/new/g']            # Find and replace in text
$ awk      [awk '{print $1}' file.txt]    # Pattern scanning and text processing
$ diff     [diff file1.txt file2.txt]     # Compare files line by line

```

## System and Process Management

```bash
$ uname    [uname -a]                # Shows system information
$ whoami   [whoami]                  # Displays current username
$ free     [free -h]                 # Show memory usage
$ df       [df -h]                   # Show disk space usage
$ du       [du -sh *]                # Estimate file space usage
$ ps       [ps aux]                  # Display running processes
$ top      [top]                     # Monitor processes and utilisation live
$ kill     [kill -9 1234]            # Terminate a process by ID

```

## User/Permissions and Shell/Utilities

```bash
$ sudo     [sudo apt update]                 # Run command as super user
$ passwd   [passwd]                         # Change password
$ tar      [tar -czvf file.tar.gz folder/]  # Archive file
$ echo     [echo $HOME]                     # Print text or variables
$ which    [which python3]                  # Locate executable path
$ man      [man grep]                       # Display command manual
$ alias    [alias ll='ls -la']              # Create a command shortcut

```

---

If you feel additional commands would be handy to have here and help others, please let me know in the comments and I'll ensure to update it/ include an additional page in the PDF.