免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 704 | 回复: 0
打印 上一主题 下一主题

一些linux小tips(随时想到随时加) [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-05-28 22:16 |只看该作者 |倒序浏览
北京理工大学  20981  陈罡
一些小技巧,总是容易忘记,写在网上就不容易忘记了,查起来也方便。我一直使用slackware做为自己的linux桌面环境,主要原因嘛:
首先,它full install以后基本上配套的源代码和工具啥的都装上了,不用再下载kernel自己编译工具链啥的,比较适合像偶这样的懒人;其次,它的启动脚本的处理还是严格按照unix的机制来用习惯了;软件管理,生成一个tgz,就可以直接用installpkg, removepkg啥的直接安装,也马马虎虎。多数软件都可以从源代码直接编译出来,不会缺这少那的。

(1)去掉slackware烦人的“嘀嘀”声
打开/etc/inputrc,将“set bell-style none”前面的“#”给去掉。
然后重新登录一次,于是,整个世界安静了。

(2)帖一些emacs的简单配置,省得每次重装都要满世界的去找
(custom-set-variables
  ;; custom-set-variables was added by Custom -- don't edit or cut/paste it!
  ;; Your init file should contain only one such instance.
'(case-fold-search t)
'(current-language-environment "Chinese-GB")
'(default-input-method "chinese-py-punct")
'(global-font-lock-mode t nil (font-lock)))
(custom-set-faces
  ;; custom-set-faces was added by Custom -- don't edit or cut/paste it!
  ;; Your init file should contain only one such instance.
)
;; enable cscope support
(add-hook 'c-mode-common-hook
   '(lambda ()
     (require 'xcscope)))
;; python-mode support
(setq auto-mode-alist (cons '("
\\.py$
" . python-mode) auto-mode-alist))
(setq interpreter-mode-alist (cons '("python" . python-mode) interpreter-mode-alist))
(autoload 'python-mode "python-mode" "Python editing mode." t)
(setq font-lock-maximum-decoration t)
(global-font-lock-mode t)
;; get off tool bar
(tool-bar-mode -1)
(setq-default make-backup-files nil)
(show-paren-mode t)
(setq lazy-lock-defer-on-scrolling t)
(setq font-lock-support-mode 'lazy-lock-mode)
(column-number-mode t)
(display-time)
;; replace yes, no selection to y or n directly
(fset 'yes-or-no-p 'y-or-n-p)
(setq visiable-bell t)
(global-set-key [?\S- ] 'set-mark-command)
;; set emacs default frame window size
(setq default-frame-alist (append '((top . 0) (left . 0) (width . 100) (height . 40)) default-frame-alist))
;; highlight selected regions
(transient-mark-mode t)
(put 'upcase-region 'disabled nil)
;; text mode first
(setq default-major-mode 'text-mode)
;; support middle mouse key paste
(setq mouse-yank-at-point t)
(transient-mark-mode t)
;; support open iamge file
(auto-image-file-mode t)
;; shut up
(setq visible-bell t)
;; support mouse wheel
(mouse-wheel-mode t)

(3)对usb鼠标滚轮的支持方法
打开/etc/X11/xorg.conf,然后修改Identifier为Mouse1的Sesstion,使其满足下面的配置:
Section "InputDevice"
    Identifier "Mouse1"
    Driver "mouse"
    Option "Protocol"    "IMPS/2"
    Option "Device"      "/dev/mouse"
    Option "Buttons"   "5"
    Option "ZAxisMapping" "4 5"
EndSection

(4)做为公网服务器的时候,得到公网ip地址的脚本
#!/usr/bin/python
import os ;
import commands ;
cmd_str = "wget -q -O - www.whatismyip.org | sed -e 's/.*Current IP Address: //' -e 's/ ;
output_str = commands.getoutput(cmd_str) ;
print "public ip is ----> " + output_str ;



本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/26691/showart_714736.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP