把 ubuntu 相关的东西转到这里

Posted 11 months, 1 week ago at 5:26 pm. 1 comment

blog.guoshuang.com 正式剥离,截至今天的日志为止,日期都是同一天,前后顺序也不对。请自行站内搜索。

需要解决的bug如下:

  1. 运行和查看代码的按钮有问题,要么库里换掉 img 要么 jquery;wordpress 的编辑也不支持 textarea;

more

Popularity: 24% [?]

Tags:

关于我和这个Blog

Posted 11 months, 1 week ago at 1:39 pm. 0 comments

guoshuang我是郭爽,这里的内容最初来源于我的blog,最终决定把 ubuntu 的内容单独分离出去…

记录关于ubuntu 的一切,欢迎交流,谢谢。

Popularity: 9% [?]

Tags: ,

ssh,vnc 反向连接

Posted 11 months, 1 week ago at 11:32 am. 0 comments

反向连接不需要网关映射,因此不需要惊动网管大人,这样我就可以从家里(ADSL)连接控制单位局域网中的我的机器…
嘿嘿…坏处就是,两头都要有人…
感谢 pal(小时)蹲在我家里帮忙测试。

ssh 反向连接

如果没有安装 ssh的话,安装之

sudo apt-get install ssh

被控端,执行

ssh -f -N -R 10000:localhost:22 guoshuang@xxx.xxx.xxx.xxx

控制端执行
ssh guoshuang@localhost -p 10000

参考此文

vnc 反向连接

其实只要网关(防火墙)没有关掉 5500 就可以。注意:是5500能出去即可,不是进来,所以一般都是开放的。

sudo apt-get install x11vnc

控制端执行下面命令,等待邀请

vncviewer -listen

被控端,主动发起邀请

x11vnc -connect xxx.xxx.xxx.xxx:5500

参考此文

windows 和 mac 下的软件可参考下文

Free and easy remote access (through firewalls and NAT routers) with VNC reverse connections
内网远程控制全攻略

注意:vncviewer -fullscreen 模式全屏连接 vnc,用 f8 或者 ctrl+esc esc 退出。即便如此,也会经常出现不能退出或者控制失灵的情况,这篇 patch: fix WM bindings for vncviewer -fullscreen 应该有些帮助

或者使用 xvnc4viewer(sudo apt-get install xvnc4viewer)而不是tightvnc viewer。

f8 和窗口控制都没问题。

Popularity: 41% [?]

Tags: , , , , , , , ,

linux shell 快捷方式

Posted 11 months, 1 week ago at 11:32 am. 0 comments

原文来自 Bash Shell Keyboard Shortcuts For Linux Users,大部分快捷方式我以前一无所知…

# Ctrl + A - Go to the beginning of the line you are currently typing on
# Ctrl + E - Go to the end of the line you are currently typing on
切到命令行开始|结尾

# Ctrl + L - Clears the Screen, similar to the clear command
清屏,类似于 clear 命令

# Ctrl + U - Clears the line before the cursor position. If you are at the end of the line, clears the entire line.
清除光标以前

# Ctrl + H - Same as backspace
退格键 backspace

# Ctrl + R - Let’s you search through previously used commands
从命令历史中找

# Ctrl + C - Kill whatever you are running
终止命令

# Ctrl + D - Exit the current shell
退出 shell

# Ctrl + Z - Puts whatever you are running into a suspended background process. fg restores it.
??

# Ctrl + W - Delete the word before the cursor
清除光标之前

# Ctrl + K - Clear the line after the cursor
清除光标之后

# Ctrl + T - Swap the last two characters before the cursor
# Esc + T - Swap the last two words before the cursor
切换光标前最后两个字母(单词)

# Alt + F - Move cursor forward one word on the current line
# Alt + B - Move cursor backward one word on the current line
??在 ubuntu x windows终端中会切换到菜单!tty 可能可以

# Tab - Auto-complete files and folder names
自动补全

# Ctrl + Y - to paste it (as in delete and copy) all text in front of the cursor
粘贴(刚才 ctrl+w 或者 ctrl+k 的内容)

# Esc + . (or Esc + Underscore) - Insert Last Argument
??

