文章列表
 
您正在查看 "linux学习" 分类下的文章

2007年07月30日 星期一 11:34
1,说明:
ulimit用于shell启动进程所占用的资源.
2,类别:
shell内建命令
3,语法格式:
ulimit [-acdfHlmnpsStvw] [size]
4,参数介绍:
-H 设置硬件资源限制.
-S 设置软件资源限制.
-a 显示当前所有的资源限制.
-c size:设置core文件的最大值.单位:blocks
-d size:设置数据段的最大值.单位:kbytes
-f size:设置创建文件的最大值.单位:blocks
-l size:设置在内存中锁定进程的最大值.单位:kbytes
-m size:设置可以使用的常驻内存的最大值.单位:kbytes
-n size:设置内核可以同时打开的文件描述符的最大值.单位:n
-p size:设置管道缓冲区的最大值.单位:kbytes
-s size:设置堆栈的最大值.单位:kbytes
-t size:设置CPU使用时间的最大上限.单位:seconds
-v size:设置虚拟内存的最大值.单位:kbytes
5.举例
在Linux下写程序的时候,如果程序比较大,经常会遇到“段错误”(segmentation fault)这样的问题,这主要就是由于Linux系统初始的堆栈大小(stack size)太小的缘故,一般为10M。我一般把stack size设置成256M,这样就没有段错误了!命令为:
ulimit   -s 262140
如果要系统自动记住这个配置,就编辑/etc/profile文件,在 “ulimit -S -c 0 > /dev/null 2>&1”行下,添加“ulimit   -s 262140”,保存重启系统就可以了!
 
2007年07月24日 星期二 12:34
采用VMware,在Windows XP下虚拟出一个Linux操作系统,这个想法很不错。一方面可以节省硬盘空间,另一方面可以在Windows运行的情况下,同时运行Linux系统,实现多系统的同时运行,切换起来也方便很多,这的确不错,想玩Linux的朋友可以试一下。
安装教程如下:
http://www.linuxeden.com/doc/21344.html
 
2007年06月28日 星期四 12:15
(1) 进入vi的命令
vi filename :打开或新建文件,并将光标置于第一行首
vi +n filename :打开文件,并将光标置于第n行首
vi + filename :打开文件,并将光标置于最后一行首
vi +/pattern filename:打开文件,并将光标置于第一个与pattern匹配的串处
vi -r filename :在上次正用vi编辑时发生系统崩溃,恢复filename
vi filename....filename :打开多个文件,依次编辑

(2) 移动光标
vi可以直接用键盘上的光标键来上下左右移动,但正规的vi是用小写英文字母
h、j、k、l,分别控制光标左、下、上、右移一格。
按Ctrl+B:屏幕往后移动一页。[常用]
按Ctrl+F:屏幕往前移动一页。[常用]
按Ctrl+U:屏幕往后移动半页。
按Ctrl+D:屏幕往前移动半页。
按 0 (数字零):移动文章的开头。[常用]
按 G:移动到文章的最后。[常用]
按 w:光标跳到下个word的开头。[常用]
按 e:光标跳到下个word的字尾。
按 b:光标回到上个word的开头。按 $:移到光标所在行的行尾。[常用]
按 ^:移到该行第一个非空白的字符。按 0:移到该行的开头位置。[常用]
按 #:移到该行的第#个位置,例:51、121。[常用]

(3) 删除文字
x:每按一次删除光标所在位置的后面一个字符。[超常用]
#x:例如,6x 表删除光标所在位置的后面6个字符。[常用]
X:大字的X,每按一次删除光标所在位置的前面一个字符。
#X:例如,20X 表删除光标所在位置的前面20个字符。
dd:删除光标所在行。[超常用]
#dd:例如,6dd表删除从光标所在的该行往下数6行之文字。[常用]

(4) 复制
yw:将光标所在处到字尾的字符复制到缓冲区中。(想在和#x、#X的功能相反)
p:将缓冲区内的字符粘贴到光标所在位置(指令‘yw’与‘p必须搭配使用)。
yy:复制光标所在行。[超常用]p:复制单行到您想粘贴之处。(指令‘yy’与‘p’必须搭配使用)
#yy:如:6yy表示拷贝从光标所在的该行往下数6行之文字。[常用]
p:复制多行到您想粘贴之处。(指令‘#yy’与‘p’必须搭配使用)
ayy:将复制行放入buffer a, vi提供buffer功能,可将常用的数据存在buffer
ap:将放在buffer a的数据粘贴。
b3yy:将三行数据存入buffer b。
b3p:将存在buffer b的资料粘贴

(5) 取代
r: 取代光标所在处的字符:[常用]
R:取代字符直到按Esc为止。

(6) 复原(undo)上一个指令
u:假如您误操作一个指令,可以马上按u,回复到上一个操作。[超常用]
.: .可以重复执行上一次的指令。

(7) 更改
cw:更改光标所在处的字到字尾$处。
c#w:例如,c3w代表更改3个字。

(8) 跳至指定行
Ctrl+G:列出光标所在行的行号。#G:例如,15G,表示移动光标至文章的第15行行首。[常用]

命令行指令简介读者您要使用命令行指令之前,请记得先按Esc键确定您已经处于Command mode下后,再按冒号
“:”或“/”或“?”三键的其中一键进入Last line mode。

1.列出行号
set nu: 输入“set nu”后,会在文章的每一行前面列出行号。

2.跳到文章的某一行
#:井号代表一个数字,在Last line mode提示符号“:”前输入数字,再按
Enter就会跳到该行了,如:15[Enter]就会跳到文章的第15行。[常用]

3.寻找字符串
/关键字:先按/,再输入您想寻找的字,如果第一次找的关键字不是您相尽可能的,可以一直按
n会往下寻找到您要的关键字为止。?关键字:先按?,再输入您想寻找的字,如果第一次找的
关键字不是您想要的,可以按n会往前寻找到您要的关键字为止。

4.取代字符串
1, $s/string/replae/g:在last line mode输入“1,$s/string/replace/g”会将全文的
string字符串取代为replace字符串,其中1,$s就是指搜寻区间为文章从头至尾的意思,g则是
表示全部取代不必确认。%s/string/replace/c:同样会将全文的string字符串取代为replace
字符串,和上面指令不同的地方是,%s和1,$s是相同的功能,c则是表示要替代之前必须再次确认是否取代。
1,20s/string/replace/g:将1至20行间的string替代为relpace字符串。

5.存文件
w:在命令行提示符号“:”前按w即可将文件存起来。[超常用]
#,# w filename:如果您想摘取文章的某一段,存成另一个文件,可用这个指令#代表行号,
例如30,50 w nice,将您正在编辑文章的第30~50行存成nice这个文件。

6.离开
q:按q就离开,有时如果无法离开vi,可搭配“!:强置离开vi,如“q!”
qw:一般建议离开时,搭配w一起使用,如此离开时还可存文件。
(转载自http://my.opera.com/yjfuk/blog/show.dml/457081)
 
2007年06月14日 星期四 19:51
今天终于搞定,庆祝!
Instructions如下:

In order to boot linux on xup, a DRAM module and a CF card are required.
I used a Kingston KVR266X64C25/256 256MB RAM and 1GB CF card in this case.

Before you start to boot linux, you can first verify if your DRAM is installed
probably. There is a built-in test supplied by XUP board.

Here is the procedure to enable the test:

1. connect the serial port of xup board to host PC
2. plug the DRAM module to the slot but not the CF card
3. open hyper terminal on the windows, connect using COM port and use
   "9600 8-N-1" settings
4. check the switch SW9 on the xup board. both switches should be in the "ON"
   position
5. switch on the board, then hold the reset button (SW1) until the LED (D6)
   turn on, then release the button and you will found a Self Test Menu on the
   terminal
6. Press 5 to test DDR SDRAM. All test should pass.

The CF image is prepared using "dd" utility. So you can can bunzip2 it and dd
back to a CF card without any configuration. Once you restore the image on the
CF, you can check if the image are valid by checking if there is a file called
"system.ace" on the first partition. If so, the image restoration process
should be fine.

For your information, here is the partition configuration on the CF card
partition 1: FAT16, 32MB, bitstream, bootloader and kernel
partition 2: linux swap, 128MB
partition 3: linux ext2, 864MB root file system

Here is the step to boot the linux once you prepared the CF card and pass the
DRAM test.

1. connect the serial port of xup board to the host PC
2. plug the DRAM module to the slot but not the CF card
3. open hyper terminal on the windows, connect using COM port and use
   "38400 8-N-1" settings
4. use a crossover cable to connect the LAN port of XUP board to the host PC
5. set the IP of the host PC ethernet to 192.168.0.1 and netmask 255.255.255.0
6. check the switch SW9 on the xup board. both switches should be in the "OFF"
   position
7. check the switch SW8 on the xup board. all switches should be in the "OFF"
   position
8. turn on the xup board, and "hopefully" you can find the following text on
   the terminal screen:
--------------------------------------------------------------------
loaded at:     00400000 004DB1E4
board data at: 004D813C 004D8154
relocated to: 00405638 00405650
zimage at:     00405B3D 004D7447
avail ram:     004DC000 10000000

Linux/PPC load: console=ttyS0,38400 root=/dev/xsysace/disc0/part3 rw
--------------------------------------------------------------------
9. the boot process should be less than 20 seconds and you can login in as
   root with password "XXX".
10. you can also connect to xup via network. you can simply telnet or
   ssh to the board. the ip of the board is hardcoded as 192.168.0.100
11. I usually connect the board using ssh but if you think the connection
    is slow, you can use telnet anyway.
12. I have also setup sftp for file transfer too.
13. feel free to explore the board and try to compile and run program from
    xup too. you will feel the board is no difference from usual embedded
    system. but this board has a powerful FPGA inside.

感兴趣的可以问我要cf.img文件,里面包含FPGA配置的bitstream文件和一个Linux的内核文件系统。
 
2006年08月17日 星期四 15:58

对于Linux的普及,越来越多的朋友希望能够体验Linux的安全和稳定,享受开源给生活和工作带来的乐趣。在这里我给大家推荐一款本人最喜欢和最推崇的Linux发行版---Fedora Core 5,这是目前最新的Linux操作系统,性能稳定出色,推荐大家使用。我是从官方网站(http://fedora.redhat.com/)下载的FC5,通过硬盘安装,不花一分钱的,^_^,现在我把安装的大体经过写一下,仅供参考。

一、硬盘安装:
1.
下载 iso安装文件:
FC5-i386-DVD.iso,大概3G多,一般人只需要这个文件就可以了。如果你是双核CPU或64位机,就需要下载
FC-5-x86_64-DVD.iso

下载地址http://fedora.redhat.com/Download/
如果速度很慢,可以尝试一下地址:
ftp://219.245.117.33/pub/FC5/

将下载好的FC5-i386-DVD.iso文件放在一个 fat32 ext3分区上,我是:Windows XP+ Fedora Core 5 双启动,下载完ISO文件放在一个Fat32分区上(最好不要放在NTFS分区上),然后用 WinRAR 提取ISO文件里的isolinux 目录一个分区上(如:可以在Windows Xp 里面用WINRAR提取光盘镜像里 isolinux 目录到C\下)。

2.下载:Grub For Dos
http://www.linuxfans.org/nuke/modules.php?name=Site_Downloads&op=geninfo&did=3608
解压到C:\下,编辑 boot.ini 文件,加入:
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /noexecute=optin /fastdetect
C:\grldr="GRUB For Dos/Windows "
编辑C:\boot\grub\menu.lst 加入:
title Install-Fedora Core 5
kernel (hd0,0)/isolinux/vmlinuz
initrd (hd0,0)/isolinux/initrd.img

3.重新启动电脑,依次选择: GRUB For Dos/Windows > Install-Fedora Core 5
进入安装程序,在安装过程中当进行到选择安装介质时,选硬盘安装。

4.按提示一步步安装,直到完成重启!

5.安装完成后运行 yum update 更新系统 (可选)
#rpm -import /usr/share/rhn/RPM-GPG-KEY-fedora
#yum update

二、光盘安装:

如果你买了光盘,那就很简单了,不要设置很多系统参数,直接放入光驱,按照提示一步步安装就好了!


这样,一个Linux操作系统就安装好了,是不是很简单?
现在就好好享受Linux给你带来的快乐之旅吧!
 
2006年08月01日 星期二 21:03
这里的Linux,是指我最喜欢的Fedora Core系列,目前是FC5,当然对于其他的Linux系统同样适用。

一、下载JDK
目前最新的JDK的版本是JDK5.0 update 6。下载地址是:
 http://java.sun.com/j2se/1.5.0/download.jsp
点击“Download JDK5.0 Update 6”进入下载页面。页面下方的JDK Document是JDK的帮助文件,是学习Java的极好的参考资料,但目前只有英文版的,可喜的是该文档的中文版正在翻译中,估计明年大家就可以见到完整的JDK中文文档了。

选择“Accept”以接受版权协议并下载JDK,这里列出了对应于不同操作系统的JDK版本,我下载的是“Linux self-extracting file”对应的文件。下载后得到的是jdk-1_5_0_06-linux-i586.bin,其实这是一个类似Windows下自解压文件一样的文 件。这样当我们执行这个文件时它会自动解压到当前目录下。

二、安装
把下载的jdk-1_5_0_06-linux-i586.bin转移到/usr/java目录下,改名为jdk.bin,这样是为了方便安装时打命令。 打开终端窗口,执行“cd /usr/java” 进入/usr/java目录下。再执行“chmod a+x jdk.bin”,使当前用户拥有对jdk.bin的执行权限。执行“./jdk.bin”运行jdk.bin,这时会显示出JDK的安装许可协议,按空格 翻页,最后程序会问你是不是同意上面的协议,当然同意啦,输入“y”之后开始解压JDK到当前目录。此时屏幕上会显示解压的进度。解压完成后 /usr/java目录下会新建一个名为“jdk1.5.0_06”的目录,把这个目录名改为jdk1.5.0。至此我们已经在FC5下安装好了JDK。

三、配置
从理论上来说JDK装好了以后就可以正常使用了,但是为了我们日后使用的方便,我们还要对它设置一下。与Windows下的JDK设置一样,我们通常需要 设置一下环境变量。我习惯修改/etc/profile来添加环境变量,/etc/profile中设置的环境变量就像Windows下环境变量中的系统 变量一样,所有用户都可以使用。用文本编辑器打开/etc/profile,在最后加入以下几行:
export JAVA_HOME=/usr/java/jdk1.5.0
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
这样我们就设置好了JDK,重启一下机器之后我们在FC5下用Java写一个Hello World的程序以验证JDK是否安装正确。

四、Hello World
打开文本编辑器kwrite或gedit,输入下面的这段代码:

class HelloWorld
{
    public static void main(String args[])
    {
      System.out.println("Hello World");
    }
}
保存到你的用户目录下,并且文件名要为“HelloWorld.java”。在终端窗口中进入刚才保存的目录,输入“javac HelloWorld.java”编译,如果不出错误的话编译器不会给出任何提示。OK,没有消息就是好的消息。编译之后我们来运行这个程序,输入“java HelloWorld”,如果你看到屏幕上打印出“Hello World”,那么我们已经正确安装了JDK,成功配置了Java环境。
 
2006年03月21日 星期二 11:51

Hi, my name is Fedora Core "Bordeaux", and today I am 5. When I turned 4 last year, they got a funny salesman to talk about me like I was a toy. I like toys. But today Teacher said I am a big kid, and I should talk about myself. I can do lots of big kid stuff now, and everyone tells me that I play really well with all the other kids in class, even the ones who are mean like bullies. I always try and share, which is what Teacher says is the best thing.

Sharing is a really good thing to do. I like to share all my toys and books and stuff with all the other kids so that they can play with them and even learn things, too. I have a lot of neat stuff to share, so I made this cool list to tell you all about it. Teacher gave me some things to put in the list, but since I'm a big kid I think I should get to say what I want, too.

* GNOME 2.14

"Improved speed and usability, and new and better features for power management, file sharing, user help, system administration, teleconferencing, picture browsing, and networking." I think it's easy enough for even my little brother to use, but Mommy and Daddy like it a lot too.

* OpenOffice 2.0.2

"Enhanced productivity features, extensive compatibility with other popular office software, database connectivity functions, and improved use of system libraries for faster loading and better responsiveness overall." Mommy says she can make slide shows for work even easier

than before, and Daddy uses it to organizes all our books, music, and movies in databases.

* KDE 3.5.1

"New and exciting features for users and developers, including stylish and attractive applets, educational and entertaining games, incredibly standards-compliant Internet tools, and enhanced multimedia and usability." Plus it looks REALLY cool, especially when my big sister

fixes it just the way she likes.

* Mono

"Support for .NET means a new generation of dynamic and powerful cross-platform applications, with some already included, such as Tomboy for note-taking, F-Spot for photo management, and Beagle for content searching and indexing." See, I told you I'm really good at sharing! Plus, I don't ever have a problem remembering or finding things, like pictures, homework, or messages. Mommy says she's really proud of me.

* Yum-based Package Tools

"Installation and software management tools are all based on the flexible and powerful yum utility for easy selection and upgrade of new and existing software." And soon, I'll even be able to get my own special software at install time!

* Xen Virtualization

"The best framework yet for installation, management, migration, and monitoring of software-based virtual domains, allowing system owners to effectively leverage and force-multiply existing hardware for maximum efficiency, scalability, redundancy, and flexibility." Teacher says I get more work done faster than any other kid in our class, too.

* Enhanced Security

"Support for SELinux binary policy modules means that users and developers can now ship their own specialized policies with affected software. GCC's best of breed features, such as stack protection, NX, PIE, and compile-time buffer checks, pile on additional layers of assurance to effectively block illegal ingress." I know all my safety rules, and Mommy and Daddy say that it's really, REALLY hard for monsters to get in our house!

So at school, I got awards for "Best Attendance," "Teacher's Pet," "Honor Roll," and "Good Manners," plus Teacher lets me stay after to clean the erasers until Daddy comes to pick me up. He always tells me how good I am compared to the other kids he knows and that he's really

proud of me. He says it's because I'm 100% free and open source, and because I always try to do the right thing just like he and Mommy taught me.

I told him I didn't just learn it from him, but from all the nice people at Red Hat and the Fedora community, who teach me new things all the time. They're all different kinds of people -- users,

developers, writers, translators, testers, editors, and so many other things I can't even write it all. They're the people who make it possible to build a complete Linux platform from open source software.

All right, I have to go now. There's always more things to learn and do and I am a very, extremely busy kid. 'Bye!

 

- - -

Fedora is a set of projects sponsored by Red Hat and guided by the contributors. These projects are developed by a large community of people who strive to provide and maintain the very best in free, open source software and standards. Fedora Core, the central Fedora project,

is an operating system and platform, based on Linux, that is always free for anyone to use, modify, and distribute, now and forever.

Submitted by ThomasChung on Mon, 2006-03-20 09:58.

 
 
   
 
 
文章存档
 
     
 
最新文章评论
  

能给出具体的实现吗
 

还好,没有出来一看南京到了,坐过头了。
 

恩,不错
 

宝宝好可爱啊~~
 

祥子你的命咋一直这么好滴!老实交代去那座庙烧香了!
   
帮助中心 | 空间客服 | 投诉中心 | 空间协议
©2012 Baidu