Linux in One Shot - The Ultimate Cheat Sheet

    Linux in One Shot - The Ultimate Cheat Sheet

    A quick Linux cheat sheet with essential commands for files, processes, networking, and system management. Perfect for beginners and developers who need a fast reference while working in the terminal.

    default profile

    Shreyash Gurav

    March 05, 2026

    7 min read

    Linux in One Shot - The Ultimate Cheatsheet

    Linux in One Shot – The Ultimate Cheatsheet is a compact reference guide that brings together the most important Linux concepts, commands, and tools in one place. It is designed for developers, system administrators, and students who want a quick yet practical overview of Linux without going through lengthy documentation. From basic terminal commands and file management to permissions, networking, and process control, this cheatsheet provides concise explanations and organized command tables for fast learning and easy reference.

    Introduction to Linux#

    Linux is an open-source Unix-like operating system kernel first released by Linus Torvalds in 1991. It powers everything from servers and embedded systems to desktops and mobile devices. The operating system is distributed through various packages called distributions, with popular ones including Ubuntu, CentOS, Debian, and Fedora. Understanding Linux commands and concepts is essential for developers and system administrators working with servers, cloud infrastructure, or development environments.

    Linux Architecture

    Linux File System Structure#

    The Linux file system follows the Filesystem Hierarchy Standard (FHS), organizing all files and directories under the root directory ( / ). Everything in Linux is treated as a file, including hardware devices and system processes. Understanding this hierarchy helps you navigate and manage the system effectively.

    DirectoryPurpose
    /binEssential command binaries
    /bootBoot loader files and kernel
    /devDevice files
    /etcSystem configuration files
    /homeUser home directories
    /libShared libraries and kernel modules
    /mediaMount point for removable media
    /mntTemporary mount point
    /optOptional application software
    /procVirtual filesystem for process information
    /rootRoot user's home directory
    /sbinSystem administration binaries
    /tmpTemporary files
    /usrUser utilities and applications
    /varVariable data like logs
    Linux File System Structure

    Essential Linux Commands#

    These fundamental commands form the foundation of working with Linux. Mastering them enables you to navigate the system, get help, and perform basic operations efficiently.

    CommandDescriptionExample
    manDisplay manual pagesman ls
    pwdPrint working directorypwd
    whoamiShow current usernamewhoami
    dateDisplay system date/timedate
    calShow calendarcal 2024
    echoPrint text to terminalecho "Hello World"
    clearClear terminal screenclear
    historyShow command historyhistory
    # Get help with any command man ls ls --help # Check system information uname -a hostname

    File and Directory Management#

    Navigating and manipulating files and directories are daily tasks in Linux. These commands allow you to create, move, copy, delete, and search for files efficiently.

    CommandDescriptionExample
    lsList directory contentsls -la /home
    cdChange directorycd /var/log
    mkdirCreate directorymkdir -p projects/src
    rmdirRemove empty directoryrmdir olddir
    cpCopy files/directoriescp -r source dest
    mvMove/rename filesmv file.txt newname.txt
    rmRemove filesrm -rf tempdir
    touchCreate empty filetouch newfile.txt
    findSearch for filesfind . -name "*.conf"
    locateFind files by namelocate passwd
    # Create nested directories mkdir -p projects/website/css # Copy with verbose output cp -v index.html backup/ # Find files modified in last 7 days find /home -type f -mtime -7

    File Permissions and Ownership#

    Linux uses a robust permission system to control access to files and directories. Each file has three permission sets (owner, group, others) with read, write, and execute capabilities. Understanding permissions is crucial for system security and multi-user environments.

    CommandDescriptionExample
    chmodChange file permissionschmod 755 script.sh
    chownChange file ownerchown user:group file
    chgrpChange group ownershipchgrp developers file
    umaskSet default permissionsumask 022

    Permission values:

    • r (read) = 4
    • w (write) = 2
    • x (execute) = 1
    # View file permissions ls -l filename # Make script executable for owner chmod u+x script.sh # Set specific permissions using octal notation chmod 644 document.txt chmod 755 directory/ # Change ownership recursively chown -R www-data:www-data /var/www

    Process Management#

    Processes are running instances of programs on your Linux system. Managing them effectively helps maintain system performance and troubleshoot issues. Linux provides commands to view, control, and terminate processes.

    CommandDescriptionExample
    psShow process statusps aux
    topInteractive process viewertop
    htopEnhanced process viewerhtop
    killTerminate processkill -9 PID
    pkillKill by namepkill firefox
    jobsList background jobsjobs
    bgResume in backgroundbg %1
    fgBring to foregroundfg %1
    niceSet process prioritynice -n 10 command
    reniceChange process priorityrenice +5 PID
    # Find process by name ps aux | grep nginx # Kill all processes matching pattern pkill -f "python app.py" # Run process in background long_running_task & # View process tree pstree -p
    Process Management

    Networking Commands#

    Networking commands help you configure, monitor, and troubleshoot network connections. These tools are essential for server administration, debugging connectivity issues, and ensuring services are accessible.

    CommandDescriptionExample
    pingTest network connectivityping -c 4 google.com
    ifconfigConfigure network interfacesifconfig eth0
    ipShow/manipulate routingip addr show
    netstatNetwork statisticsnetstat -tulpn
    ssSocket statisticsss -tulwn
    curlTransfer data from URLscurl -I example.com
    wgetDownload fileswget https://file.zip
    nslookupDNS lookupnslookup google.com
    digDNS informationdig example.com
    tracerouteTrace network pathtraceroute google.com
    sshSecure shell connectionssh user@hostname
    # Check if service is listening on port ss -tulpn | grep :80 # Download entire website wget -r -l 3 <https://example.com> # Test HTTP headers curl -I <https://api.github.com>

    Package Management#

    Package managers simplify software installation, updates, and removal. Different Linux distributions use different package managers, but the concepts remain similar. Understanding package management helps maintain system integrity and track installed software.

    Debian/Ubuntu (apt):

    CommandDescription
    apt updateUpdate package list
    apt upgradeUpgrade all packages
    apt installInstall package
    apt removeRemove package
    apt searchSearch packages
    apt showShow package details

    Red Hat/CentOS (yum/dnf):

    CommandDescription
    yum updateUpdate packages
    yum installInstall package
    yum removeRemove package
    yum list installedList installed
    dnf groupinstallInstall package group
    # Debian/Ubuntu examples sudo apt update && sudo apt upgrade -y sudo apt install nginx apt search "web server" # Red Hat examples sudo yum install httpd sudo yum list installed | grep mysql # Check installed package version dpkg -l | grep python3 rpm -qa | grep kernel
    Package Management

    Disk and Storage Commands#

    Managing disk space, partitions, and storage devices is critical for system maintenance. These commands help you monitor usage, mount devices, and manage file systems effectively.

    CommandDescriptionExample
    dfDisk free spacedf -h
    duDisk usagedu -sh /home
    fdiskPartition table managerfdisk -l
    mountMount file systemmount /dev/sda1 /mnt
    umountUnmount file systemumount /mnt
    fsckFile system checkfsck /dev/sda1
    ddConvert/copy filedd if=/dev/zero of=file
    lsblkList block deviceslsblk
    blkidBlock device attributesblkid
    # Check disk usage in human-readable format df -h # Find largest files in directory du -ah /var | sort -rh | head -10 # Create disk image dd if=/dev/sda of=/backup/disk.img bs=4M # Check disk I/O performance iostat -x 1

    System Monitoring#

    Proactive system monitoring helps identify issues before they become critical. These commands provide real-time and historical data about system resources, user activity, and overall system health.

    CommandDescriptionExample
    uptimeSystem uptimeuptime
    whoLogged in userswho -a
    lastLast loginslast -10
    dmesgKernel messagesdmesg
    journalctlSystem logsjournalctl -xe
    vmstatVirtual memory statsvmstat 5
    iostatCPU/IO statisticsiostat -xz
    freeMemory usagefree -h
    watchRun command repeatedlywatch df -h
    # Monitor memory usage in real-time watch -n 2 free -m # Check systemd service logs journalctl -u nginx.service --since "5 minutes ago" # View last 50 kernel messages dmesg | tail -50 # Monitor CPU temperature watch -n 1 sensors
    System Monitoring

    Bash Scripting Basics#

    Shell scripting automates repetitive tasks and combines multiple commands into reusable programs. Bash is the default shell on most Linux systems and provides powerful programming constructs for system administration.

    ElementDescriptionExample
    #!Shebang interpreter#!/bin/bash
    $VARVariable referenceecho $HOME
    $(cmd)Command substitutionfiles=$(ls)
    if/then/elseConditional logicif [ -f file ]; then
    for/whileLoopsfor i in {1..5}; do
    $1,$2Positional argumentsecho $1
    $?Exit statusif [ $? -eq 0 ]
    #!/bin/bash # Simple backup script backup_dir="/backup/$(date +%Y%m%d)" source_dir="/home/user/documents" # Create backup directory mkdir -p "$backup_dir" # Copy and compress files tar -czf "$backup_dir/backup.tar.gz" "$source_dir" # Check if successful if [ $? -eq 0 ]; then echo "Backup completed: $backup_dir" logger "Backup successful: $backup_dir" else echo "Backup failed" >&2 exit 1 fi

    Useful Linux Tips#

    These practical tips and shortcuts improve productivity and help you work more efficiently with the Linux command line. They're gathered from years of real-world usage.

    Command-line shortcuts:

    • Tab: Auto-complete commands and filenames
    • Ctrl + C: Terminate current command
    • Ctrl + Z: Suspend current process
    • Ctrl + D: Exit current shell
    • Ctrl + R: Search command history
    • !!: Repeat last command
    • !$: Use last argument from previous command
    • Ctrl + A/E: Move to beginning/end of line

    Redirection operators:

    command > file # Redirect stdout to file command >> file # Append stdout to file command 2> file # Redirect stderr to file command &> file # Redirect both stdout and stderr command1 | command2 # Pipe output to another command

    Quick system checks:

    # Check Linux distribution cat /etc/os-release # Check kernel version uname -r # List available shells cat /etc/shells # Show environment variables env | grep PATH # Find command location which python3 whereis nginx

    Conclusion#

    Linux is a powerful operating system used widely in development, servers, and cloud environments. This cheatsheet brings together essential Linux commands and concepts in one place so you can quickly reference them while learning or working in the terminal. Regular practice is the best way to become comfortable with Linux and improve your command-line skills.

    If you found this cheatsheet helpful, consider sharing it with your friends or colleagues who are learning Linux.

    Want to Master Spring Boot and Land Your Dream Job?

    Struggling with coding interviews? Learn Data Structures & Algorithms (DSA) with our expert-led course. Build strong problem-solving skills, write optimized code, and crack top tech interviews with ease

    Learn more
    Linux
    devops
    terminal
    shell
    Was it helpful?

    Subscribe to our newsletter

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

    More articles