# Ctrl + b - Move back a character
# Ctrl + f - Move forward a character
向前|后移动一个字母

# Ctrl + r - Search the history backwards
??
# Ctrl + xx - Move between EOL and current cursor position
光标在当前位置和 EOL 之间切换(EOL end of line?但我实验,是在开头和当前位置之间切换,怎么理解?谁知道?)

# Ctrl + x @ - Show possible hostname completions

# Alt +
# Alt + > - Move to the last line in the history

# Alt + ? - Show current completion list

# Alt + * - Insert all possible completions

# Alt + / - Attempt to complete filename

# Alt + . - Yank last argument to previous command

# Alt + c - Capitalize the word

# Alt + d - Delete word

# Alt + l - Make word lowercase

# Alt + n - Search the history forwards non-incremental

# Alt + p - Search the history backwards non-incremental

# Alt + r - Recall command

# Alt + t - Move words around

# Alt + u - Make word uppercase

# Alt + back-space - Delete backward from cursor

# Here “2T” means Press TAB twice

# $ 2T - All available commands(common)

# $ (string) 2T - All available commands starting with (string)

# $ /2T - Entire directory structure including Hidden one

# $ 2T - Only Sub Dirs inside including Hidden one

# $ *2T - Only Sub Dirs inside without Hidden one

# $ ~2T - All Present Users on system from “/etc/passwd”

# $ $2T - All Sys variables

# $ @2T - Entries from “/etc/hosts”

# $ =2T - Output like ls or dir

Popularity: 31% [?]

Tags: , , , , , , ,

提高 feisty 性能

Posted 11 months, 1 week ago at 11:32 am. 0 comments

原文来自 http://xlntsolution.blogspot.com/2007/03/feisty-performance-fly-like-butterfly.html

blogspt 似乎再次封掉了,:( 我是通过这个代理看到的

部分内容如下:

sudo gedit /etc/hosts

你会看到类似

127.0.0.1 localhost
127.0.1.1 guoshuang-laptop

这样的内容,在 localost 后面加上你的主机名,如guoshuang-laptop

127.0.0.1 localhost guoshuang-laptop
127.0.1.1 guoshuang-laptop

1. Disable IPv6
At least I dont need IPv6 yet so this is what I do to disable it.
sudo kate /etc/modprobe.d/aliases
And change the line:
alias net-pf-10 ipv6
to:
alias net-pf-10 off #ipv6
This will disable IPv6 on all network interfaces. You need to reboot.

2. Run boot processes in parallel
This will make upstart to run the boot processes in parallel and speed up the boot process.
sudo kate /etc/init.d/rc
Find and change the line:
CONCURRENCY=none
to:
CONCURRENCY=shell

3. Aliasing hostname to localhost
Right or wrong, you decide. But I picked this up in the Ubuntu forums the other day and it does improve the startup of some apps.
sudo kate /etc/hosts
and add you hostname to the first line after localhost like this:
127.0.0.1 localhost yourhost
127.0.1.1 yourhost

4. Disable pango
I know that this is already taken care of in firefox but it still makes a good performance boost to thunderbird and some other apps.
sudo kate /etc/environment
and add:
MOZ_DISABLE_PANGO=”1″

5. Preload
It does what you think. It preloads most common used libs and files = faster startup times on your applications.
sudo apt-get install preload

What about prelink?
Prelink is no longer necessary in feisty. Feisty uses a new linking mechanism called DT_GNU_HASH which speeds up the linking process without the need for continuously running prelink.

6. Swappiness
The default value for vm.swappiness is 60 in Ubuntu Feisty whic is a good default value but if you want to tweak the performance a little bit more you can change this value to a lower value to reduce the load of the swap. If you run the follwing command:
sysctl -q vm.swappiness
You will se that the value is set to 60. And by running:
sudo sysctl vm.swappiness=10
You will change the value from 60 to 10 which will make your system write to swap a lot less and I would recommend this to everyone that has 512 mb of memory or more. If you find that you have very little use of swap set the value to 0. This will not disable the swap but it will make your system write to the swap as little as possible and keep as much as possible in memory. This makes a huge improvment when switching between applications since they are now likley to be in physical ram instead of on the swap partition.

To set your value permanent you need to change the sysctl.conf file:
sudo kate /etc/sysctl.conf
Add the line
vm.swappiness=10
To the end of the file. This way it will be set upon boot.

I’ve found that the value of 5 works very good for my use and I have 1 GB of memory.

7. Profile grub
There is a option to grub called profile which will profile your startup. What it does is that it kind of indexing all the files read during boot/startup and later on it will find and read those files quicker.

Hit the escape button when booting to get to the grub menu.
Select your default boot kernel and hit the e button.
Go down to the second line and hit the e button again.
Add profile to the end of the line and press enter.
Hit the b button to boot with your new option.

The first time it will take a little bit longer to boot because it has to build the index (or whatever they want to call it) but every boot after this will be a lot smoother.
You need to do this every time you update your kernel or have made other huge changes to your system that might affect the files needed during boot.

The following could cause your system to be unstable or even unable to boot so please use them care…

8. sysv-rc-conf
Install sysv-rc-conf and disable the services you don’t need at startup.
As an example. On my computer I don’t have bluetooth so I don’t need to start it at boot time.
So simply disable what ever you don’t have or use.

sudo apt-get install sysv-rc-conf
and then run:
sudo sysv-rc-conf

9. Kernel hacking
Even thought the new kernel in feisty is very good and already tuned a bit there still are some things you can do to the kernel the will make your system snappier and boot up even faster.

Use this thread from the ubuntu forums as a guide on how to compile your own kernel.
master kernel thread

What I do is that I make sure to add my file systems I use to the kernel instead of loading them as modules. Take out whatever I don’t have or use and then compile my new and hopefully improved kernel ;)
10. Filesystem setup
The choice and use of the file system is a big issue when dealing with performance. Depending on your usage of your system you might need to configure your filesystem different.

