System Administration

Essential System Tools: pet – command-line snippet manager

Last Updated on May 28, 2022

petThis is the third in our series of articles highlighting essential system tools. These are small utilities, useful for system administrators as well as regular users of Linux based systems. The series examines both graphical and text based open source utilities.

The first tools under the spotlight were ps_mem, a small utility that accurately reports memory consumption of software, and gtop, a system monitoring dashboard.

This time, we’ll take a look at pet, a simple command-line snippet manager. The software is written in the Go programming language.

A command-line interface allows the user to interact with the computer by typing in commands. The computer displays a prompt, the user keys in the command and presses enter or return.

Installation

These days I usually gravitate to installing software by compiling the source code. First clone the repository, and try to compile.

git clone https://github.com/knqyf263/pet.git
cd pet
make install

The make install failed on my system as my system was missing dep, a tool for managing dependencies for Go projects. The steps taken to install dep were:

mkdir ~/gocode/
export GOPATH=/home/sde/gocode
go get github.com/golang/dep/cmd/dep

This creates a binary in /home/sde/golang/bin/. I also added the directory to the PATH environment.

export PATH=$PATH:/home/sde/gocode/bin

Packages are available for popular Linux distributions including Debian, Ubuntu, RedHat, and others. For example, there’s a package available for pet in the Arch User Repository.

In operation

At a shell, typing ‘pet’ or ‘pet –help’ shows the available options.

pet commands

For each snippet you can add a detailed description of what the command does, which acts as a useful aide-memoire.

Features of pet include:

  • Register your command snippets easily using pet new.
  • Easily edit snippet files.
  • List all your snippets.
  • Use variables (<param> or <param=default_value> ) in snippets.
  • Search snippets interactively.
  • Run snippets directly.
  • Edit snippets easily (the snippets are managed in a TOML1 file).
  • Sync and share snippets via Gist or GitLab Snippets automatically.

Summary

If you’re like me, you often forget useful commands, particularly ones with lots of flags. You can create aliases or use the history command combined with grep to alleviate this issue. But pet arguably offers a slicker way, as it lets you search the snippets to quickly find what you need.

Website: github.com/knqyf263/pet
Support:
Developer: Teppei Fukuda
License: MIT License

1 TOML is a configuration file format that’s intended to be easy to read due to more obvious semantics which aims to be “minimal”.

pet is written in Go. Learn Go with our recommended free books and free tutorials.


All the essential tools in this series:

Essential System Tools
AlacrittyInnovative, hardware-accelerated terminal emulator
BleachBitSystem cleaning software. Quick and easy way to service your computer
bottomGraphical process/system monitor for the terminal
btop++Monitor usage and stats for CPU, memory, disks, network and processes
catfishVersatile file searching software
ClonezillaPartition and disk cloning software
CPU-XSystem profiler with both a GUI and text-based
CzkawkaFind duplicate files, big files, empty files, similar images, and much more
ddrescueData recovery tool, retrieving data from failing drives as safely as possible
dustMore intuitive version of du written in Rust
f3Detect and fix counterfeit flash storage
Fail2banBan hosts that cause multiple authentication errors
fdupesFind or delete duplicate files
FirejailRestrict the running environment of untrusted applications
GlancesCross-platform system monitoring tool written in Python
GPartedResize, copy, and move partitions without data
GreenWithEnvyNVIDIA graphics card utility
gtopSystem monitoring dashboard
gWakeOnLANTurn machines on through Wake On LAN
hyperfineCommand-line benchmarking tool
HyFetchSystem information tool written in Python
inxiCommand-line system information tool that's a time-saver for everyone
journalctlQuery and display messages from the journal
kmonManage Linux kernel modules with this text-based tool
KrusaderAdvanced, twin-panel (commander-style) file manager
NmapNetwork security tool that builds a "map" of the network
nmonSystems administrator, tuner, and benchmark tool
nnnPortable terminal file manager that's amazingly frugal
petSimple command-line snippet manager
PingnooGraphical representation for traceroute and ping output
ps_memAccurate reporting of software's memory consumption
SMCMulti-featured system monitor written in Python
TimeshiftReliable system restore tool
QDirStatQt-based directory statistics
QJournalctlGraphical User Interface for systemd’s journalctl
TLPMust-have tool for anyone running Linux on a notebook
UnisonConsole and graphical file synchronization software
VeraCryptStrong disk encryption software
VentoyCreate bootable USB drive for ISO, WIM, IMG, VHD(x), EFI files
WTFPersonal information dashboard for your terminal
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Please read our FAQ before making a comment.

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments