Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

2009-02-07

网易的源

想不到163上也出现了一个源镜像,据说就是以前cn99的那个。
http://mirrors.163.com/

用了一下,速度很快,但不是最新的。

//EOF Read More...

2008-11-30

Linux 中使用NetBeans部署、运行Web应用要注意目录权限设置

使用的是 tomcat
要注意以下几个目录的权限要当前用户可写

$CATALINA_HOME/conf/Catalina/localhost/
$CATALINA_HOME/webapps/
$CATALINA_HOME/work/Catalina/localhost/
$CATALINA_HOME/temp/

否则,有可能会出现无法写入部署目录而部署失败:

Failed to deploy application at context path /xxx

另外,还要注意
$CATALINA_HOME/bin/
下几个.sh文件的当前用户执行权限,不然tomcat都无法运行。

//EOF Read More...

2008-11-18

Linux Admin IQ Test

問題見:
http://www.infoworld.com/tools/quiz/news/IQ2008linux-news-quiz.php

只的了 65 分啊~~

Question 1: Which vendor has never branded its own Linux?

5 points
c. IBM

Even SCO briefly offered its own Linux product. Big Blue, despite being an enthusiastic Linux backer, has always partnered with other distributors instead of packaging its own version of the OS.

Question 2: Why GRUB over LILO?

5 points
d. You want to boot from a network

LILO supports a wide variety of boot configurations, but you'll need the more modern GRUB if you want to boot from a network.

Question 4: What's a "shebang"?

5 points
a. A unique sequence of characters that indicates the start of a shell script

