2007年5月7日星期一

How To Empty the Ubuntu Gnome Trash from the Command Line

How To Empty the Ubuntu Gnome Trash from the Command Line

Ubuntu has a trash can/recycle bin feature similar to windows. The difference with Ubuntu is that you can empty the trash from the command line.

Here’s the full trash icon, in the lower right hand corner:

Just open a terminal and type in the following command:

rm -rf ~/.Trash/*

Trash has been taken out!

2007年5月6日星期日

解决ubuntu自带PDF阅读器乱码问题

代码:
sudo apt-get install xpdf-chinese-simplified

How to Create PDF Documents in Ubuntu

转自ubuntu geek
If you are using OpenOffice it is very easy to create documents there is an option in the File menu ‘Export as PDF’.For other applications, you will need to do the following procedure

We need to install cups-pdf this software is designed to produce PDF files in a heterogeneous network by providing a PDF printer on the central fileserver. It is available under the GPL and is packaged for many different distributions or can be built directly out of the source files.

Install cups-pdf

sudo apt-get install cups-pdf

You need to chnage the following file permissions

sudo chmod +s /usr/lib/cups/backend/cups-pdf

Configure CUPS for the PDF printer.

- Select SYSTEM > ADMINISTRATION > PRINTERS > NEW PRINTER
- Select LOCAL PRINTER
- Use detected printer: PDF PRINTER
- Select Print Driver:
- Manufacturer: Generic
- Model: Postscript Color Printer
- Name: postscript-color-printer-rev3b
- Click APPLY

When printing from any application, select the newly created postscript-color-printer-rev3b printer to generate PDF files.

Output files are stored in your home directory under /PDF subirectory.

To change the default location of the PDF output

Edit the /etc/cups/cups-pdf.conf file

gksudo gedit /etc/cups/cups-pdf.conf

look for

Out ${HOME}/PDF

and change to something like below

Out ${HOME}/my_print_to_pdf_folder

and restart

sudo /etc/init.d/cupsys restart

其实有了OOo,这东西真没什么必要!:)

2007年5月4日星期五

how to fix the error fail to load the desktop after rebooting X-window!


Code:
killall nautilus

试了一下,显示:

Code:
nautilus: no process killed

看来nautilus这个程序是关键。于是直接运行nautilus,桌面图标马上就显示出来了。
接着Ctrl+C,桌面一闪然后就又一切正常了。看来nautilus还智能的。
顺便提一下, gnome下刷新面板的方法:

Code:
killall gnome-panel


Pidgin 2.0.0 final

Pidgin——支持多种协议的即时通讯工具,其 2.0.0 正式版目前已可从 SourceForge 上下载得到。然而,现在还不能从 Pidgin 的官方网站上看到相应的发布消息,也许开发者们正在准备吧。只需要一个软件便可同时登录QQ,MSN,Gtalk已不再是梦想!

Pidgin

Download Pidgin 2.0.0

编译安装:


  1. 获取 Pidgin 2.0.0 的源代码。我下载的是 pidgin-2.0.0.tar.bz2。
  2. 准备编译 Pidgin 所需的依赖:sudo apt-get build-dep gaim
  3. tar jxvf pidgin-2.0.0.tar.bz2
    cd pidgin-2.0.0/
  4. ./configure --prefix=/usr,建议在执行此步时使用 ./configure --help 查询需要使用的选项,可根据自己的实际情况选择。
  5. make
  6. sudo make install

经过以上步骤后,Pidgin 就安装到系统中了。在终端中输入 pidgin 即可执行程序。

Pidgin
Pidgin 2.0.0 主窗口截图

Pidgin
Pidgin 2.0.0 聊天窗口截图

Pidgin
Pidgin 2.0.0 关于窗口截图


howto update and install software after delete /var/cache/apt/archives!

several days ago I was too boring to do anything else, so I delete all the files under /var/cache/apt/archives, because it is said all these files are installed software packages, I thought they are useless. Then here comes a big problem, when I type apt-get install * or apt-get update, the terminal will give the hint that could not open lock file /var/cache/apt/archives/lock - open, and unable to lock the download directory,
I do

Code:
sudo mkdir /var/cache/apt/archives
sudo mkdir /var/cache/apt/archives/lock
sudo aptitude update
sudo aptitude upgrade
now I can do

Code:
sudo apt-get update
and


Code:
sudo apt-get dist-upgrade
but, there is still a problem that I can't install any software ,when I do


Code:
sudo apt-get install *
I got the message:

Code:
E:could not open lock file  /var/cache/apt/archives/lock - open(21 is a directory)
E:unable to lock the download directory!
Then I tried this:
Code:
sudo mv /var/cache/apt/archives/lock ~/.
sudo apt-get clean
to remove the lock.and it's finally works. :)
By the way, the best way to delete the downloaded package is:
Code:
sudo apt-get clean 
and you never try to delete any files under filesystem without a backup.

how to fix the Error:opening/initializing the selected video_out (-vo)device

you are getting this: Error opening/initializing the selected video_out (-vo)device error when you run mplayer , open terminal and run this command:
code:

 gmplayer -vo x11 -ao oss
and play your file. REMEMBER this only applies after installing mplayer and codecs.

I find many ubuntuers besides me meet this problem,hope this can help you.
Another question is mplayer can't play a movie file by fullcreen, then you should edit
~/.mplayer/config and just add the line:

Code:
zoom=yes
that seemed to do the trick .

2007年5月3日星期四

Ultimate Ubuntu performance tweaking guide

Lets start first with the kernel:

apt-get install build-essential libncurses-dev kernel-package
cd /usr/src
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.20.tar.bz2


This will download the latest sources available, in my case linux-2.6.20.tar.bz2

cd /usr/src
tar -xjf linux-2.6.20.tar.bz2
cd linux-2.6.20

Now lets apply the Con Kolivas patches, these are patches designed to improve system responsiveness with specific emphasis on the desktop, but suitable to any workload.

wget www.kernel.org/pub/linux/kernel/people/ck/patches/2.6/2.6.20/2.6.20-ck1/patch-2.6.20-ck1.bz2
bzcat patch-2.6.20-ck1.bz2 |patch -p1

Copy the current kernel config and configuring the kernel

cp /boot/config-`uname -r` .config
make menuconfig

In “General Setup” activate:
- Support for paging of anonymous memory (swap)
- Support for prefetching swapped memory

In “Processor type and features“:
- Processor family Choose the model of your processor.
- set Preemption Model to Voluntary Kernel Preemption (Desktop)
- High Memory Support
- off - if you have less than 1 GB of RAM
- 1GB Low Memory Support - if you have 1GB of RAM
- 4GB - if you have more than 1GB of RAM
- set Timer frequency to 1000 Hz

In “Kernel hacking” uncheck “Kernel debugging“.

Now exit and save the configuration.

Making the new kernel package:
make-kpkg -initrd –revision=LinuxMonitor1 kernel_image kernel_headers modules_image

Installing the new kernel
cd ..
dpkg -i *.deb

HDParm

sudo gedit /etc/hdparm.conf

at the bottom add:

/dev/hda {
dma = on
io32_support = 1
}

/dev/cdroms/cdrom0 {
dma = on
interrupt_unmask = on
io32_support = 0
}

Concurrent Booting

Concurrent booting allows Ubuntu to take advantage of dual-core processors, as well as processors that hyperthread or multithread
or what ever the different companies call it now.


sudo gedit /etc/init.d/rc

Look through the file and you will find CONCURRENCY=none.
You must change it to:
CONCURRENCY=shell


Prelink

Disclaimer: Prelinking might break your system! Only consider for use if you can risk the chance that your install might mess up. Most of all make sure that it gets to run the whole thing through the first time you prelink. Stopping in the middle can lead to system failure. Prelinking is a powerful device and needs to be used with care.

Prelink is no longer necessary in Feisty. Feisty uses a new linking mechanism called DT_GNU_HASH which dramatically speeds up the linking process without the need for continuously running this prelink program. Again, prelink is NOT useful starting from Feisty

How to enable prelink

1. Activate Ubuntu universe sources
2. Put this command into terminal to install Prelink:

sudo apt-get install prelink

3. Now put this command into the terminal:

sudo gedit /etc/default/prelink


4. Change where it says “PRELINKING=unknown” from unknown to “yes
5. Adjust the other options if you know what the heck you’re doing. If it looks foreign to you, the defaults work well.
6. To start the first prelink (the longest one!), put this in terminal:

sudo /etc/cron.daily/prelink

Automatic Prelinking After Program Are Installed

One problem with prelinking in that when you install new programs those programs are not prelinked. So to avoid this problem when installing programs with apt-get or synaptic, use the directions below.

1. Put this in terminal:

sudo gedit /etc/apt/apt.conf

2. When the file opens in Gedit, put this line at the end of the file and save (even if the file has no content before you add the line):

DPkg::Post-Invoke {”echo Running prelink, please wait…;/etc/cron.daily/prelink”;}

General Notes About Prelinking

In the future, prelink performs a quick prelink (a less-than-1-minute procedure on most systems) daily, usually at midnight. Every 14 days, or whatever you changed it to be, a full prelink will run.

If you just did a major apt-get upgrade that changed systemwide libraries (i.e. libc6, glibc, major gnome/X libs, etc etc etc) and experience cryptic errors about libs, rerun step 6.

To undo prelink, change step 4 from yes to no, then rerun step 6.

Prelinking will make the binaries it prelinks change, so it’s not appropriate if you have tripwire or another checksum-based IDS system, or if you do incremental or differential backups to save on space.

Services


*Note you might not have all these services on your box.

To enable/disable services go to System -> Administration -> Services

1. acpi-support - leave it on.
2. acpid - The acpi daemon. These two are for power management, quite important for laptop and desktop computers, so leave them on.
3. alsa - If you use alsa sound subsystem, yes leave it on. But if you have the service below, its safe to be off. The default is off when alsa-utils is on.
4. alsa-utils - On my system, this service supercedes the alsa, so I turn off the alsa and turn this on at S level.
5. anacron - A cron subsystem that executes any cron jobs not being executed when the time is on. Most likely you’ve probably turned your computer off when a certain cron job time is ready. For example, updatedb is scheduled at 2am everyday, but at that moment, you computer is off, then if anacron service is on, it will try to catch up that updatedb cron.
6. apmd - If you computer is not that old which can’t even support acpi, then you may try to turn this off.
7. atd - like cron, a job scheduler. I turned it off.
8. binfmt-support - Kernel supports other format of binary files. I left it on.
9. bluez-utiles - I turned it off. I don’t have any bluetooth devices.
10. bootlogd - Leave it on.
11. cron - Leave it on.
12. cupsys - subsystem to manager your printer. I don’t have one so I turned it off, but if you do, just leave it on.
13. dbus - Message bus system. Very important, leave it on.
14. dns-clean - Mainly for cleaning up the dns info when using dial-up connection. I don’t use dial up, so I turn it off.
15. evms - Enterprise Volumn Management system. I turned it off.
16. fetchmail - A mail receving daemon. I turned it off.
17. gdm - The gnome desktop manager. I turned it off anyway since I get use to boot to console first. This is up to you if you want to boot directly to GUI.
18. gdomap - You can turn it off.
19. gpm - Mouse support for console. If you feel you’d better have a mouse on console, go turn it on.
20. halt - Don’t change it.
21. hdparm - tuning harddisk script, should be on.
22. hibernate - If your system support hibernate, leave it on. Otherwise, its useless for you.
23. hotkey-setup - This daemon setup some hotkey mappings for Laptop. Manufacturers supported are: HP, Acer, ASUS, Sony, Dell, and IBM. If you have a laptop in those brands, you can leave it on, otherwise, this might not have any benefits for you.
24. hotplug and hotplug-net - activating hotplug subsystems takes time. I’d consider to turn them off.
25. hplip - HP printing and Image subsystem. I turned it off.
26. ifrename - network interface rename script. Sounds pretty neat but I turned it off. Mainly for managing multiple network interfaces names. Since I have a wireless card and an ethernet card, they all assigned eth0 and ath0 from kernel, so its not really useful for me.
27. ifupdown and ifupdown-clean - Leave it on. They are network interfaces activation scripts for the boot time.
28. inetd or inetd.real - take a look your /etc/inetd.conf file and comment out any services that you don’t need.
29. klogd - Leave it on.
30. laptop-mode - A service to tweak the battery utilization when using laptops. You can leave it on.
31. linux-restricted-modules-common - You need to see if you really have any restricted modules loaded on your system. I’d leave it on.
32. lvm - I don’t use it so I turned it off. Leave it on if you *DO* have lvm.
33. makedev - Leave it on.
34. mdamd - Raid management tool. I don’t use it so I turned it off.
35. mdamd-raid - Raid tool. If you don’t have Raid devices, turn it off.
36. module-init-tools - Load extra modules from /etc/modules file. You can investigate your /etc/modules file and see if there is any modules that you don’t need. Normally, this is turned on.
37. mountvirtfs - mount virtual filesystems. Leave it on.
38. networking - bring up network interfaces and config dns info during boot time by scaning /etc/network/interfaces file. Leave it on.
39. ntpdate - Sync time with the ubuntu time server. Leave it on if you want.
40. nvidia-kernel - I compiled the nvidia driver by myself, so its useless for me now. If you use the ubuntu nvidia driver from the restrict modules, just leave it on. 41. pcmcia - pcmcia device - useless if you are using desktop which doesn’t have pcmcia card. So in that case, turn it off please.
42. portmap - daemon for managing services like nis, nfs, etc. If your laptop or desktop is a pure client, then turn it off.
43. powernowd - client to manage cpufreq. Mainly for laptops that support CPU speed stepping technology. Normally, you should leave it on if you are configuring a laptop, but for desktop, it might be useless.
44. ppp and ppp-dns - Useless to me. I don’t have dial-up.
45. readahead - It seems readahead is a kind of “preloader”. It loads at startup some libs on memory, so that some programs will start faster. But it increases startup time for about 3-4 seconds. So, you can keep it… or not. I tested and I just didn’t feel difference loading programs. So I decided to turn it off. If you have a reason to keep it on, please do so.
46. reboot - Don’t change it.
47. resolvconf - Automatically configuring DNS info according to your network status. I left it on.
48. rmnologin - Remove nologin if it finds it. It wouldn’t happen on my laptop, so I got rid of it.
49. rsync - rsync daemon. I don’t use it on my laptop, so turned it off.
50. sendsigs - send signals during reboot or shutdown. Leave it as it is.
51. single - Active single user mode. Leave it as it is.
52. ssh - ssh daemon. I need this so I turned it on.
53. stop-bootlogd - stop bootlogd from 2,3,4,5 runlevel. Leave it as it is.
54. sudo - check sudo stauts. I don’t see any good to run it everytime on a laptop or desktop client, so I turned it off.
55. sysklogd - Leave it as it is.
56. udev and udev-mab - Userspace dev filesystem. Good stuff, I left them on.
57. umountfs - Leave it as it is.
58. urandom - Random number generator. Might not useful but I left it on.
59. usplash - Well, if you really want to see the nice boot up screen, leave it as it is.
60. vbesave - video card BIOS configuration tool. Its able to save your video card status. I left it on.
61. xorg-common - setup X server ICE socket. Leave it as it is.
62. adjtimex - This is a kernel hw clock time adjusting too. Normally, you shouldn’t see this on your boot up list. In very rare case if you do see its on your boot up process, then there might be a reason why it is on, so better leave it that way. In my case, it is off.
63. dirmngr - A certification lists management tool. Work with gnupg. You will have to see if you need it or not. In my case, I turned it off.
64. hwtools - A tool to optimize irqs. Not sure what’s the benefits of turning it on. In my case, I turned it off.
65. libpam-devperm - A daemon to fix device files permissions after a system crash. Sounds pretty good, so I left it on.
66. lm-sensors - If you matherboard has builtin some sensor chips, it might be helpful to see hw status via userspace. I ran it and it said “No sensors found”, so I turned it off.
67. screen-cleanup - A script to cleanup the boot up screen. Well, turn on or off is up to you. In my case, I left it on.
68. xinetd - A inetd super daemon to manage other damons. In my system, the xinetd is managing chargen, daytime, echo and time (find them from /etc/xinetd.d dir), I care none of them, so I turned it off. If you do have some important services configured under xinetd, then leave it on.

linux学习笔记(6)开机流程简介

开机流程简介
1、載入 BIOS 的硬體資訊,並取得第一個開機裝置的代號;
2、讀取第一個開機裝置的 MBR 的 boot Loader (亦即是 lilo, grub, spfdisk 等等) 的開機資訊;
3、載入 Kernel 作業系統核心資訊, Kernel 開始解壓縮,並且嘗試驅動所有硬體裝置;
4、Kernel 執行 init 程式並取得 run-level 資訊;
5、init 執行 /etc/rc.d/rc.sysinit 檔案;
6、啟動核心的外掛模組 (/etc/modprobe.conf);
7、init 執行 run-level 的各個批次檔( Scripts );
8、init 執行 /etc/rc.d/rc.local 檔案;
9、執行 /bin/login 程式,並等待使用者登入;
10、登入之後開始以 Shell 控管主機。
在/etc/rc.d/rc3.d內,以S开头的为开机启动,以K开头的为关闭,接着的数字代表执行顺序
GRUB vga设定
彩度\解析度 640x480 800x600 1024x768 1280x1024 bit
256 769 771 773 775 8 bit
32768 784 787 790 793 15 bit
65536 785 788 791 794 16 bit
16.8M 786 789 792 795 32 bit

./configure 检查系统信息 ./configure --help | more 帮助信息
make clean 清除之前留下的文件
make 编译
make install 安装
rpm -q ----->查询是否安装 rpm -ql ------>查询该套件所有的目录
rpm -qi ----->查询套件的说明资料 rpm -qc[d] ----->设定档与说明档
rpm -ivh ---->安装 rpm -V -------->查看套件有否更动过
rpm -e ------>删除 rpm -Uvh ------->升级安装
--nodeps ----->强行安装 --test ----->测试安装


http://blog.chinaunix.net/u/30619/showart.php?id=249558

linux学习笔记(5)帐户管理

帐号管理
/etc/passwd 系统帐号信息
/etc/shadow 帐号密码信息 经MD5 32位加密
在密码栏前面加『 * 』『 ! 』禁止使用某帐号
/etc/group 系统群组信息
/etc/gshadow
newgrp 改变登陆组
useradd & adduser 建立新用户 ---------> useradd -m test 自动建立用户的登入目录
useradd -m -g pgroup test --------->指定所属级
/etc/default/useradd 相关设定
/etc/login.defs UID/GID 有關的設定
passwd 更改密码 -----------> passwd test
usermod 修改用户帐号
userdel 删除帐号 ----------->userdel -r test
chsh 更换登陆系统时使用的SHELL [-l]显示可用的SHELL;[-s]修改自己的SHELL
chfn 改变finger指令显示的信息
finger 查找并显示用户信息
id 显示用户的ID -----------> id test
groupadd 添加组
groupmod 与usermod类似
groupdel 删除组
su test 更改用户 su - 进入root,且使用root的环境变量
sudo 以其他身份来执行指令
visudo 编辑/etc/sudoers 加入一行『 test ALL=(ALL) ALL 』
%wheel ALL = (ALL) ALL 系统里所有wheel群组的用户都可用sudo
%wheel ALL = (ALL) NOPASSWD: ALL wheel群组所有用户都不用密码NOPASSWD
User_Alias ADMPW = vbird, dmtsai, vbird1, vbird3 加入ADMPW组
ADMPW ALL = NOPASSWD: !/usr/bin/passwd, /usr/bin/passwd [A-Za-z]*, \
!/usr/bin/passwd root 可以更改使用者密码,但不能更改root密码 (在指令前面加入 ! 代表不可)
PAM (Pluggable Authentication Modules, 嵌入式模組)
who & w 看谁在线
last 最近登陆主机的信息
lastlog 最近登入的時間 读取 /var/log/lastlog
talk 与其他用户交谈
write 发送信息 write test [ctrl]+d 发送
mesg 设置终端机的写入权限 mesg n 禁止接收 mesg y
wall 向所有用户发送信息 wall this is q test
mail 写mail
/etc/default/useradd 家目录默认设置
quota 显示磁盘已使用的空间与限制 quota -guvs ----->秀出目前 root 自己的 quota 限制值
quota -vu 查询
quotacheck 检查磁盘的使用空间与限制 quotacheck -avug ----->將所有的在 /etc/mtab 內,含有 quota 支援的 partition 進行掃瞄
[-m] 强制扫描
quota一定要是独立的分区,要有quota.user和quota.group两件文件,在/etc/fstab添加一句:
/dev/hda3 /home ext3 defaults,usrquota,grpquota 1 2
chmod 600 quota* 设置完成,重启生效
edquota 编辑用户或群组的quota [u]用户,[g]群组,[p]复制,[t]设置宽限期限
edquota -a yang edquota -p yang -u young ----->复制
quotaon 开启磁盘空间限制 quotaon -auvg -------->啟動所有的具有 quota 的 filesystem
quotaoff 关闭磁盘空间限制 quotaoff -a -------->關閉了 quota 的限制
repquota -av 查閱系統內所有的具有 quota 的 filesystem 的限值狀態
Quota 從開始準備 filesystem 的支援到整個設定結束的主要的步驟大概是:
1、設定 partition 的 filesystem 支援 quota 參數:
由於 quota 必須要讓 partition 上面的 filesystem 支援才行,一般來說, 支援度最好的是 ext2/ext3 ,
其他的 filesystem 類型鳥哥我是沒有試過啦! 啟動 filesystem 支援 quota 最簡單就是編輯 /etc/fstab ,
使得準備要開放的 quota 磁碟可以支援 quota 囉;
2、建立 quota 記錄檔:
剛剛前面講過,整個 quota 進行磁碟限制值記錄的檔案是 aquota.user/aquota.group,
要建立這兩個檔案就必須要先利用 quotacheck 掃瞄才行喔!
3、編輯 quota 限制值資料:
再來就是使用 edquota 來編輯每個使用者或群組的可使用空間囉;
4、重新掃瞄與啟動 quota :
設定好 quota 之後,建議可以再進行一次 quotacheck ,然後再以 quotaon 來啟動吧!