Making Unix a little more Plan9-like

栏目: IT技术 · 发布时间: 4年前

内容简介:I’m not really interested in defending anything. I tried out plan9port and liked it, but I have to live in Unix land. Here’s how I set that up.The suckless community, and some of the plan9 communities, are dominated by jackasses. I hope that’s strong enoug

I’m not really interested in defending anything. I tried out plan9port and liked it, but I have to live in Unix land. Here’s how I set that up.

A Warning

The suckless community, and some of the plan9 communities, are dominated by jackasses. I hope that’s strong enough wording to impress the severity. Don’t go into IRC for help. Stay off the suckless email list. The software is great, the people who write it are well-spoken and well-reasoned, but for some reason the fandom is horrible to everyone.

xterm

9term has some really cool ideas. But Unix has a long history of using graphical terminals, and lots of stuff needs VT220 compatibility. xterm is a good compromise.

You can make the xterm scroll bar (and all other Athena scrollbars) prettier with this in your X resources:

*Scrollbar.thickness: 10
*Scrollbar.thumb: None
*Scrollbar.foreground: gray80
*Scrollbar.background: gray50
*Scrollbar.borderWidth: 3
*ScrollBarBorder: 0

This will swap the left and right mouse buttons, to work like acme and 9term:

*Scrollbar.translations: #override\
	<Btn1Down>: StartScroll(Backward) \n\
	<Btn3Down>: StartScroll(Forward) \n\
	<BtnUp>: NotifyScroll(Proportional) EndScroll()

A side note: if xrdb is never run and your root window doesn’t have a RESOURCE_MANAGER property set, libXaw will read $HOME/.Xdefaults . This is supposedly deprecated, but Xaw is so ancient it will probably never be removed.

9wm

I’m now maintaining the 9wm window manager. If you like rio you should give it a whirl, there are some differences you might prefer. https://github.com/9wm/9wm

sshfs

As a non-root user, you can mount remote file systems locally with sshfs . It’s probably as close as Unix is going to get for a while, and it’s not awful.

lm

The plan9 lm command is great: it’s like apropos or man -k but it outputs lines you can copy and paste into a prompt to pull up the page. Here’s a script to do the same thing with Unix:

#! /bin/sh
apropos -l "$@" | sed 's/\(.*\) (\(.*\)) * - /man \2 \1 # /'

xdg-open

This is the current Linux notion of how to do things like the plumber. Just about every modern program calls out to it to open files, and it uses whichever one is first in your path, so you can make a little script to do what you want and avoid having to configure all the weirdo files in ~/.config

#! /bin/sh
case "$1" in
	*://*)
		exec web "$1"
		;;
	*.pdf)
		exec my-pdf-viewer "$1"
		;;
esac

mon

Russ Cox uses a program called mon to watch files and run them whenever they change. This is pretty handy for iterative debugging, you don’t have to keep re-running your program every time you save/compile.

Here’s a start at one. It can be improved.

#! /bin/sh
while true; do
	gonow=
	stat=$(stat --format=%Y.%Z.%s $1)
	if [ "$stat" != "${laststat:-$stat}" ]; then
		laststat=$stat
		gonow=yes
	fi

	if [ -n "$gonow" ]; then
		echo "[[=== start ===]]"
		$@
		echo "[[=== done ===]]"
	fi
	laststat=$stat
	sleep 1
done

以上所述就是小编给大家介绍的《Making Unix a little more Plan9-like》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

C语言进阶

C语言进阶

牟海军 / 机械工业出版社 / 2012-7 / 59.00元

C语言是编程语言中的一朵奇葩,虽已垂垂老矣,但却屹立不倒,诞生了数十年,仍然是最流行的编程语言之一。C语言看似简单,却不易吃透,想要运用好,更是需要积淀。本书是一本修炼C程序设计能力的进阶之作,它没有系统地去讲解C语言的语法和编程方法,而是只对C语言中不容易被初学者理解的重点、难点和疑点进行了细致而深入的解读,揭露了C语言中那些鲜为普通开发者所知的秘密,旨在让读者真正掌握C语言,从而编写出更高质量......一起来看看 《C语言进阶》 这本书的介绍吧!

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具