• Stars
    star
    117
  • Rank 301,828 (Top 6 %)
  • Language
    Shell
  • License
    GNU General Publi...
  • Created about 13 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Adam's shell environment (bash/zsh) including a bunch of handy home-made utilities

Adam's UNIX shell environment

This is my collection of UNIX shell configuration files and utilities. These days I only use them with zsh and bash on Linux, but in the past I also used them on various Solaris and FreeBSD machines, and for the most part they should work on any POSIX-oriented UNIX.

Contents

  • Configuration files for zsh

    • .zshrc - config for interactive instances only
    • .zshenv - config for non-interactive and interactive instances
    • .zsh/ hierarchy, including:
  • Configuration files for bash

    • .bashrc - config for interactive instances only
    • .bash_profile - config for interactive "login shell" instances only
    • .bashenv - config for non-interactive and interactive instances
  • Configuration files to be shared by any Bourne-compatible shell

    • .shared_env - config for non-interactive and interactive instances
    • .shared_rc - config for interactive instances only
  • Mechanism for automatically switching between shells.
    Useful for when you do not have root privileges and want to run a locally compiled version of zsh rather than a system-wide shell. See:

  • Perl library lib/perl5/Sh.pm providing some handy native Perl replacements for shell-like operations.

  • Hook-runner mechanism for building composite configuration out of multiple files in a foo.d/ hierarchy. For more information see:

  • Configuration files for various commonly used UNIX utilities and libraries:

    • less
    • rsync
    • ls
    • readline
  • Useful utility and wrapper scripts under bin/:

    • AC-online - Determine if we are running off battery.
    • AC-state - Determine AC power adapter state.
    • abs - Convert a relative path to absolute path(s) with all symlinks resolved.
    • active-since - Determine whether I've touched the keyboard since a given time.
    • age-of - Show the age in seconds of a running or completed command run under the age-track wrapper.
    • age-track - Track the start and end times of a command, ensuring against concurrent invocations. Useful as a helper for asynchronous process invocations.
    • alertme - Poor man's attention grabber.
    • beep - Make some kind of noise reliably.
    • bip - Wrapper around play to generate a sine wave of a given frequency / duration / volume.
    • bsplit - Split a file or STDIN into buckets.
    • c3 - Show 3 months of the calendar.
    • cg - Shortcut for chgrp.
    • clip - Copy a symLink In Place - converts a symlink to a real file. Suspiciously similar to harden-ln (below).
    • cm - Shortcut which allows you to omit chmod from typical chmod 775 foo command lines.
    • colour-diff-output - Colour-codes diff output (see dl below)
    • count-dirents - Count the number of files in a bunch of directories.
    • cp-merge - Copies the entire contents of one directory to another, even if some subdirectories are common to both source and destination directories. See also mv-merge.
    • crypt - Generate a hashed password.
    • csort - sort(1) helper which allows custom sort orders based on string/regexp matching
    • cy - Show a whole calendar year.
    • dbm - Simple DBM file reader/writer
    • dfh - df -h wrapper
    • dfl - alternative df wrapper
    • dfll - to dfl what ls -l is to ls -lh
    • diff-inodes - Compares output of dump-inodes (below) with inode details in another tree.
    • diff-less - Wrapper around less for viewing output from colour-diff-output. Used by tty-colour-diff.
    • div - Echo a highly visible divider.
    • dl - diff wrapper.
    • dts - Runs a command, date/time-stamping each line of STDOUT.
    • du1 - Run du with maximum depth 1
    • du2 - Run du with maximum depth 2
    • dump-inodes - Dump machine-readable inode meta-data via find for use with diff-inodes.
    • dutree - Print sorted indented rendition of du output.
    • dwatch - Simple monitor to watch for when things change.
    • edate - Show seconds since UNIX epoch.
    • fbig - Find big files.
    • fds - Shortcut to file-datestamp (below).
    • feed - Feed keystrokes to a command then interact with it as normal. Requires Perl's Expect module.
    • file-datestamp - Produce a date-stamp suitable for use within filenames.
    • find-wan-gateway - Find upstream WAN's gateway. See also pingwan.
    • fs-monitor - Poll a filesystem via df.
    • fswap - Swap the names/contents of two files.
    • ftrace - Shortcut for strace -e trace=file.
    • glob-to-re - Filter to convert globs into regexps.
    • grep-shortcuts - Provide handy egrep shortcuts, e.g. gilr is equivalent to egrep -i -l -r
    • gw-dev - Detect the default gateway's network interface.
    • gw-dev-IP - Detect the IP of the default gateway's network interface.
    • harden-ln - Suspiciously similar to clip (above).
    • hex - Convert numbers to hexadecimal.
    • ifw - Show a concise summary of network interface information.
    • isup - Check whether a machine is pingable.
    • keepalive - Keep an ssh session alive (for port forwarding) via Expect.pm.
    • keymap-menu - OOB mechanism for switching between keyboard layouts.
    • lesspipe.sh - My personal $LESSOPEN filter.
    • lh - View recent logins.
    • logseek - Jump to a date/time within a large log file.
    • lsofp - Run lsof by pid or command.
    • md5 - md5sum wrapper.
    • mnt-image - Mount a file containing a filesystem via loopback.
    • mnt-initrd - Mount a Linux initial ram disk image via loopback.
    • mnt-isos - Mount ISOs in /mnt via loopback.
    • mnx - Make file(s) non-executable.
    • mnp - Make file(s) non-public.
    • mp - Make file(s) public.
    • multi-syphon - Wrapper around [syphon](https://github.com/aspiers/shell-env/blob/master/bin/syphon) -i (see below).
    • mv-merge - Moves the entire contents of one directory to another, even if some subdirectories are common to both source and destination directories. See cp-merge and rm-src-dups.
    • mvi - mv -i shortcut.
    • mx - Make file(s) executable.
    • newer - Returns true if a file is newer than the given age.
    • nth - Return the nth line of file(s).
    • ntrace - Shortcut for strace -e trace=network.
    • ord - Show decimal/octal/hex values of ASCII characters.
    • ox - objdump -x shortcut.
    • pdf - Find a preferred PDF viewer and run it.
    • phup - pkill -HUP shortcut.
    • bping - Wrapper around ping to make it do a lot of beeping ;-) Pitch of beeps represents latency: concert A (440Hz) for 10ms, going one octave up or down for every order of magnitude.
    • penv - Dump the environment of a given process id.
    • pinggw - Ping the gateway.
    • pingns - Ping a nameserver.
    • pingwan - Ping the WAN gateway found by find-wan-gateway.
    • protect - UNFINISHED: make a process hard to kill
    • pst - pstree wrapper.
    • pstt - Another pstree wrapper.
    • quietrun - Run a command and only allow output if the exit code didn't reflect success. Useful when writing crontab files, so that you only get e-mailed when something goes wrong.
    • ra - List unusual processes.
    • ra.pats - Data file for ra containing patterns matching "usual" processes.
    • ran - Advanced replacement for seq.
    • rcslocks - Check RCS-controlled files for locks, and optionally nag the lock owners via e-mail.
    • resolver-domain - Extract the resolver domain name from resolv.conf.
    • rj - ps wrapper which searches for specific processes. (Its etymology was forgotten long ago...)
    • rjd - Search for processes in D (non-interruptible) state (Linux-only).
    • rjr - Another ps wrapper.
    • rm-src-dups - Remove duplicate files from a mirrored directory hierarchy.
    • root-zsh - [OLD] expect script for logging in as root and then loading my shell config.
    • rot13 - ROT13 filter
    • rotate - Losslessly rotate JPEGs.
    • rpath - Extract RPATH from object files.
    • safe-pipe - Pipe through a command with fallback.
    • service-commands - Shortcuts for starting/stopping/restarting Linux system services.
    • sfind - Find source files or links, using so (below).
    • show-colours - Show all ANSI 3-bit console colours (foreground and background).
    • shuffle - Fisher-Yates shuffle lines from STDIN.
    • source-only / so - Prune a list of files using ~/.cvsignore.
    • sort-by-filename - Sort list of newline-separated paths by basename (filename ignoring path segments).
    • sparse - Show sparseness of files.
    • split-by-boot - Split syslog messages from STDIN into a new file per system boot.
    • syphon - Removes lines from top of a file based on pattern matching.
    • tailfgrep - Monitor a file Γ  la tail -f, looking for a given regexp.
    • tf - tail -f shortcut. When only tailing a single file, uses less +F which is nicer.
    • tfs - Similar to tf but truncates long lines.
    • timeout - Run a command with a timeout.
    • tre - tree -C shortcut.
    • trim-lines - Truncate long lines of STDIN, taking non-printing escape sequences (e.g. colour) into account.
    • trim-whitespace - Trim leading/trailing whitespace from STDIN.
    • tty-colour-diff - Filter for viewing diff output. If connected to a tty, provides glorious technicolour and paging via diff-less.
    • udate - Show human-readable version of UNIX epoch time.
    • uidle - Finds the session with the smallest idle time corresponding to the specified user and by default outputs the number of seconds idle.
    • umnt-initrd - Unmounts an initrd image mounted via mnt-initrd, generating a new initrd file.
    • un - uname -a shortcut.
    • unpack - Safely unpack an archive file. Supports multiple formats.
    • up-since - Show when the system was last booted.
    • url-handler - Handler for opening various types of URLs
    • viz - Customisable change-control wrapper around an editor - a bit like vipw, vigr, visudo etc. but with validation mechanism implemented by the user.
    • waitpid - Wait for a PID to finish.
    • waitproc - Wait for a command to finish (uses waitpid).
    • watchdiff - Like watch, but output in diff format
    • wchan - ps -O wchan shortcut.
    • wget-monitor - Simple URL monitor.
    • whenup - Wait for a host to become pingable and then alert or take some action.
    • wl - Show the contents of an executable script on $PATH.
    • xauth-user - Give another user access to this $DISPLAY via xauth.
    • zipseqs - Take two or more sequences and 'zip' them together (in the functional programming sense).

