Skip to content

Latest commit

 

History

History
90 lines (71 loc) · 4.86 KB

01 Linux.md

File metadata and controls

90 lines (71 loc) · 4.86 KB

Linux Commands Cheat Sheet

File and Directory Operations

  • ls: List directory contents.
  • cd <directory>: Change the current directory.
  • pwd: Print the current working directory.
  • mkdir <directory>: Create a new directory.
  • rmdir <directory>: Remove an empty directory.
  • rm <file>: Remove a file.
  • cp <source> <destination>: Copy files or directories.
  • mv <source> <destination>: Move or rename files or directories.
  • touch <file>: Create an empty file.
  • cat <file>: Display file content.
  • nano <file>: Open a file in the Nano text editor.
  • vi <file>: Open a file in the Vi text editor.

System Information

  • uname -a: Display system information.
  • hostname: Display the system hostname.
  • who: Show who is logged on.
  • top: Display Linux processes.
  • df: Show disk space usage.
  • free: Display memory usage.

User Management

  • useradd <username>: Add a new user.
  • passwd <username>: Change user password.
  • userdel <username>: Delete a user.
  • usermod <options> <username>: Modify user properties.
  • su <username>: Switch user.
  • sudo <command>: Execute a command as a superuser.

Package Management

  • apt-get update: Update package index.
  • apt-get upgrade: Upgrade installed packages.
  • apt-get install <package>: Install a package.
  • apt-get remove <package>: Remove a package.
  • apt-cache search <keyword>: Search for a package.
  • dpkg -i <package. deb>: Install a local . deb package.

Network Operations

  • ifconfig: Display network interface information.
  • ping <host>: Send ICMP echo requests to a host.
  • traceroute <host>: Trace the route to a host.
  • netstat: Show network statistics.
  • wget <URL>: Download files from the web.
  • ssh <username>@<hostname>: Connect to a remote host via SSH.
  • scp <source> <destination>: Securely copy files between hosts.

Process Management

  • kill <pid>: Terminate a process by ID.
  • killall <process_name>: Terminate a process by name.
  • ps aux: Display all running processes.
  • pkill <process_name>: Send signal to terminate a process by name.
  • pgrep <process_name>: List processes by name.
  • jobs: Display jobs running in the background.
  • bg: Move a job to the background.
  • fg: Bring a job to the foreground.
  • nice <command>: Run a command with modified scheduling priority.

System Maintenance

  • shutdown <options>: Shut down or restart the system.
  • reboot: Reboot the system.
  • poweroff: Power off the system.
  • tar <options> <archive_file> <files_or_directories>: Create or extract tar archives.
  • gzip <file>: Compress or decompress files using gzip.
  • unzip <file. zip>: Extract files from a zip archive.
  • df -h: Show disk space usage in human-readable format.
  • du -h: Show directory space usage in human-readable format.

File Searching and Manipulation

  • find <path> -name <filename>: Search for files by name.
  • grep <pattern> <file>: Search for a pattern in a file.
  • sed <options> <file>: Stream editor for filtering and transforming text.
  • awk <pattern> <file>: Pattern scanning and processing language.
  • sort <file>: Sort lines of text files.
  • wc <file>: Count lines, words, and characters in a file.

Feel free to add or modify commands based on your needs and preferences.