close
close
ubuntu commands cheat sheet

ubuntu commands cheat sheet

2 min read 21-10-2024
ubuntu commands cheat sheet

Ubuntu Commands Cheat Sheet: A Quick Guide for Beginners

Navigating the world of Ubuntu can seem daunting at first, but with a few essential commands at your fingertips, you'll be a Linux pro in no time. This cheat sheet will guide you through the basics, covering everything from file management to system updates.

File Management

  • ls: List directory contents.
    • Example: ls -l (shows detailed information about files)
    • Example: ls -a (shows hidden files)
  • cd: Change directory.
    • Example: cd /home/user/Documents (navigates to a specific directory)
  • mkdir: Create a new directory.
    • Example: mkdir new_directory (creates a directory called "new_directory")
  • rm: Remove files or directories.
    • Example: rm file.txt (deletes the file "file.txt")
    • Example: rm -rf directory (removes the directory "directory" and its contents - be careful!)
  • cp: Copy files or directories.
    • Example: cp file.txt new_file.txt (copies "file.txt" to "new_file.txt")
  • mv: Move or rename files or directories.
    • Example: mv file.txt /home/user/Downloads (moves "file.txt" to the Downloads folder)
    • Example: mv old_file.txt new_file.txt (renames "old_file.txt" to "new_file.txt")

System Information

  • uname -a: Provides information about the system, including the kernel version and architecture.
  • whoami: Shows your current username.
  • pwd: Prints the current working directory.
  • df -h: Displays available disk space on mounted file systems.
  • free -m: Shows memory usage in megabytes.

Software Management

  • apt update: Updates the package lists. Always run this command before installing or upgrading software.
  • apt upgrade: Upgrades all packages to the latest available versions.
  • apt install package_name: Installs a package.
    • Example: apt install firefox (installs the Firefox web browser)
  • apt remove package_name: Removes a package.
    • Example: apt remove firefox (uninstalls Firefox)
  • apt search package_name: Searches for a package.
    • Example: apt search libreoffice (searches for LibreOffice)

Networking

  • ifconfig: Displays network configuration information.
  • ping google.com: Checks connectivity to a specific host.
  • netstat -a: Lists active network connections.
  • traceroute google.com: Traces the route to a specific host.

Additional Tips & Tricks

  • man command_name: Access the manual page for a command.
  • history: Lists previously executed commands.
  • Ctrl+C: Stops a running process.
  • Ctrl+Z: Suspends a running process.
  • bg: Sends a suspended process to the background.
  • fg: Brings a background process to the foreground.

Remember:

  • Use the sudo command before any command that requires root privileges.
  • Be careful when using the rm -rf command, as it will delete everything without asking!
  • Always backup your important data before making any significant changes.

This is just a starting point for your Ubuntu adventure. There are countless other commands and utilities waiting to be explored. Remember to practice, and don't hesitate to search online for more in-depth information. Happy coding!

Attribution:

This cheat sheet has been compiled using information from various sources including:

This article is not intended to be a comprehensive guide to Ubuntu. It's meant to serve as a beginner-friendly introduction to the most common commands.

Related Posts


Latest Posts