Skip to main content

Command Palette

Search for a command to run...

๐Ÿง Linux Command Line Cheat Sheet: Essential Commands ๐Ÿง

Updated
โ€ข3 min readโ€ขView as Markdown
๐Ÿง Linux Command Line Cheat Sheet: Essential Commands  ๐Ÿง

Welcome to the ultimate Linux command line cheat sheet! Whether you're a seasoned Linux user or just getting started, this handy reference guide will help you navigate the world of Linux commands with ease. ๐Ÿš€

Table of Contents

  • Basic Commands ๐Ÿ“

    • pwd - Show current directory.

    • ls - List files and directories.

    • cd - Change directory.

    • mkdir - Create a new directory.

    • rm - Remove files or directories.

    • cp - Copy files or directories.

    • mv - Move files or directories.

    • touch - Create an empty file.

  • System Information โ„น๏ธ

    • uname - Display system information.

    • top - Display running processes.

    • df - Show disk space usage.

    • free - Display memory usage.

    • uptime - Display system uptime.

    • ps - Display detailed process information.

  • Package Management ๐Ÿ“ฆ

    • apt - Advanced Package Tool (Debian/Ubuntu).

    • yum - Package manager (CentOS/RHEL).

    • dnf - Next-generation package manager.

    • pacman - Package manager (Arch Linux).

    • snap - Package management (Snapcraft).

  • Networking ๐ŸŒ

    • ifconfig - Display network interfaces.

    • ping - Send ICMP echo requests.

    • netstat - Network statistics.

    • ssh - Securely access remote systems.

    • wget - Download files from the web.

  • User Management ๐Ÿ‘ค

    • useradd - Add a new user.

    • passwd - Change user password.

    • su - Switch user.

    • sudo - Execute commands with superuser privileges.

    • usermod - Modify user properties.

  • File Operations ๐Ÿ“๐Ÿ”ง

  • ls -al: Lists all files - including hidden ones - with permissions ๐Ÿ‘€๐Ÿ“

  • pwd: Displays the present working directory path ๐Ÿ—บ๏ธ

  • mkdir 'pink': Creates a new directory named 'pink' ๐Ÿ“‚

  • rm file_name: Removes a file ๐Ÿ—‘๏ธ

  • rm -f filename: Forcefully removes a file ๐Ÿ’ฅ

  • rm -r directory_name: Removes a directory recursively ๐ŸŒช๏ธ

  • rm -rf directory_name: Removes a directory forcefully and recursively ๐ŸŒช๏ธ๐Ÿ’ฅ

  • cp file1 file2: Copies contents of file1 to file2 ๐Ÿ“‚โžก๏ธ๐Ÿ“‚

  • cp -r dir1 dir2: Recursively copies dir1 to dir2 ๐Ÿ“‚โžก๏ธ๐Ÿ“‚

  • mv file1 file2: Renames file1 to file2 โœจ

  • ln -s /path/to/file_name link_name: Creates a symbolic link to file_name ๐Ÿ–‡๏ธ

  • touch file_name: Creates a new file ๐Ÿ“„

  • cat > file_name: Places standard input into a file โœ๏ธ

  • more file_name: Outputs contents of a file step by step ๐Ÿ“„โžก๏ธ

  • head file_name: Displays the first 10 lines of a file ๐Ÿ“๐Ÿ”

  • tail file_name: Displays the last 10 lines of a file ๐Ÿ“๐Ÿ”š

    File Transfer Commands๐Ÿ“œ

  • #scp file1.txt server2/tmp Securely copy file1.txt to server2 in /tmp directory

  • #rsync -a /home/apps /backup/ Synchronize contents in /home/apps directory with /backup directory

Disk Usage Commands๐Ÿ“œ

  • #df -h Displays free space on mounted systems

  • #df -i Displays free inodes on filesystems

  • #fdisk -l Shows disk partitions, sizes, and types

  • #du -sh Displays disk usage in the current directory in a human-readable format

  • #findmnt Displays target mount point for all filesystems

  • #mount device-path mount-pointMount a device

Certainly! Here's a comprehensive explanation of the Linux commands you provided along with their functionalities and usage:

๐Ÿ–ฅ๏ธ Linux System Information Commands ๐Ÿ–ฅ๏ธ

  • uname: Displays Linux system information, including the kernel version, network hostname, and more.

  • uname -r: Displays the kernel release information.

  • uptime: Displays how long the system has been running.

  • hostname: Shows the system hostname.

  • hostname -i: Displays the IP address of the system.

  • last reboot: Shows the system reboot history.

  • date: Displays the current system date and time.

  • whoami: Displays the username of the currently logged-in user.

  • finger username: Displays detailed information about the specified user.

Thanks for readingโœจ
Hope you find this useful. Let me know your thoughts in the comment section and donโ€™t forget to clap if you found the article helpful. To get notified, Do follow

More from this blog

๐Ÿณ ๐—ฆ๐—ถ๐—บ๐—ฝ๐—น๐—ถ๐—ณ๐—ถ๐—ฒ๐—ฑ ๐——๐—ผ๐—ฐ๐—ธ๐—ฒ๐—ฟ ๐—–๐—ผ๐—ป๐˜๐—ฎ๐—ถ๐—ป๐—ฒ๐—ฟ ๐—Ÿ๐—ถ๐—ณ๐—ฒ๐—ฐ๐˜†๐—ฐ๐—น๐—ฒ ๐Ÿ”„

The Container Lifecycle The following diagram shows the states of a simplified Container Lifecycle, which determines how a Container behaves. simplified container lifecycle state diagram The text on the arrows corresponds to the docker commands whic...

Nov 25, 20236 min read
๐Ÿณ ๐—ฆ๐—ถ๐—บ๐—ฝ๐—น๐—ถ๐—ณ๐—ถ๐—ฒ๐—ฑ ๐——๐—ผ๐—ฐ๐—ธ๐—ฒ๐—ฟ ๐—–๐—ผ๐—ป๐˜๐—ฎ๐—ถ๐—ป๐—ฒ๐—ฟ ๐—Ÿ๐—ถ๐—ณ๐—ฒ๐—ฐ๐˜†๐—ฐ๐—น๐—ฒ ๐Ÿ”„

DevopsWithDeepss

26 posts