[LWN Logo]
[LWN.net]
From:	 Rick Hohensee <humbubba@smarty.smart.net>
To:	 cool@eklektix.com
Subject: User-friendly unix wearing pasties
Date:	 Sun, 27 May 2001 17:26:34 -0400 (EDT)

This is a concatenation of most of the files in my Pasties directory, 
which together implement a cut/paste interface to common cLIeNUX 
tasks. This is how it was made...

cat ABOUT IeNUX LIeNUX ap bp cLIeNUX cP dp ep \
fp gp hp ip jp kp lp mailer mp np op pp qp \
rp sp tp up vp wp xp yp zp > mailable

You can tell exactly where many files start by the !#/.bi/sh . 

Rick Hohensee
www.clienux.com

................................................................





ABOUT cLIeNUX Pasties

These are commands that are halfway between shell command aliases
and a menu-driven mouse interface in a text terminal with a mouse. 
Most of the Pasties just echo some example commands to the screen, 
which you can then cut/paste at your shell prompt. You can paste 
them as whole lines, in which case they will execute as presented, 
or you can paste them as partial lines, in which case you can edit 
them. This is handy for Pastie entries like...

see forth

where you can cut/paste "see forth" or just "forth". Some Pasties also
are set up to request an argument, and may be in some cases able to
allow you to paste an appropriate argument. Pasties also clump
things together for you. Commands that are in clumps in a Pastie can
be invoked all together, or not. ls is often provided in a clump so you 
can cut/paste a filename from the ls output into some following command. 
Some Pasties could be Pastied as big long sequences involving several 
entries at once, and you can snag just the appropriate part of the 
sequence also. You probably want to keep that in mind for your ip Pastie.

"cLIeNUX" is a command. It echo's a main Pastie, and ignores what follows
the "cLIeNUX". There's a lot to Pasties that is based on ignoring extra 
trailing text. This means you can start Pastie'ing by pasting the default
cLIeNUX shell prompt into the shell. To put it another way, the cLIeNUX
default shell prompt is the "widget" for the top-level Pastie. Parts of
"cLIeNUX", like "LIeNUX", are also commands, like ls --color -s .

Some pasting tricks should be mentioned. In console, If you cut from past 
the end of any line to the end of the line of text and paste it that will 
paste a return, i.e. an end-of-line. In other words, that's how you can 
"hit enter" with the mouse. If you click once on a character, including a 
blank from any expanse of blanks, the paste will be that character. Twice 
is a word, and three clicks snags a whole line. The 3-click mode is handy 
for many Pastie one-line items.

There's next to nothing involved in personalizing Pasties, and they all
include a Pastie entry to edit themselves for that reason. There are 
several examples of fancy shell command sequences and useful but tricky 
uses of commands like "find", so do browse them. You will in particular 
want to personalize the "ip" Pastie which is mostly about Internet 
connections.

UNIX was designed, it seems, to leave single-charachter commands open for 
the individual user's personal favorites. Pasties respect this 
wisdom by providing examples of various useful things on two-character 
commands. The user is urged to customize Pasties to thier advantage, in
conjunction with thier personal one-zies. Mine are pretty quirky, such
as "p" for "visually edit text file" (Pico, in other words), so I don't 
feature them prominently. Pasties names are "cP", parts of "cLIeNUX",
and ap, bp, (skip cp) dp, ep... There's a lot of 2-character possibilities;
Other namespaces even, like ?m for menus that don't need the mouse.

Pasties as posted are rife with cLIeNUX dependancies in addition to being 
"entered" from the "cLIeNUX" command sitting right there in your cLIeNUX 
shell prompt. Various commands are used by thier cLIeNUX names, or may only 
exist in cLIeNUX. Pathnames are all DSFH, such as /.bi/... instead of 
/bin/... In cLIeNUX Pasties reside in /.bi/Pastie, and that's in $PATH. 
A cp Pastie is the only pernicious name conflict, and so the Pastie in 
question moves over to cP. The cLIeNUX shell prompt output is harmlessly 
pasteable  due to the ":;" prefixes, which is a variation of the stock 
Plan 9 (from Bell Labs) rc command interface prompt, which is pasteable to 
ease this powerful feedback loop, but vis-a-vis reuse of previous 
scrolled-up commands, rather than purpose-built Pasties.

The cutoff point of cost/benefit to mouseing versus typing depends on 
several things; how you type, how you mouse, what you're doing, et cetera. 
In general, a menu interface reduces options. Sometimes that's good. Nobody
always knows exactly what they're doing, and when you're in flail-about
mode, assumptions, reminders, hints, examples and other fuzziness can 
save you eons.

I ask integrators of text-based systems to use the term "pasties" for 
similar facilities they may implement.

Rick Hohensee
May 2001


