Skip to content

Latest commit

 

History

History
158 lines (132 loc) · 5.83 KB

linux.md

File metadata and controls

158 lines (132 loc) · 5.83 KB

Linux Commands Cheat Sheet

Table of Contents:

Navigation

  • ls: List files and directories.
  • cd: Change directory.
  • pwd: Print the current working directory.
  • mkdir: Create a new directory.
  • rmdir: Remove an empty directory.
  • rm: Remove files and directories.
  • cp: Copy files and directories.
  • mv: Move or rename files and directories.
  • find: Search for files and directories.

File Operations

  • cat: Concatenate and display file content.
  • head: Display the beginning of a file.
  • tail: Display the end of a file.
  • less: View file content interactively.
  • more: View file content page by page.
  • touch: Create an empty file or update file timestamps.
  • chmod: Change file permissions.
  • chown: Change file ownership.
  • chgrp: Change group ownership.
  • ln: Create hard or symbolic links.

Text Processing

  • grep: Search for patterns in files.
  • sed: Stream editor for text manipulation.
  • awk: Text processing and pattern matching.
  • cut: Extract sections from lines of files.
  • sort: Sort lines in a file.
  • uniq: Remove duplicate lines from a file.
  • wc: Word, line, character, and byte count.
  • tr: Translate or delete characters.

System Information

  • uname: Print system information.
  • whoami: Print current user's name.
  • hostname: Print or set system hostname.
  • date: Print or set the system date and time.
  • uptime: Display system uptime.
  • free: Display memory usage.
  • df: Display disk space usage.
  • du: Estimate file and directory space usage.
  • top: Monitor system activity and processes.
  • ps: Display running processes.

Process Management

  • kill: Terminate processes by ID or name.
  • killall: Terminate processes by name.
  • ps: Display running processes.
  • top: Monitor system activity and processes.
  • pgrep: List processes by name.
  • pkill: Send a signal to processes by name.
  • nohup: Run a command immune to hangups.
  • nice: Run a command with modified priority.
  • renice: Change the priority of running processes.

Network Operations

  • ping: Send ICMP echo requests to a host.
  • ifconfig: Configure or display network interfaces.
  • ip: Show or manipulate routing, devices, and policy routing.
  • netstat: Network statistics and connections.
  • ss: Socket statistics.
  • ssh: Secure shell remote login.
  • scp: Securely copy files between hosts.
  • wget: Download files from the web.
  • curl: Transfer data from or to a server.
  • dig: DNS lookup utility.
  • nslookup: Query DNS servers for information.
  • traceroute: Print the route packets take to network host.

Package Management

  • apt-get: Package handling utility (Debian-based systems).
  • apt: Package handling utility (Debian-based systems).
  • yum: Package manager (Red Hat-based systems).
  • dnf: Next-generation package manager (Fedora).
  • zypper: Command-line package manager (openSUSE).
  • pacman: Package manager (Arch Linux).
  • dpkg: Package manager (Debian-based systems).
  • rpm: RPM package manager (Red Hat-based systems).

Compression and Archiving

  • tar: Archive files together.
  • gzip: Compress files using the gzip algorithm.
  • gunzip: Decompress files compressed with gzip.
  • zip: Create ZIP archives.
  • unzip: Extract files from ZIP archives.
  • rar: Create or extract RAR archives.
  • unrar: Extract files from RAR archives.
  • 7z: Create or extract 7z archives.
  • xz: Compress or decompress files using the xz algorithm.
  • bzip2: Compress files using the bzip2 algorithm.
  • bunzip2: Decompress files compressed with bzip2.

Permissions and Ownership

  • chmod: Change file permissions.
  • chown: Change file ownership.
  • chgrp: Change group ownership.
  • passwd: Change user password.
  • su: Substitute user identity.
  • sudo: Execute a command as another user.
  • visudo: Edit the sudoers file.

System Monitoring

  • top: Monitor system activity and processes.
  • htop: Interactive process viewer.
  • atop: Advanced system and process monitor.
  • iotop: Monitor I/O usage by processes.
  • nethogs: Monitor network traffic per process.
  • vmstat: Report virtual memory statistics.
  • sar: System activity reporter.
  • dmesg: Print or control the kernel ring buffer.
  • watch: Execute a command repeatedly and display its output.

File Permissions

  • chmod: Change file permissions.
  • chown: Change file ownership.
  • chgrp: Change group ownership.
  • umask: Set the default file permissions.
  • lsattr: List file attributes on a Linux second extended file system.
  • chattr: Change file attributes on a Linux second extended file system.
  • getfacl: Get file access control lists.
  • setfacl: Set file access control lists.

Help and Manual Pages

  • man: Display the manual page for a command.
  • info: Display command information.
  • --help: Get help within a command.

This cheat sheet covers a wide range of Linux command line operations. Keep in mind that each command may have various options and arguments, so consult the manual pages or use the --help option for more details on specific commands.