https://github.com/cyphunk/humanism.sh
subjective but sensible defaults for shell use. Ubuntu, OSX, FreeBSD tested.
https://github.com/cyphunk/humanism.sh
Last synced: over 1 year ago
JSON representation
subjective but sensible defaults for shell use. Ubuntu, OSX, FreeBSD tested.
- Host: GitHub
- URL: https://github.com/cyphunk/humanism.sh
- Owner: cyphunk
- License: other
- Created: 2015-02-17T13:47:17.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2023-08-03T12:38:45.000Z (almost 3 years ago)
- Last Synced: 2024-10-12T16:56:48.431Z (over 1 year ago)
- Language: Shell
- Homepage:
- Size: 219 KB
- Stars: 184
- Watchers: 9
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Humanism.sh
These commands attempt to introduce some humanism to POSIX users by providing
sensible defaults to basic commands and changing the basic functionality of some
so as to free neurons for use on something other than remembering command flags.
This effort ignores with intent the response "it only takes you one more second
to do it the normal way."
Examples: ``cd`` use typically includes only one argument: a directory. With
that assumption this seems absurd:
``cd ./to\ some\ directory``. And ``history`` and ``ps`` are
rarely used without ``grep``. ``find`` is typically used to fuzzy search for a
file name so why isn't ``-iname "*$@*"`` the default?
Some commands herein alter workflow more intrusively. The ``c`` command,
intended to replace cd, will search forward and backward looking for a directory
that matches any part of the argument filter. Though subtle this change makes
moving through the file systems similar to using command launchers found in
modern OS UI's (cmd+space osx, alt+F2 ubuntu). The ``ap`` command unifies
package searching, installation and information making finding needed
dependencies or files easier. ``sshrc`` can be used to carry humanism
(inspired by Russen91's [sshrc](https://github.com/Russell91/sshrc)).
``alias ssh=sshrc`` and take it wherever you go.
## Installation
To load all commands for each new terminal shell (bash/zsh/sh compatible) source
the file in your profile or bashrc:
source humanism.sh
Alternatively you can load commands selectively ``source humanism.sh ``
or execute ``humanism.sh help`` to see list of commands.
You are likely use `ap` and in some cases `dbg` via sudo/root so link these
scripts into a PATH'ed bin:
sudo ln -s /dbg /usr/local/bin
sudo ln -s /ap. /usr/local/bin
Commands have been tested on OSX, Ubuntu and FreeBSD and various virtual hosts
and embedded devices. If you find errors please execute the dependency test
script ``sh -x test/requirements.sh`` and submit an issue on github.
## Use
### c (cd)
c go to last dir
c go to path, if not in cwd search forward and backward for
*FiLtEr* in tree

Details:
c go to path or find and goto filter
1. if filter is path, goto
2. if filter is name in tag db, goto
3. if filter found under cwd, goto
4. if filter found above cwd, goto
c filter cascading. find filter, then Nth filter under it
c tag cascading
c combined. many tags, one filter
l ls that adheres to all of the above
Managing Tags:
Tags get created either manually using these commands or automatically when a
``c fIlTeR`` is found.
cc list tags
cc add/remove/rename for pwd
prompt to delete if exists
cc d
cc del explicit delete
To disable auto tagging set ``HUMANISM_C_TAG_AUTO=0`` before sourcing humanism.sh
### find
find find *FiLtEr* anywhere under cwd
find find *FiLtEr* anywhere under path
find $1 $2 $3 ... pass through to normal find

### history
history list
history greped history

### ps
ps list
ps filtered
ps | killps [-SIG] kill procs
### log
Used to create a record of work by appending commands and messages to ./run.sh
from bash history.
log show recent commands and select which are recorded
log some message append echo message to run.sh
log append Nth cmd from last. e.g. ``log 1`` adds last cmd
### ap
Unify apt-get, apt-cache and dpkg on Linux, homebrew on OSX or pkgng on Freebsd.
Makes searching for needed files or packages a bit easier.
install)
Install package
reinstall)
Re-install package
remove)
Uninstall and purge of all deps no longer required
updatesecurity)
Install security updates
search)
Show packages available or already installed
ownerof)
Show package for file
ineed)
Show packages that would provide a file if installed
ineedbadly)
Show any package that contains string
info)
information about package
list)
show files installed by package
*)
pass through any other command on to apt-get
### dbg
Unify strace|dtruss and lsof.
trace)
strace all child processes of supplied command, pid or proc name
openfiles)
Show open files of an already running processes and its children, by name
fileprocs)
Show pid's touching file
libtree)
using strings alone give .so dependency for file
use: dbg libtree [ignorelibs]
ie: dbg libtree [ld.so.1 libc.so libpthread.so.0 libc.so.6]
canexe)
pick an executable and it's dependencies.
e.g. grab arm executables from one firmware and use on another
tries to determine libs with ldd first, then dbg libtree
use: dbg canexe [ignorelibs]
ie: dbg canexe [ld.so.1 libc.so libpthread.so.0 libc.so.6]
demanglecpp)
pipe strings into c++filt to demangle names
### sshrc
carry all of the above commands with you. Will source ``myrc`` file from
humanism.sh base directory, if it exists. Personally I've set ``alias ssh=sshrc``
in myrc so that I don't forget to carry this with me.