INSTALLATION

This repository is designed to be stowed directly into your home directory:

git clone git://github.com/aspiers/shell-env.git
stow -d . -t ~ shell-env

However if you only want to cherry-pick bits and pieces then you can easily just copy or symlink them in manually. Just be aware that some of the files depend on other files, especially the shell configuration files.

LICENSE

The software in this repository is free software: except where noted otherwise, you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

More Repositories

1

stow

GNU Stow - mirror of savannah git repository occasionally with more bleeding-edge branches
Perl
429
star
2

git-deps

git commit dependency analysis tool
Python
291
star
3

ly2video

generating videos from LilyPond projects
Python
130
star
4

mysqldiff

tool and CPAN suite backend for comparing MySQL database schemas
Perl
125
star
5

smooth-scrolling

Emacs smooth scrolling package
Emacs Lisp
107
star
6

git-config

Adam's git shortcuts and environment. Designed to be stowed to ~ using GNU Stow.
Shell
88
star
7

opensuse-spotify-installer

Automate installation of Spotify on openSUSE
Shell
78
star
8

etrace

Emacs Lisp Latency Tracing for the Chromium Catapult Trace Event Format
Emacs Lisp
71
star
9

git-explode

Explode linear sequence of git commits into topic branches
Python
46
star
10

ansible-viz

