---------------------------------------------
<庄暴见孟子>
(孟子)曰:“独乐乐,与人乐乐,孰乐?”
(王)曰:“不若与人。”
-------------------------------------------------------------------------------------------------------------
此贴谢绝 pk , 纯净水,不定期更新(连载),不回答任何问题,没售后服务,也不是指南,不保证所有技巧都是正确的,( iblicf 协议,免责声明 ) 目的只是营造和谐气氛, 一起分享 ubuntu 的心得体会,学习和应用中的感想感触,苦乐尴尬, 当然不一定是技术方面的, 抛砖引玉,大家一起分享经验
俺们都是菜菜,水平不高,不过俺们乐于(勇于)分享
-----------------------------------------------------------------------------------
1,) Crash ? you should try magic keys ...
如果ubuntu系统没反应了,俗称死机了,你可以试试魔术键:
人生自古谁无死 ? 没死过机那就装个compiz 玩玩,,:) 一般的进程死还好办,kill, fuser 就行了,compiz 这种是死的透透的,键盘没反应,没法切到控制台(ctr+alt+f1), 假如有网络环境,可以从别的机子ssh上来,kill session ,可如果是单机,那基本没辙了,只有reset .我的机子reset 还坏了,只能冷启动。偶然在网上看到一个老外的blog,,给出这个 magic keys ,可以 ( gracefully ) 优雅的重启或者 bring it back
ALT + sysrq + 下边列出来的键
( sysrq 就是 prt-scr 至于怎么同时按这三个键,自己试吧,反正挺别扭,恐怕得会双手互搏的功夫 )
‘k’ - Secure Access Key (SAK) Kills all programs on the current virtual console.
强烈推荐这个,功能似乎是重启 session,类似于( crl+alt+backspace )
下边的我没都试,有的管用,有的没啥反应,大多要重启一次机子,谁有那精神毅力,请原谅
‘r’ - Turns off keyboard raw mode and sets it to XLATE.
‘b’ - Will immediately reboot the system without syncing or unmounting your disks.
‘c’ - Will perform a kexec reboot in order to take a crashdump.
‘o’ - Will shut your system off (if configured and supported).
’s’ - Will attempt to sync all mounted filesystems.
‘u’ - Will attempt to remount all mounted filesystems read-only. ‘p’ - Will dump the current registers and flags to your console.
‘t’ - Will dump a list of current tasks and their information to your console.
‘m’ - Will dump current memory info to your console.
‘v’ - Dumps Voyager SMP processor info to your console.
‘0′-’9′ - Sets the console log level, controlling which kernel messages will be printed to your console.
‘f’ - Will call oom_kill to kill a memory hog process
‘e’ - Send a SIGTERM to all processes, except for init.
‘i’ - Send a SIGKILL to all processes, except for init.
‘l’ - Send a SIGKILL to all processes, INCLUDING init.
------------------------------------------------------------------------------------------
2,) KDE or GNOME ? how about both ?
有人喜欢KDE,有人喜欢Gnome ,如果可以同时用的话(Gnome/KDE在同一个工作区), 好像很 cool , 前提是你gnome/kde都装了,并且至少有2个可登录账户
如果你是Gnome桌面,那可以这样装个KDE :
一般情况下,你可以在gdm登录界面选择进哪个桌面,可以选缺省是进哪个桌面
代码: 全选
sudo aptitude update && sudo aptitude install kubuntu-desktop
代码: 全选
sudo apt-get install xnest
代码: 全选
gdmflexiserver --xnest
代码: 全选
gdmflexiserver -n
安装2个图形环境有许多坏处, 请三思而行:单说 kubuntu-desktop 大概就得300M ,而且更新的时候,update 也很可观; 无论进g/k,菜单混杂在一起 , 也不能彻底删除, 启动的那个splash也改成了kubuntu ,,
这种方式有没有什么实际意义我不知道,可能你喜欢k3b, 尝试kde下的浏览器 ... 对我来说纯娱乐
删除KDE: ( 据说aptitude 方式装的,删除比较彻底 )
代码: 全选
sudo aptitude remove kubuntu-desktop
3,) Changing the defaults
ubuntu有很多缺省的定义,关联 .... 参看 /etc/alternatives ,了解一下,都是链接.
可以用 update-alternatives 修改,有什么意义呢? 举例说明改缺省的 editor :
代码: 全选
sudo update-alternatives --config editor
代码: 全选
现有 8 个可选项,它们都提供了“editor”<
选择 可选项
------------------------------------------------------------
1 /usr/bin/vim.tiny
2 /bin/ed
3 /bin/nano
*+ 4 /usr/bin/vim.full
5 /usr/bin/vim.gnome
6 /usr/bin/emacs21
7 /usr/bin/mcedit-debian
8 /usr/bin/emacs22
ubuntu 好像缺省的editor就是vi, 比如crontab -e
代码: 全选
# m h dom mon dow command
#45 13 * * * /usr/bin/mplayer ~/Examples/ubuntu\ Sax.ogg 2>/dev/null
嗯,crontab 也建议都会用
-----------------------------------------------------------------------------------------------------
4,) mailx -- have u ever use mailx ? mailx is great !
我看过至少5遍越狱,,:) , 经常冒出来一些pb里头经典的对话场景:
Scofield 英雄救美的时候,为了安慰 sara 没话找话: "have u ever been to tailand? tailand is great "
mailx很cool , 比如我习惯把.bashrc/.vimrc这些配置文件做备份放到一个安全地方
代码: 全选
cat .bashrc |mailx -s "my .bashrc config" xxxxx@gmail.com
很神奇,真的发到gmail邮箱了,gmail把它当垃圾邮件了,^^ 如果有人问什么是windows不能做,nix下能做的,我肯定想到这个,shell 真好 ! 如果你给你朋友演示ubuntu , 看过compiz 以后,让他看看这个 ...
mailx 没有的话 :
代码: 全选
sudo apt-get install mailx postfix
5 ) < 3 秒钟关机
linux 关机傻忽忽的要把 /etc/init6.d 下边的服务挨个检查一遍,它默认的是一个多用户环境,我就
代码: 全选
poweroff -f
--------------------------------------
6, ) 区域截图
一直觉得 gnome 下缺少一个局部截图的手段, 以前是用gimp处理,后来gimp2.3带了区域截图工具,.... 据说kde下有,eva也有这功能...后来发现了 imagemagick 这个好东西(包含 import/convert 这两个宝贝 ), 更加方便了. 又体会了那句话 : "没有的就是不需要的"
代码: 全选
sudo apt-get install imagemagick
代码: 全选
$import snap.png
代码: 全选
#!/bin/bash
import -pause 5 ~/Desktop/snap.png
--------------------------------------
好了,今天就到这里, 且听下回分解...
################################################
Gmailfs 19楼<2007/8/10>
-----------------------------------
################################################
Local DNS cache 18楼
----------------------------------------------------------
alias (2007/8/12)
---------------------------------------------------------------------
※ linux 命令通常都要跟一些参数执行,如果每次都是手动的添加就是显得麻烦了,有的也不好记 . linux 可能通过( alias )别名的功能来减少你的输入 , alias 一般放在 .bashrc 文件里 ,. 使用别名能提高工作效率,下边是我常用的一些alias, 我会大致解释一下, 我希望大家能贴出自己喜欢常用的alias , 也稍作解释,分享一下 : )
alias ls='ls -S -ho --color=auto'
-S 用来按文件大小排序的
alias ld='ls -l |grep "^d"'
这个是只列出目录,因为我发现 ls -d 似乎不象manpage里边描述的那样工作
alias km='fuser -k /usr/bin/mplayer'
fuser -k 也是用来杀进程的,(kill 跟某个文件有关的进程), mplayer 经常死,如果用 ps 查进程号再杀,显得罗嗦了, fuser -k 就很方便
alias kd='fuser -k /home/weiyh/software/mldonkey-2.9.0/mlnet'
同理,我设置 sancho 退出不 kill core ,,我想用 sancho 的一些gui方便, 我也想 mldonkey 在后台运行节约资源, 如果我想暂时停掉 mldonkey ,比如要用其他bt了,要apt-get update 了, fuser -k , kill 掉 mlnet
alias shut='sudo poweroff -f'
这个我用来快速关机
alias cman='man -M /home/weiyh/readings/zh_CN1'
这个是我的中文man手册
alias ce='compiz --replace -c emerald & >&/dev/null'
这个是启用compiz fussion , 第一个 "&" 是后台运行,第 2 个 "&" 是为了不显示提示,错误什么的
alias q='amixer -c 0 set PCM 6dB+ 1>/dev/null'
alias z='amixer -c 0 set PCM 6dB- 1>/dev/null'
gnome下调节音量不太方便,如果你说可以用鼠标滚轮,是的,不过那只能调节 master 主声道的音量,gnome 快捷方式也是 .... 许多播放器,比如 mplayer / audacious 它们直接改的是 PCM 声道, 要想调节PCM就得双击那个喇叭,很慢的调出来一个窗口,我这里经常是 ( 3-5秒 ), 我是个键盘主义者,试验了一下,找到了命令行方式,q +6分贝,z -6分贝,步进值可以改 , 好了,这样就简单了
+++++++++++2007/11/22+++++++++++++++++++++
# try to repair the X and get back to GUI
#窗口进不去了之类的
sudo dpkg-reconfigure -phigh xserver-xorg
# chinese support
# 语言支持里没有中文
sudo apt-get install language-support-zh
# mount .iso
# "虚拟光驱"
mount $ISOFILE $MOUNTPOINT -t iso9660 -o loop,utf8
# mount squashfs
# 安装光盘里主要内容(目录结构在 squashfs 文件里, 这样挂载可以解决类似误删除 /bin 目录 )
sudo mount -o loop -t squashfs ./filesystem.squashfs /mnt/squashfs
#adjust crt
#显示器有偏移? win / lin 下不一致
sudo xvidtune
#mp3 ID3 tag
#解决 mp3 IDtag 在 linux 下乱码
sudo apt-get install python-mutagen
find . -iname “*.mp3” -execdir mid3iconv -e GBK {} \;
mid3iconv -e GBK *.mp3
#ssh file_trans
tar cf - FILES | ssh server ( cd SDIR ; tar xfv - )
#查看 uuid
ls -l /dev/disk/by-uuid
# 备份MBR ... 恢复 if/of 反操作 , 注意 MBR(446) + DBR (64) = 512
dd if=disk.mbr of=/dev/sda bs=512 count=1
#static ip
gedit /etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.0.200
netmask 255.255.255.0
gateway 192.168.0.1
# rename
# 把所有文件的后辍由rm改为rmvb
rename "s/.rm$/.rmvb/" *
# 把所有文件名中的大写改为小写
rename "tr/A-Z/a-z/" *
#详细显示程序的运行信息
strace -f -F -o outfile <cmd>
#查看包在服务器上面的地址 , 不太好用
apt-get -qq --print-uris install ssh | cut -d\' -f2
#ctags
ctags -R --c++-kinds=+p --fields=+iaS --extra=+q -f ~/.vim/stltags /usr/include/c++/4.1.2
vi .vimrc--> set tags+=~/.vim/stltags
#修改 ip_forward , 重定向的方式 permission denied , 如下就可以了
echo 1|sudo tee /proc/sys/net/ipv4/ip_forward
#forcefsck , 强制下次启动检测分区
sudo touch /forcefsck
#axel ,带 login / pass
axel -a -n10 http://ubuntu:ubuntuftp@ftp.ubuntu.org. ... r3E_CN.pdf
#vi-cp936 , vi 查看 gbk 编码的文件
:edit ++enc=cp936
+++++++++++++++++++++++++++++++++++++++
分享,分享,你的经验教给别人,别人有了收获,你也没有损失什么 ....