For my usage I like to use the following setup (which I think is a good desktop setup)

Mountpoint

filesystem

Size

/boot

ext2

100 MB

/root

LVM, VG=system, xfs

6 GB

/swap

LVM, VG=system, swap

The size of RAM in your computer. Making it smaller and you will not be able to hibernate.

/home

LVM, VG=system, xfs

1 GB, or the rest of the space in that VG

/data

LVM, VG=data, xfs

The rest of the free space

Using the following options in fstab for all my xfs partitions:
noatime,nodiratime,logbufs=8

Using LVM can really speed up the disk performance. And you get a lot of other good stuff with it as well. Read more about LVM here.
I choose to have /root and /home on one VolumeGroup and /data on another simply because I can then split them up on diffrent physical disks and have them spanning over multiple physical disks witch really speeds up the reads and writes.

At the moment this is pretty much it but I will update this as soon as I discover more performance tunings…

Tuning applications

Not so much to add here but this what I like to do.

1. Firefox
Use swiftfox instead. It’s optimized for your CPU.
Install the fasterfox add-on
If it’s not already set, disable IPv6. In the url enter about:config and find the ipv6 entry and disable it.
Install adblock plus add-on
to disable ad’s it helps a lot :)
2. openoffice
If you don’t need that extras that java JRE provides then simply disable it openoffice. That’s what I do.

Once Feisty is released I will have a script done that all you brave people can run that will do most of this in one go :)
I will also write down the kernel options that I use to compile my kernel for those who are interested.

But until then, use this and enjoy a much faster and smoother running Feisty.

Popularity: 44% [?]

Tags: , , , , , , , , , , ,

bloglines notifier for gnome

Posted 11 months, 1 week ago at 11:32 am. 0 comments

新立得搜索并安装 libgtk2-gladexml-perl 和 libgladexml-perl。直接运行解压包里的 bloglines-notifier 即可。

http://jodrell.net/projects/bloglines-notifier

Installation is very simple - just make the bloglines-notifier script executable and put it somewhere in your $PATH.

All the other files are for development use - they are included inline in the program and do not need to be installed.

You will need the following Perl scripts to use this program:

Gtk2 (compiled with support for GTK+ >+ 2.10)
Gtk2::GladeXML
LWP

