粘贴板命令
mac: pbcopy-------pbpastewindows: cliplinux: xsel
连接Ubuntu桌面
sudo apt-get install x11vnc#配置vnc密码x11vnc -storepasswd#启动vnc服务x11vnc -forever -shared -rfbauth ~/.vnc/passwdMac打开Finder,Cmd+K(连接服务器),输入:vnc://172.26.1.139:5900然后输入密码即可!端口默认是5900
命令行安装Java
#!/bin/bashhdiutil attach jdk-8u201-macosx-x64.dmgcd /Volumes/JDK\ 8\ Update\ 201sudo installer -pkg JDK\ 8\ Update\ 201.pkg -target /#卸载镜像hdiutil detach /Volumes/JDK\ 8\ Update\ 201#卸载jdksudo rm -rf /Library/Java/JavaVirtualMachinesshell=$SHELL#zshif [ "$shell" == "/bin/zsh" ]then echo "zsh" if [ ! -f "$HOME/.zshrc" ]; then echo "not exist" touch $HOME/.zshrc else echo "exist" sed -i "" '/JAVA_HOME/d' $HOME/.zshrc fi echo 'export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home' >> $HOME/.zshrc echo 'export PATH=$JAVA_HOME/bin:$PATH' >> $HOME/.zshrc echo 'export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar' >> $HOME/.zshrc source $HOME/.zshrc#bashelif [ "$shell" == "/bin/bash" ]; then echo "bash" #不存在bash_profile文件 if [ ! -f "$HOME/.bash_profile" ]; then echo "bash_profile not exist,create it..." touch $HOME/.bash_profile else #存在bash_profile #删除JAVA_HOME sed -i "" '/JAVA_HOME/d' $HOME/.bash_profile fi #重新追加JAVA_HOME echo 'export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home' >> $HOME/.bash_profile echo 'export PATH=$JAVA_HOME/bin:$PATH' >> $HOME/.bash_profile echo 'export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar' >> $HOME/.bash_profile #刷新 source $HOME/.bash_profilefijava -version
脚本卸载Java
#!/bin/bashshell=$SHELL#zshif [ "$shell" == "/bin/zsh" ]then echo "zsh" #文件不存在时 if [ ! -f "$HOME/.zshrc" ]; then echo "not exist" else echo "exist" #mac下比较特殊,需加一个空的字符串表示备份文件 sed -i "" '/JAVA_HOME/d' $HOME/.zshrc fi source $HOME/.zshrc#bashelif [ "$shell" == "/bin/bash" ]; then echo "bash" #不存在bash_profile文件 if [ ! -f "$HOME/.bash_profile" ]; then echo "bash_profile not exist,..." else #存在bash_profile #删除JAVA_HOME sed -i "" '/JAVA_HOME/d' $HOME/.bash_profile fi #刷新 source $HOME/.bash_profilefisudo rm -rf /Library/Java/JavaVirtualMachines