:; cLIeNUX /dev/tty3  14:16:07   /
:;<cursor>
:; cLIeNUX /dev/tty3  14:16:07   /
:;LIeNUX /dev/tty3  14:16:07   /
2.2.23-2001-04-15.tar     VVT.tar                   help
4th.tar.gz                arg_env.c                 incoming
ABOUT                     arg_env.o                 interlaced
ABOUT.Linux               atlast-1.0.tar.gz         k.c
Cintpos                   base.tgz                  ksh.1.html
Debian                    base2_2.tgz               log
GPL                       boot                      lost+found
H3rL.html                 changed_today             mounts
H3sm.1.txt                clive-on-bcpl.html        owner
HUGE                      coding                    pointertovoid
K                         command                   rootTree
LGPL                      configure                 source
Linux                     dev                       subroutine
MCPLhilites               device                    subroutine_machine
NetBSD                    don'ts                    suite
PIRDE.tgz                 floppy                    temp
RIGHTS                    gcc-core-20010326.tar.gz  unifdef.1.html
TODAYs                    guest                     units-1.55.tar.gz
:; cLIeNUX /dev/tty3  14:16:17   /
:;:;
:; cLIeNUX /dev/tty3  14:16:17   /
:;<cursor>
ls --color

ls --color


#!/.bi/sh
echo "
############################################################


page /ABOUT		# read about ABOUT 

page ABOUT		# read the current directory's ABOUT file, if any 

page /.bi/Pastie/ABOUT	# read the Pastie ABOUT file

edir \"*README*\"	# read the current README files, if any

page /GPL		# read a popular copyright release document	

edit /.bi/Pastie/ap
###########################################################
"

#!/.bi/sh
echo "
############################################################

browse	.		# browse starting at the current dir.

browse  /		

browse  ~/lynx_bookmarks.html

browse /.pro			# roam around under the hood

edit /.bi/Pastie/bp
###########################################################
"
###############!/.bi/sh
echo "
#############################################################
#You have found the cLIeNUX command, the top-level cLIeNUX Pastie
ap		About stuff, like this Pastie
bp		Browse your world
cP		Copy, Configure 
dp		Delete. There is no "undelete" in cLIeNUX
ep		edit : email
fp		find 
gp		GUI. As if you need one with PASTIES! HA!	
hp		Help
ip		Internet : IRC : Import a package
jp		jargon; Judge a package
kp		kill; Keyboard mappings and emergency mouse-only screen
lp		Listings, logout
mp		eMail, Math, mount
np		News		# grab an EOL here ==> 
op		open a file
pp		Print hardcopy, Postscript...
qp		quotes
rp		Read a textfile :  reset terminal settings
sp		Search : system Status stuff
tp		Textfile manipulators, Tetris, Tree
up		unpack : useage
vp		vt switch; View something
wp		write 
xp		extract		# grab a blank anywhere
yp		yellow pages
zp		
edit /.bi/Pastie/cLIeNUX    		# season to taste
#!\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ
#[\]^_\`abcdefghijklmnopqrstuvwxyz{|}"
#!/.bi/sh
echo "
############################################################








edit /.bi/Pastie/cP
###########################################################
"

#!/.bi/sh
echo "
############################################################
deleters


THERE IS NO UNDELETE IN cLIeNUX! 

files
read -p delete--  filetolose ; rm \$filetolose

ls -d */ 
read -p CAREFUL--  dirtolose ; rm -rf \$dirtolose		

edit /.bi/Pastie/dp
###########################################################
"

#!/.bi/sh
echo "
############################################################

ls 
read filename ; edit \$filename		# simple text editor

ls
read filename ; ed \$filename		# text processor

see ed

pmail -f <your mail server. EDIT ME.>

edit /.bi/Pastie/ep
###########################################################
"

#!/.bi/sh
echo "
############################################################

find / > /.hel/filelist			# (re)make \"got\" database

read have ; got \$have			# search the above for a string

read sought ; find / -name \$sought	# search the whole filesystem

read sought ; find . -name \$sought 	# search current directory

find needs quotes around glob patterns to look for, so that one 
you'll have to type in I guess.

edit /.bi/Pastie/fp
###########################################################
"

#!/.bi/sh
echo "
############################################################



X				# the X Window System, if installed.

edit /.bi/Pastie/gp
###########################################################
"

#!/.bi/sh
echo "
############################################################

help

shelp				# help specific to the cLIeNUX Bash shell

see see

read topic ; see \$topic

read topic ; apropos \$topic
 
other possible helps...
	<command> --help
	<command> -h
	<command>
	<command> any_unexpected_nonsense 

edit /.bi/Pastie/hp
###########################################################
"

#!/.bi/sh
echo "
############################################################
These should all start up as is, but you'll want to edit them. 
Don't put passwords in here, OK?

connect

ifconfig

netstat -a

irc

ppp-off

telnet

ftp

kermit

bp 			# cross-Pastie to \"browse\"

edit /.bi/Pastie/ip
###########################################################
"
#!/.bi/sh
echo "
############################################################

browse  /.hel/jargon.html		# jargon



read alien ; judge \$alien				# judge