Short for "shell bang," shebang is a hash or pound sign (#) followed by an exclamation mark (!), known in Unix parlance as a "bang."

Question 8: Which graphics chip vendor hasn't released a Linux driver?

5 points
c. Nvidia

Although most of the competition has released open source drivers for at least some of their graphics chips, Nvidia has remained a staunch holdout.

Question 15: What's the benefit of noatime?

5 points
a. It improves performance by reducing the frequency of disk writes

Normally, Linux will update the time stamp on a file every time it is accessed. With the noatime option, the kernel will update files only when their contents are changed.

Question 16: Which virt tech allows Windows VMs to run on Linux?

5 points
c. Xen

Most of the virtualization software listed can only launch other instances of Linux. Xen can support Windows virtual machines also, provided your processor supports Intel VT or AMD-V technology.

Question 17: What's a "binary blob"?

5 points
a. A driver that is loaded into the kernel as a binary object, for which no source code is available

The Linux community is divided over the practice of running closed source code as part of the Linux kernel, but when hardware vendors refuse to release their specifications, it's often the only option.

//EOF Read More...

2008-10-14

OpenOffice 3.0 在 KDE 下的一点小问题

3.0速度快了很多,感觉很爽!
但是有个小问题,就是:
“Tools”等几个菜单项选中的时候会挂掉(Arch 的 KDE4桌面环境)
解决方法:
export OOO_FORCE_DESKTOP=gnome
就好了,据说是因为3.0里面没有支持KDE的主题所致。
//EOF Read More...

2008-09-28

用kexec快速切换内核

详见:http://www.linuxsir.org/main/node/296

总的来说:



  1. 内核版本必需为 2.6.13 或以上,因为自该版本起内置了 kexec 系统调用的程序。

  2. 内核编译需加入 kexec 支援
    Processor type and features --->

    [*] kexec system call (EXPERIMENTAL)


  3. 系统需要安装 kexec-tools

  4. 用 /sbin/kexec 加载另一内核,语法是:
    kexec -l <kernel-image> --append="<command-line-options>" 
    如:
    kexec -l /boot/lfskernel-2.6.25.4 --append="root=/dev/sda6 ro nomce vga=0x317"

  5. 想重启内核,就以 kexec -e 来切换。




//EOF Read More...

2008-08-05

proftpd 限制用户目录

proftpd 是个不错的FTP服务端。

在 /etc/proftpd.conf 中配置


DefaultRoot ~

即可将登录的用户限制在其$HOME中(要不然用户登录后连"/"都能访问)。

另外加入

<Limit LOGIN>
DenyUser username
</Limit>

可限制登录用户。

//EOF Read More...

2008-08-01

Linux 版 QQ ?

听说 TX 出了 Linux 版的QQ,我下载了 tar 版的。
但是,这个可怜的QQ,在我的硬盘上仅存在了 10秒不到~~
马上就被我删掉了,太恶心了~~
花哨的界面和简陋的功能严重不匹配~ 有心思做花哨的界面还不如多花点心思来完善功能。
//EOF Read More...

2008-07-29

用上KDE4.1了

昨天 Arch 官方升级了KDE到4.1,昨天没注意,今天早上开始时吓了一跳~~

不过也好,迟早是要升级的。就是刚开始从3.5到4.1还有些不太适应。

//EOF Read More...

2007-09-12

sys_calls

/usr/include/asm/unistd.h (sys/syscall.h)
the system call numbers:

sys_call namesys_call num.(hex)
restart_syscall0
_exit1
fork2
read3
write4
open5
close6
waitpid7
create8
link9
unlinka
execveb
chdirc
timed
mknode
chmodf
lchown10
break11
oldstat12
lseek13
getpid14
mount15
oldumount16
setuid17
getuid18
stime19
ptrace1a
alarm1b
oldfstat1c
pause1d
utime1e
stty1f
gtty20
access21
nice22
ftime23
sync24
kill25
rename26
mkdir27
rmdir28
dup29
pipe2a
times2b
prof2c
brk2d
setgid2e
getgid2f
signal30
geteuid31
getegid32
acct33
umount234
lock35
ioctl36
fcntl37
mpx38
setpgid39
ulimit3a
oldolduname3b
umask3c
chroot3d
ustat3e
dup23f
getppid40
getpgrp41
setsid42
sigaction43
sgetmask44
ssetmask45
setreuid46
setregid47
sigsuspend48
sigpending49
sethostname4a
setrlimit4b
getrlimit4c /* Back compatible 2Gig limited rlimit */
getrusage4d
gettimeofday4e
settimeofday4f
getgroups50
setgroups51
select52
symlink53
oldlstat54
readlink55
uselib56
swapon57
reboot58
readdir59
mmap5a
munmap5b
truncate5c
ftruncate5d
fchmod5e
fchown5f
getpriority60
setpriority61
profil62
statfs63
fstatfs64
ioperm65
socketcall66
syslog67
settimer68
gettimer69
stat6a
lstat6b
fstat6c
olduname6d
iopl6e
vhangup6f
idle70
vm86old71
wait472
swapoff73
sysinfo74
ipc75
fsync76
sigreturn77
clone78
setdomainname79
uname7a
modify_ldt7b
adjtimex7c
mprotect7d
sigprocmask7e
create_module7f
init_module80
delete_module81
get_kernel_syms82
quotactl83
getpgid84
fchdir85
dbflush86
sysfs87
personality88
afs_syscall89 /* Syscall for Andrew File System */
setfsuid8a
setfsgid8b
_llseek8c
getdents8d
_newselect8e
flock8f
msync90
readv91
writev92
getsid93
fdatasync94
_sysctl95
mlock96
munlock97
mlockall98
munlockall99
sched_setparam9a
sched_getparam9b
sched_setscheduler9c
sched_getscheduler9d
sched_yield9e
sched_get_priority_max9f
sched_set_priority_mina0
sched_rr_get_intervala1
nanosleepa2
mremapa3
setresuida4
getresuida5
vm86a6
query_modulea7
polla8
nfsservctla9
setresgidaa
getresgidab
prctlac
rt_sigreturnad
rt_sigactionae
rt_sigprocmaskaf
rt_sigpendingb0
rt_sigtimedwaitb1
rt_sigqueueinfob2
rt_sigsuspendb3
pread64b4
pwrite64b5
chownb6
getcwdb7
capgetb8
capsetb9
sigaltstackba
sendfilebb
getpmsgbc /* some people actually want streams */
putpmsgbd /* some people actually want streams */
vforkbe
ugetrlimitbf /* SuS compliant getrlimit */
mmap2c0
truncate64c1
ftruncate64c3
tkillee
io_setupf5
io_destoryf6
io_geteventsf7
io_submitf8
io_cancelf9
exit_groupfc
timer_create103
timer_settime104
timer_gettime105
timer_getoverrun106
timer_delete107
clock_settime108
clock_gettime109
clock_getres10a
clock_nanosleep10b
tgkill10e
utimes10f
kexec_load11b
waitid11c
/* sys_setaltroot11d */
add_key11e
request_key11f
keyctl120
ioprio_set121
ioprio_get122
inotify_init123
inotify_add_watch124
inotify_rm_watch125
migrate_pages126
openat127
mkdirat128
mknodat129
fchownat12a
futimesat12b
fstatat6412c
unlinkat12d
renameat12e
linkat12f
symlinkat130
readlinkat131
fchmodat132
faccessat133
getcpu13e


//EOF Read More...

2007-08-14

ALD

ALD(Assembly Language Debugger)

is a simple beautiful baseline POSIX debugger.
if you wanna debug a asm program this will be a better choice

http://ald.sourceforge.net

//EOF Read More...

2007-07-07

Linux下实现getch()

Linux下的int getchar(void)在默认情况下需要Enter后才能继续。那么可否像DOS下那样即时返回的呢?
回答是肯定的:

  1. 使用curses库的getch()。
  2. read /dev/input/event0 (kernel >= 2.6)
  3. 将stdin改成unbuffered:
    #include <stdio.h>
    #include <unistd.h>
    #include <termios.h>
    int getch (void)
    {
        int    c = 0;
        struct termios    tm_old, tm;
        int    ret = 0;

        ret = tcgetattr (STDIN_FILENO, &tm_old);
        assert (ret==0);
        memcpy (&tm, &tm_old, sizeof(tm));
        tm.c_lflag &= ~(ICANON | ECHO | ECHOE | ECHOK | ECHONL | ECHOPRT | ECHOKE | ICRNL);
        tcsetattr (STDIN_FILENO, TCSANOW, &tm);
        c = fgetc(stdin);//getchar();
        ret = tcsetattr (STDIN_FILENO, TCSANOW, &tm_old);
        assert (ret==0);

        return c;
    }


//EOF Read More...

2007-07-04

amulecmd

~/.aMule/amule.conf

AcceptExternalConnections=1
ECPassword=<md5 string> # get this string with this:
$ echo "your passwd" | md5sum | cut -d ' ' -f 1

then:
$ amuled &

you can using amulecmd do a simply control.
$ amulecmd -P "your passwd" [-c "control cmd"]

//EOF Read More...

2007-06-14

GNU Go

GNU Go is a free program that plays the game of Go.
you can using this to play Go with your PC.
but, GNU Go need a GUI.
then, qGo(QT 3) or Quarry(GTK+ 2) will be needed.

GNU Go : http://www.gnu.org/software/gnugo/
qGo : http://sourceforge.net/projects/qgo/
Quarry : http://home.gna.org/quarry/

//EOF Read More...

2007-05-13

终于决定用Tor了

托我们伟大的国网(GFW)的福,这两天blogspot又不能访问了。。。
而以前的两个代理inblogs和pkblogs又都下线了,不想找别的代理,终于描上了以前听说过的Tor。
其实,原来别人也推荐过我用Tor,主要是保密方面的因素,而我平常也没什么好保密的,也就没有方在心上。
实际上Tor的特性决定了它在除通信保密之外很强的一个用途——可以当作灵活的代理来用——当然为了不要占用大家的资源只能用来作些通信量较小的工作,下载大文件那是最好不要做的。

安装配置方式,使用方法,Tor的主页上都说的很清楚了:
http://tor.eff.org/index.html.zh-cn

//EOF Read More...

2007-04-29

随便说两句

最近从Windows转向Linux的桌面用户很多,其中有一部分是被最近Linux上兴起的3D桌面吸引,但很大一部分是不能忍受Windows下多如牛毛的病毒之害的。

唉~怎么说呢?
如果说Windows是个人人得以上之的妓女的话。那么Linux无疑是一个气质高雅的优美女孩,这种高雅的气质是由内而外的,这种高雅的气质不可否认的是来自于Unix。
(注意:是优美而不是完美,优美总是那么的可爱,但完美偶尔是会让人觉得反感的)

嗯。。。
并不是说Linux下就没有病毒了,Linux下生产病毒的可能性是很大的,只不过长久以来Linux的使用者都是一些技术群体,对于这些大家都心照不宣(病毒创造出来后最终受害者是谁?何必更自己过不去呢?)。
而且,由于Linux的这种由内而外的高雅气质,即使有病毒但能够危害到系统基础构架的却基本没有。相当于是穿着一件性感漂亮的内衣,不小心弄脏了,洗一洗,或者大不了丢掉再去换一件新的。并不用花费太多的代价,不用吃药,不用动手术,更加不用“重生”、换人。
当然,不能排除某些牛人狠狠钻研内核后找出某些危险的漏洞,而加以利用的可能性。但这样的牛人有几个?他们会这样不负责任么?即使造出来也不会像现在Windows下的那么泛滥吧。

以上说这么多,其实我并没有诽谤Windows的意思。
只不过,想让新用Linux的那批人正确的看待这件事(病毒)。
其实,Windows刚开始流行之初也是没有这么泛滥的病毒之灾的,当时Windows的大多数使用者也只是一些技术人员,当PC迅速普及之后才有这么泛滥的病毒之灾。难道是之前的那些资格深厚的技术人员还不如当今的那些技术小混混么?很明显不是的,技术的积累不是一朝一夕的事情,看看当今Windows下的那些病毒真正有技术含量的有几个?绝大多数都是小混混的流氓作品罢了。


其实我真的很担心,让太多的人染指Linux 会玷污她那高雅的气质,毕竟人多了就杂 难免会掺杂那么几个混混流氓在里面。
//EOF Read More...

2007-04-20

console下特殊文件名的操作

有时候会碰到一些特殊的文件名如:"-aaa"
因为文件操作命令会自动把"-"后面跟的东西解析成option,所以一般来说都不能成功。
可以在文件名前面用参数“--”(两个减号),来达到操作这种文件的目的。如:
$ ls -l -- -aaa
(对于其他特殊字符可以用""把文件名括起来,或在特殊字符前加"\"解析符号)

另外,对于非ASCII字符命名的文件操作。(当前系统还未安装该语言支持时)
例:当前目录下有名为“abc你好”的目录
1.利用自动补全功能
$ cd abc<这里按Tab键> 自动补完后回车就可进入(前提是当前目录下无其他以"abc"开头的文件名)

2.需要工具 hexdump(util-linux包中)。
$ ls -ad abc* |hexdump -c
0000000 a b c 304 343 272 303 \n
$ cd `printf "abc\304\343\272\303"`
当然,如果当前目录存在多个以abc开头的文件就会麻烦很多,只有你自己通过后面的编码值来确定那个才是你真正需要的了。

//EOF Read More...

2007-04-19

mount nfs: "can't read superblock"

# showmount -e 192.168.1.21
Export list for 192.168.1.21:
/home/share (everyone)
# mount -t nfs 192.168.1.21:/home/share /mnt/tmp
mount: 192.168.1.21:/home/share: can't read superblock



Solution: try using the -o nolock option from the nfs mount command
# mount -t nfs 192.168.1.21:/home/share /mnt/tmp -o nolock

//EOF Read More...

2007-04-03

用Arch了!

其实老早就听说过Arch的大名,但是由于之前一直使用的是RedHat系的,所以之前不想、也不敢放弃RedHat。
01年接触Unix/Linux,02年开始用的RedHat9,之后出FC后用了FC4/FC5/FC6。
中间用过一次Debian、试过一次Ubuntu都不习惯
去年11月开始又开始了近乎自虐的LFS,由于都是是自己编译的运行的那个速度不是盖的啊!
但编译的过程是异常痛苦的,有了LFS的经历也不敢Gentoo了。
Suse去年11月之后就不在我的考虑之列了。
对Mandriva和Slackware还是感兴趣的,尤其是Mandriva。但也不想浪费太多精力
苦苦守候4月1日Arch0.8的发行,终于选定了自己最终的归宿——Arch!!
当然正式使用前当然少不了虚拟机上的试运行
一个current的CD也就500来MB,base安装(带gcc的)后也就400MB多点。
当然,运行速度也是相当快的,虽然和自己优化编译的LFS没得比,但比FC6还是快多了。
配置也很简单(不是指图形界面哦)——配置文件都放在理所当然的地方、配置的方法也是理所当然的。
pacman, ABS 都很容易操作。
上手还是相当容易的,当然前提是你有使用Linux的基础了 :)
决定了,明天就正式安装。
(当然,我短期内还是不会放弃RedHat的)
//EOF Read More...

2007-03-11

NOSIGPIPE

在Unix系统下,如果send/recv在等待协议传送数据时网络断开的话,调用send/recv的进程会接收到一个SIGPIPE信号,进程对该信号的默认处理是进程终止。
处理方法:
在初始化时调用signal(SIGPIPE,SIG_IGN)忽略该信号(只需一次)
其时send或recv函数将返回-1,errno为EPIPE,可视情况关闭socket或其他处理
gdb:
gdb默认收到sigpipe时中断程序,可调用handle SIGPIPE nostop print

另外,FreeBSD/MacOSX中有个 SO_NOSIGPIPE 可通过setsockopt设置

SO_NOSIGPIPE    do not generate SIGPIPE, instead return EPIPE
(见FreeBSD的setsockopt(2))


但找了半天我的FC6 Linux中却没得 SO_NOSIGPIPE。。。
只好用signal(SIGPIPE,SIG_IGN)吧。
//EOF Read More...