Graph relationships between Ansible playbooks / roles / tasks / vars etc. via static analysis
Ruby
40
star
11

book-indices

Indices for music books
24
star
12

mr-config

Adam's mr config
Shell
21
star
13

zkp-eddsa-point-doubler

Zero Knowledge proof for point doubling on baby JubJub elliptic curve, using Zokrates
Shell
12
star
14

orgmode

personal repository for patches to orgmode upstream
Emacs Lisp
11
star
15

lilypond

Friendly fork of GNU Lilypond
C++
11
star
16

emacs

Adam's emacs config
Emacs Lisp
10
star
17

lnav-formats

Extra log file format descriptions for the lnav log file reader
9
star
18

SUSE-dist

SUSE-specific utilities and miscellany
Perl
7
star
19

desktop-config

Set up Adam's Xorg desktop the way he likes it
Shell
7
star
20

mutt

a set of generic configuration files for mutt
Perl
7
star
21

migrationpaths

implementation of VM migration path-finding algorithm
Python
7
star
22

worg

Adam's personal mirror of Worg - user documentation of orgmode for emacs
Emacs Lisp
7
star
23

vc-osc

osc backend for emacs vc mode
Emacs Lisp
6
star
24

ssh-config

Adam's openssh public config and helper scripts
Shell
6
star
25

screenrc

Adam's config for GNU Screen and tmux
Shell
5
star
26

guard-sclang

Guard plugin for automatic testing of SuperCollider code
Ruby
5
star
27

linear-analysis

Analysis of linear.app issues
TypeScript
3
star
28

shell-vars-to-ruby

solution to http://stackoverflow.com/questions/11956850/read-all-shell-variables-in-ruby
Ruby
3
star
29

PDFexploder

Tools for exploding PDFs into fragments based on an index
Ruby
3
star
30

ruby-harmony

Music harmony theory, in Ruby!
Ruby
2
star
31

mutt.pub

Configuration files for mutt specifically written for use by me (Adam), but shared publically for interest.
Shell
2
star
32

list-utils

Utilities relating to mailing lists, NNTP, groups etc.
Python
2
star
33

Finance-Bank-LloydsTSB

CPAN module suite providing a rudimentary interface to the LloydsTSB online banking system at https://online.lloydstsb.co.uk/
Perl
2
star
34

Discord-custom-nicks-userscript

Browser userscript for assigning custom nicknames to users client-side
JavaScript
2
star
35

rpm

tools related to rpm
Shell
1
star
36

rolod0x

TypeScript
1
star
37

cfgctl

Utility for managing config repositories
Perl
1
star
38

zmk-config

1
star
39

github-notifications

Utility for marking github notifications as read via mail clients
Ruby
1
star
40

ET-reporting

Ruby
1
star
41

openstack-day-israel-2017-compute-ha

Presentation on upstream compute HA for OpenStack Day Israel 2017
CSS
1
star
42

mscore-groove

Groove plugin for MuseScore
Jupyter Notebook
1
star
43

ANTIFOLD

ugly hack to prevent GNU Stow from folding certain directories under $HOME
Shell
1
star
44

compute-ha-presentation

Presentation on compute HA for OpenStack
CSS
1
star
45

obs-service-tar_scm.historic

Python
1
star
46

etheriopia

Browser userscript to fix two bugs with Twitter
JavaScript
1
star