Skip to content

Instantly share code, notes, and snippets.

@jdmedeiros
Created September 19, 2025 11:12
Show Gist options
  • Select an option

  • Save jdmedeiros/86860568d9039482523e3ba782a0ebff to your computer and use it in GitHub Desktop.

Select an option

Save jdmedeiros/86860568d9039482523e3ba782a0ebff to your computer and use it in GitHub Desktop.

Great choice! Learning the Linux command line will give you much more control and flexibility with Ubuntu. Here’s a structured overview of the most important commands you’ll want to know as you get started:


πŸ”Ž System Navigation & File Management

  • pwd β†’ Show your current directory (print working directory).

  • ls β†’ List files and folders in the current directory.

    • Options: ls -l (detailed), ls -a (show hidden), ls -lh (human-readable sizes).
  • cd <path> β†’ Change directory (e.g., cd /home/user/Documents).

  • mkdir <name> β†’ Create a new directory.

  • rmdir <name> β†’ Remove an empty directory.

  • touch <file> β†’ Create an empty file.

  • cp <src> <dest> β†’ Copy files or directories (-r for directories).

  • mv <src> <dest> β†’ Move or rename files.

  • rm <file> β†’ Delete files (-r for directories, -f to force).


πŸ“„ Viewing & Editing Files

  • cat <file> β†’ Show file contents.
  • less <file> β†’ View file contents page by page.
  • head <file> β†’ Show the first 10 lines of a file.
  • tail <file> β†’ Show the last 10 lines of a file (tail -f follows updates, useful for logs).
  • nano <file> β†’ Simple text editor.
  • vim <file> β†’ Advanced text editor (steeper learning curve).

πŸ‘€ User & Permissions

  • whoami β†’ Show current user.
  • id β†’ Show user and group info.
  • chmod <mode> <file> β†’ Change file permissions (e.g., chmod 755 script.sh).
  • chown <user>:<group> <file> β†’ Change file owner.
  • sudo <command> β†’ Run command as administrator.

πŸ“¦ Package Management (Ubuntu / Debian)

  • apt update β†’ Refresh package list.
  • apt upgrade β†’ Upgrade installed packages.
  • apt install <package> β†’ Install a new package.
  • apt remove <package> β†’ Uninstall a package.
  • apt search <keyword> β†’ Search available packages.

βš™οΈ System Information

  • uname -a β†’ Kernel and system details.
  • df -h β†’ Show disk usage (human-readable).
  • du -sh <dir> β†’ Show size of a directory.
  • free -h β†’ Show memory usage.
  • top or htop β†’ Show running processes.
  • ps aux β†’ List all processes.
  • uptime β†’ Show how long the system has been running.
  • who β†’ Show logged-in users.

🌐 Networking

  • ping <host> β†’ Test connectivity.
  • ip a β†’ Show network interfaces and IPs.
  • curl <url> β†’ Fetch content from a URL.
  • wget <url> β†’ Download a file.
  • ssh user@host β†’ Connect to a remote server.

πŸ“‚ Searching & Finding

  • find <path> -name <file> β†’ Search for files by name.
  • grep <pattern> <file> β†’ Search for text inside files.
  • locate <name> β†’ Find files (uses a prebuilt index, run updatedb first).

πŸ› οΈ Other Useful Commands

  • history β†’ Show previously used commands.
  • clear β†’ Clear the terminal screen.
  • alias β†’ Create shortcuts (e.g., alias ll='ls -lh').
  • man <command> β†’ Open manual/help for a command.

πŸ‘‰ Tip: Practice is key! Try exploring /home, /etc, and /var/log with these commands.

Would you like me to make you a cheat sheet PDF with all of these commands nicely formatted, so you can keep it handy while learning?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment