2007年10月16日星期二

SSH tips - configuring ~/.ssh/config to make your ssh command shorter

  有时候在家工作, 而我平时在办公室的工作环境是一台服务器, 所以在家时就需要以公司网关服务器做一些端口映射到我工作的服务器上. 但是经常敲一大串ssh command的确很烦恼, 所以就尝试着配置一下~/.ssh/config文件, 示例如下

Host gateway.com
Hostname gateway.company.com
User jacky
#forwarding of the authentication agent connection
ForwardAgent yes
GatewayPorts yes
#local ports forwarding for working servers
LocalForward localhost:9079 forge:9079
LocalForward localhost:9060 forge:9060
LocalForward localhost:9078 forge:9078
LocalForward localhost:9099 forge:9099
LocalForward localhost:9090 forge:9090
# local ports forwarding for vnc server
LocalForward localhost:5900 jacky:5900


(PS) Mac OS X Directory Structure explained

pasted from: http://osxdaily.com/2007/03/30/mac-os-x-directory-structure-explained/

If you have ever looked at your Mac’s root directory and wondered what some of those other directories are for, you’re probably not alone. Mac OS got a whole lot more complex with the advent of OS X, adapting a unix file structure that is largely unfamiliar to Mac OS 9 and Windows users. So just what is /System, /Library, /usr, and all the others for anyway? Here’s a brief explanation of each directory as found in Mac OS X.


By default, if you look in the root of your Mac’s hard disk you’ll see some unfamiliar sounding directories. From the command line, you will see even more if you type ls /. Explained in no particular order:

Directory Description
/Applications Self explanatory, this is where your Mac’s applications are kept
/Developer The Developer directory appears only if you have installed Apple’s Developer Tools, and no surprise, contains developer related tools, documentation, and files.
/Library Shared libraries, files necessary for the operating system to function properly, including settings, preferences, and other necessities (note: you also have a Libraries folder in your home directory, which holds files specific to that user).
/Network largely self explanatory, network related devices, servers, libraries, etc
/System System related files, libraries, preferences, critical for the proper function of Mac OS X
/Users All user accounts on the machine and their accompanying unique files, settings, etc. Much like /home in Linux
/Volumes Mounted devices and volumes, either virtual or real, such as hard disks, CD’s, DVD’s, DMG mounts, etc
/ Root directory, present on virtually all UNIX based file systems. Parent directory of all other files
/bin Essential common binaries, holds files and programs needed to boot the operating system and run properly
/etc Machine local system configuration, holds administrative, configuration, and other system files
/dev Device files, all files that represent peripheral devices including keyboards, mice, trackpads, etc
/usr Second major hierarchy, includes subdirectories that contain information, configuration files, and other essentials used by the operating system
/sbin Essential system binaries, contains utilities for system administration
/tmp Temporary files, caches, etc
/var Variable data, contains files whose contents change as the operating system runs

If we forgot anything, or if something isn’t properly described, feel free to chime in with comments.