Convert Figma logo to code with AI

dylanaraps logopfetch

🐧 A pretty system information tool written in POSIX sh.

2,041
164
2,041
59

Top Related Projects

Fetches system/theme information in terminal for Linux desktop screenshots.

Quick Overview

pfetch is a lightweight system information tool written in POSIX sh. It displays basic system information in a clean and minimalistic format, making it an ideal alternative to more complex system information tools like neofetch.

Pros

  • Extremely fast and lightweight
  • Highly customizable through environment variables
  • Written in POSIX sh, ensuring compatibility across various Unix-like systems
  • Simple and easy to understand codebase

Cons

  • Limited information compared to more comprehensive tools
  • May require manual configuration for some systems
  • Lacks some advanced features found in larger system information tools
  • Not actively maintained (last commit was in 2020)

Code Examples

  1. Basic usage:
pfetch

This command will display the default system information.

  1. Customizing output:
PF_INFO="ascii title os host kernel uptime pkgs memory" pfetch

This example customizes the information displayed by pfetch.

  1. Changing the ASCII art:
PF_ASCII="openbsd" pfetch

This command changes the ASCII art to the OpenBSD logo.

Getting Started

To use pfetch, follow these steps:

  1. Clone the repository:

    git clone https://github.com/dylanaraps/pfetch.git
    
  2. Make the script executable:

    chmod +x pfetch/pfetch
    
  3. Run pfetch:

    ./pfetch/pfetch
    

Optionally, you can move the script to a directory in your PATH for easier access:

sudo mv pfetch/pfetch /usr/local/bin/

Now you can run pfetch from anywhere in your terminal.

Competitor Comparisons

Fetches system/theme information in terminal for Linux desktop screenshots.

Pros of screenFetch

  • More comprehensive system information display
  • Supports a wider range of operating systems and distributions
  • Includes ASCII art logos for various distributions

Cons of screenFetch

  • Slower execution time due to more extensive information gathering
  • Larger codebase, potentially more complex to maintain
  • Written in Bash, which may limit portability to some systems

Code Comparison

screenFetch (Bash):

detectdistro() {
    distro="Unknown"
    if [[ -f /etc/lsb-release ]]; then
        distro=$(grep DISTRIB_ID /etc/lsb-release | cut -d= -f2)
    elif [[ -f /etc/os-release ]]; then
        distro=$(grep NAME /etc/os-release | cut -d= -f2 | tr -d '"')
    fi
}

pfetch (POSIX sh):

get_distro() {
    case $os in
        Linux*)
            . /etc/os-release
            distro=$NAME
        ;;
        *)
            distro=$os
        ;;
    esac
}

pfetch is a lightweight alternative to screenFetch, focusing on speed and minimalism. It's written in POSIX sh for better portability and has a smaller codebase. However, it provides less detailed system information and supports fewer operating systems compared to screenFetch. The code comparison shows that pfetch uses a simpler approach to detect the distribution, while screenFetch employs a more comprehensive method.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

pfetch

A pretty system information tool written in POSIX sh


The goal of this project is to implement a simple system information tool in POSIX sh using features built into the language itself (where possible).

The source code is highly documented and I hope it will act as a learning resource for POSIX sh and simple information detection across various different operating systems.

If anything in the source code is unclear or is lacking in its explanation, open an issue. Sometimes you get too close to something and you fail to see the "bigger picture"!





OS support

  • Linux
    • Alpine Linux, Arch Linux, Arco Linux, Artix Linux, CentOS, Dahlia, Debian, Devuan, Elementary, EndeavourOS, Fedora, Garuda Linux, Gentoo, Guix, Hyperbola, instantOS, KISS Linux, Linux Lite, Linux Mint, Mageia, Manjaro, MX Linux, NixOS, OpenSUSE, Parabola, Pop!_OS, PureOS, Slackware, Solus, Ubuntu and Void Linux.
    • All other distributions are supported with a generic penguin logo.
  • Android
  • BSD
    • DragonflyBSD, FreeBSD, NetBSD and OpenBSD.
  • Windows
    • Windows subsystem for Linux.
  • Haiku
  • MacOS
  • Minix
  • Solaris
  • IRIX
  • SerenityOS

Configuration

pfetch is configured through environment variables.

# Which information to display.
# NOTE: If 'ascii' will be used, it must come first.
# Default: first example below
# Valid: space separated string
#
# OFF by default: shell editor wm de palette
PF_INFO="ascii title os host kernel uptime pkgs memory"

# Example: Only ASCII.
PF_INFO="ascii"

# Example: Only Information.
PF_INFO="title os host kernel uptime pkgs memory"

# A file to source before running pfetch.
# Default: unset
# Valid: A shell script
PF_SOURCE=""

# Separator between info name and info data.
# Default: unset
# Valid: string
PF_SEP=":"

# Enable/Disable colors in output:
# Default: 1
# Valid: 1 (enabled), 0 (disabled)
PF_COLOR=1

# Color of info names:
# Default: unset (auto)
# Valid: 0-9
PF_COL1=4

# Color of info data:
# Default: unset (auto)
# Valid: 0-9
PF_COL2=9

# Color of title data:
# Default: unset (auto)
# Valid: 0-9
PF_COL3=1

# Alignment padding.
# Default: unset (auto)
# Valid: int
PF_ALIGN=""

# Which ascii art to use.
# Default: unset (auto)
# Valid: string
PF_ASCII="openbsd"

# The below environment variables control more
# than just 'pfetch' and can be passed using
# 'HOSTNAME=cool_pc pfetch' to restrict their
# usage solely to 'pfetch'.

# Which user to display.
USER=""

# Which hostname to display.
HOSTNAME=""

# Which editor to display.
EDITOR=""

# Which shell to display.
SHELL=""

# Which desktop environment to display.
XDG_CURRENT_DESKTOP=""

Credit

  • ufetch: Lots of ASCII logos.
    • Contrary to the belief of a certain youtuber, pfetch shares zero code with ufetch. Only some of the ASCII logos were used.