all platform notifiers
http://www.bloglines.com/about/notifie

Popularity: 16% [?]

Tags: , ,

ubuntu 下的 gmail notifier

Posted 11 months, 1 week ago at 11:32 am. 0 comments

sudo apt-get install checkgmail

即可。这个比下面的 gmail-notify 功能更多一些,可以直接查看最近的一些邮件,发信等等。

二、gmail-notify

sudo apt-get install gmail-notify

更适合等信。

三、直接用 livebookmark 订阅自己的邮箱,只要有firefox就可以了,win 下也可如此。我以前主要用这种方式。

https://mail.google.com/mail/feed/atom

BTW:建立 checkmail 菜单操作如下

sudo gedit /usr/share/applications/checkgmail.desktop

内容如下:

[Desktop Entry]
Encoding=UTF-8
Name=CheckGmail
Exec=checkgmail
Terminal=false
Type=Application
StartupNotify=true
Icon=
Categories=Application;Network;

然后刷新 gnome 菜单

sudo killall gnome-panel

checkgmail 的图标图片在 gmail 图标 可以找到。

相关日志:

gmail IMAP 协议设置

checkgmail 资料

How do I play a sound when new mail arrives?

Enter a command in the “Command to execute on new mail” section in the preferences. For example, to play a WAV sound, you could use

aplay /path/to/mysound.wav
What else can the “Command to execute on new mail” do?

Well, it can do whatever you want. I use it to turn on my laptop’s dedicated mail LED light:

echo 1 > /proc/acpi/asus/mled

but anyone with the Blinkd software package installed could get their numlock or scroll-lock lights to blink with

blink –numlock –rate %m

What’s that ‘%m’ thing doing there? Well, that’s a new feature of version 1.10.1, and represents the number of new messages. Which means that in the example above your numlock LED will blink with the number of new messages. It’s gimmicky, I know (and there’s no way I could live with it personally) … but you’ve gotta admit, it’s kinda cool! :)

If you’re going to turn an LED on, though, you’ll also want to turn it off - and that’s why there’s also a “Command to execute for no mail” option. In the example above, you’ll want something like

blink –numlock –rate 0

And of course, you can combine options together by using semicolons, for example:

aplay /path/to/mysound.wav; blink –numlock –rate %m

The whole idea is to be as extensible here as possible, and recognise that not everyone wants a sound to play when new mail arrives, but they might want something else to happen instead …

Popularity: 36% [?]

Tags: , , , , , , , ,

ubuntu 直接用 nautilus 做ftp工具

Posted 11 months, 1 week ago at 11:32 am. 0 comments

filezilla linux 版本总是有这样那样的问题,所以以前总是用 ftp 命令行,但那样慢啊。今天想当然地在 nautilus 中直接 ftp://blog.guoshuang.com,原来 nautilus 就可以ftp。只是修改后只能另存,然后再拖回去覆盖原文件。


Popularity: 14% [?]

Tags: , ,

wget 获取站点镜像

Posted 11 months, 1 week ago at 11:32 am. 0 comments

wget -c -m -p -q -b http://www.sina.com

-c 是继续传送, -m 是镜像, -p 是下载媒体文件,比如图片, -q 是安静模式, -b 是后台运行

绕开 robots.txt 办法:

在 $HOME/.wgetrc 中加入

robots = off

原文来自 让 wget 忽略 robot.txt

Popularity: 10% [?]

Tags:

feisty 安装 NTFS 分区写入支持

Posted 11 months, 1 week ago at 11:32 am. 0 comments

读 ntfs 分区本来就没问题。要加入NTFS分区写入支持,在 feisty 中很容易。直接安装 ntfs-config 即可

sudo apt-get install ntfs-config

打开 系统工具 - NTFS 写入支持配置程序,勾选 启用内(外)部设备写支持即可。以后就可以写 NTFS 分区了。

Widows NTFS Partitions Read/write support made easy in Ubuntu Feisty

相关日志:

windows 查看 linux 分区工具
windows 访问ubuntu 目录 SMB

Popularity: 37% [?]

Tags: , , , , , , , ,

ad 468x60