edit /.bi/Pastie/jp
###########################################################
"
#!/.bi/sh
echo "
############################################################

loadkeys /.et/keyboard/defkeymap.map

loadkeys /.et/keyboard/dvorak.map

loadkeys /.et/keyboard/hexhead.map

fonts ; gpm -k ; sleep 1 ; gpm -t ps2		

ps ; read condemned ; kill \$condemned

SVGATextMode

#and in case you have a major keyboard problem
#!\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ
#[\]^_\`abcdefghijklmnopqrstuvwxyz{|}

edit /.bi/Pastie/lp
###########################################################
"
#!/.bi/sh
echo "
############################################################

ls --color

ls -R

find .

logout

find / -perm +6000 > SUIDS &		# scan system for SUID bits
echo \"making SUIDS file in current dir\"


find / -size +2000k > HUGE &		# list all files over 2 meg
echo \"making HUGE file in current dir\"

find / -mtime 1 > TODAYs &		# list all files modified in last 24 hours
echo \"making TODAYs file in current dir\"

edit /.bi/Pastie/lp
###########################################################
"



cat ABOUT IeNUX LIeNUX ap bp cLIeNUX cP dp ep \
fp gp hp ip jp kp lp mailer mp np op pp qp \
rp sp tp up vp wp xp yp zp > mailable
#!/.bi/sh
echo "
############################################################

pmail -f <your mailserver here>		# fetch the mail

mail			# read your in bin


mount			# list filesystems mounted under / 

cat /.pro/mounts	# surefire version of preceeding

df			# disc free capacity

mount -a		# mount everything

unmount -a		# unmount everything but /

math

calculate

sc

forth

see awk

read arithmatic ; echo \$((\$arithmatic))

add

edit /.bi/Pastie/mp
###########################################################
"
#!/.bi/sh
echo "
############################################################

slrn					# slow link read usenet news

read group ; browse news:\$group 	# web style

slrn -create				# initialize your local groups list
					# slrn needs this once.
see suck				# batch group grabber

see slrn

browse http://www.cnn.com

browse http://www.slashdot.com

browse http://www.usatoday.com

edit /.bi/Pastie/np
###########################################################
"

#!/.bi/sh
echo "
############################################################
\"open\" a file

see suffixes

ls 
read filename ; sniff \$filename ; ls -l \$filename 

ls
read filename ; judge \$filename 


edit /.bi/Pastie/op
###########################################################
"

#!/.bi/sh
echo "
############################################################
programming related, graded kinda

see programming
see sh
shelp
see awk
see C
see intro
see forth
see objcopy
see as
see ld
see cpp

edit /.bi/Pastie/pp
###########################################################
"
#!/.bi/sh
echo "
############################################################

fortune

edit /.bi/Pastie/qp
###########################################################
"

#!/.bi/sh
echo "
############################################################

ls
read text ; page \$text 

ls
read binary ; binedit \$binary

shelp read

see read

see also the cLIeNUX Ghostscript package, not in Core.

edit /.bi/Pastie/rp
###########################################################
"

#!/.bi/sh
echo "
############################################################

see scan

see grep

read regex ; grep -r \$regex .		# text scan whole directory

status

read huh ; google \$huh

edit /.bi/Pastie/sp
###########################################################
"

#!/.bi/sh
echo "
############################################################
textfile manipulation utils, usually pipeable, i.e. not editors.
Hard to predict what you want, so here's a help index.

see paste
see join
see tr
see pluck
see exchange
see dtw
see snug
see todos
see uniq
see sort
see cut

edit /.bi/Pastie/tp    
###########################################################
"

#!/.bi/sh
echo "
############################################################
unpackers of various types

ls
read tgz ;  tar tzvf \$tgz	# view a .tgz

ls
read tgz ;  tar xzvf \$tgz	# THEN unpack it

ls
read tgz ;  tar xvf \$tgz	# this is for .tar

ls
read wastar ; gzip -d \$wastar	# un-gzip

see suffixes

see unzip

edit /.bi/Pastie/up
###########################################################
"
#!/.bi/sh
echo "
############################################################

changevt \$((1+`tty | cut -b 9-10`)) 	# go up a vt

changevt \$((`tty | cut -b 9-10`-1)) 	# go down a vt

or do alt&right_arrow or ctrl&alt&f# where # is vt #

edit /.bi/Pastie/vp
###########################################################
"
#!/.bi/sh
echo "
############################################################
write an email-sink, write a file

read recipient ; mail \$recipient	# write email to somebody.

ls				
read text ; edit \$text			# write a textfile


edit /.bi/Pastie/wp
###########################################################
"
#!/.bi/sh
echo "
############################################################

hmmmm. What's a good subject for \"x\"?






edit /.bi/Pastie/xp
###########################################################
"

#!/.bi/sh
echo "
############################################################

browse http://www.yellowpages.com



edit /.bi/Pastie/yp
###########################################################
"

#!/.bi/sh
echo "
############################################################

see zip

edit /.bi/Pastie/zp
###########################################################
"