Basic Unix Cheat Sheet

Here’s a cheat sheet for some commonly used Unix command-line commands:

Navigation

  • ls: List files and directories in the current directory
  • cd: Change the current directory
  • pwd: Print the current working directory

File Management

  • touch: Create a new file
  • cat: Display the contents of a file
  • more: Display the contents of a file one page at a time
  • less: Display the contents of a file, allowing for scrolling and searching
  • head: Display the first few lines of a file
  • tail: Display the last few lines of a file
  • cp: Copy a file or directory
  • mv: Move or rename a file or directory
  • rm: Remove a file or directory
  • mkdir: Create a new directory
  • rmdir: Remove an empty directory

Search and Filter

  • grep: Search for a pattern in a file or output
  • find: Search for files or directories that match specified criteria
  • sed: Search for and replace text within a file or output
  • awk: Process and manipulate text data

System Information

  • uname: Print system information, such as the operating system and kernel version
  • whoami: Print the current user’s username
  • ps: List the currently running processes
  • top: Display real-time information about the system’s resource usage
  • df: Display information about the file system disk space usage
  • du: Display information about the disk space usage of files and directories

Networking

  • ping: Test connectivity to a network host
  • nslookup: Look up DNS information for a domain or host
  • netstat: Display information about active network connections and open ports
  • ssh: Connect to a remote system using SSH
  • scp: Securely copy files between systems using SSH

These are just a few of the many command-line commands available in Unix. For more information on how to use these commands and others, you can refer to online resources and documentation.

Leave a Reply

Proudly powered by WordPress | Theme: Code Blog by Crimson Themes.