ITeye博客

Linux Toy

共 55 篇文章

Cygwin 中 xwin 的启动参数

不知为何现在装的cygwin xwin没有startxwin.sh这个脚本了 没关系,我们自己写一个,特别要注意的是以下三个参数 -nodecoration : no windows box around -multiwindow : every xclient window will be displayed ad normal window -fullscreen : full screen X win, especially good for gnome-session

2010-11-20 14:21 · Linux Toy · Windows · 脚本

三种数据库,取随机记录的方法

mysql:select * from tablename order by rand() limit 10 sqlserver:select top 10 * from tablename order by newid() oracle:使用 dbms random value的一种方法 sql> select *from (select *from t order by dbms_random.value) where rownum<10;

2010-09-16 12:23 · Linux Toy · SQL · MySQL · Oracle

用 grep 恢复误删的文本文件

作为长期的电脑使用者,肯定会有误删文件的经历,在 Mac OS X 和 Windows 上删除的文件都会默认进 “回收站”。在 Linux 上如果事先没有用别名(alias)修改默认的 rm 功能,rm 后文件就会丢失,幸运的是,在一般的删除文件操作中,Linux 并不会立即清空存储该文件的 block 内容,而只会释放该文件所占用的 inode 和 data block,Linux 上 rm 的过程其实就是将 inode bitmap 和 data block bitmap 中的相应标识设为空闲状态的过程,并不涉及到真正的数据,这也是为什么在 Linux 下删除大文件这么快速的原因,因为大…

2010-08-26 14:34 · Linux Toy · Windows · OS · SSH · 脚本 · Linux

使用TELNET手工操作 SMTP/POP 收发邮件

说明:手工录入的用蓝色字体表示,#后的为注释,不可录入。 =========先计算BASE64编码的用户名密码,认证登录需要用到=========== [crazywill@localhost crazywill]$ perl -MMIME::Base64 -e 'print encode_base64("crazywill");' Y3Jhenl3aWxs [crazywill@localhost crazywill]$ perl -MMIME::Base64 -e 'print encode_base64("mypassword");' bXlwYXNzd29yZA== ========…

2010-08-09 21:44 · Linux Toy · Perl

关于 port forward 的一个实例

tomcat 服务于 8080端口,但不想在前面加 apache, 直接中 80端转发: 以下这两句是为了在主机中能访问自己的 80端 iptables -t nat -A OUTPUT -d localhost -p tcp --dport 80 -j REDIRECT --to-ports 8080 iptables -t nat -A OUTPUT -d your hostname -p tcp --dport 80 -j REDIRECT --to-ports 8080 以下这句,让其它用户访问 80端 iptables -t nat -A PREROUTING -d your ho…

2010-07-07 09:25 · Linux Toy · Apache · nginx · J# · Tomcat

ubuntu 半虚拟化domU的安装方法

ubuntu还没有通过http://方法安装,不像redhat系的发行版.一种可行的方法是,先用iso安装成全虚拟化,然后再改成半虚拟化内核. 这里介绍另一种可能的方法. 1. install debootstrap from ubuntu site: wget http://cn.archive.ubuntu.com/ubuntu/pool/main/d/debootstrap/debootstrap_1.0.23.tar.gz tar zxvf debootstrap_1.0.23.tar.gz -C /usr/share 2. bootstrap a mini ubuntu /usr/…

2010-06-05 21:12 · Linux Toy · C · RedHat · Ubuntu · SSH · Linux

mount 硬盘镜像的一般问题。

1. 要搞清楚文件是 是由整个分区来的,还是整个硬盘来的 也就是说,是 dd if=/dev/sda1 还是 dd if=/dev/sda [root@oraclevmserver43 test_pvm_centos5.4_route]# file System.img System.img: x86 boot sector; partition 1: ID=0x83, active, starthead 1, startsector 63, 208782 sectors; partition 2: ID=0x8e, starthead 0, startsector 208845, 1656…

2010-06-01 12:33 · Linux Toy · F# · Linux

通过 ulimit 改善系统性能

http://www.ibm.com/developerworks/cn/linux/l-cn-ulimit/ 通过 ulimit 改善系统性能 文档选项 <script type="text/javascript"></script><noscript></noscript> <script type="text/javascript"></script><noscript></noscript> 打印本页 将此页作为电子邮件发送 <!--START RESERVED FOR FUTURE USE INCLUDE FILES--><!-- this content will be auto…

2010-05-22 09:07 · Linux Toy · Socket · 脚本 · Linux · 虚拟机 · 多线程

lvm 的一些笔记

今天,不得不面对lvm了,毕竞是公司用的. ================================================================= 创建LVM 1、首先,我们要先创建新磁盘分区 #fdisk /dev/hda 创建2个500MB分区(hda10,hda11),然后在fdisk命令下输入t,选择刚创建好的分区,输入8e,将刚创建好的2个分区转换为8e格式。输入w保存退出 2、激活刚创建好的分区 #partprobe 3、创建成pv格式 # pvcreate /dev/had{10,11} #pvdisplay 查看pv 4、将分区加载到vg卷组,vg…

2010-03-22 22:50 · Linux Toy · Go · F#

mencoder来提取电影mp3文件

假如在欣赏电影过程中出现了一段美妙的插曲(特别是印度电影,一般都会有很多歌舞片段),很多时候我们都想将其截取下来并作为mp3格式保存!利用mencoder可以很容易的实现这一愿望: mencoder -o out.mp3 -ovc frameno -oac mp3lame -lameopts cbr:br=128 -of rawaudio -ss 1:30 -endpos 2:45 test.rmvb 在实际操作中,用户需要更改的就是那两个时间参数值了!该命令参数的详细说明如下: -o out.mp3 输出的目标文件名称 -ovc frameno 不处理视频编码 -oac mp3lame 输…

2009-12-16 21:45 · Linux Toy

netcat usage sample

This page documents various techniques that people have found useful for transferring disk images to a SAN target. netcat If the source machine does only have one HDD which has been used completely, netcat can be used to transfer the image to the target in one step: On the storage Server: nc -l -p …

2009-11-28 18:33 · Linux Toy

dd 建立一个没有内容的大文件

dd if=/dev/zero of=sparse-file bs=1 count=0 seek=5M dd if=/dev/zero of=os11.img bs=1 count=0 seek=10G [root@myvm my]# du os11.img 0 os11.img

2009-11-22 09:36 · Linux Toy

Mounting a filesystem located on a partition of an image of a disk

Mounting a filesystem located on a partition of an image of a disk Need Mounting a filesystem located on a partition of an image of a disk Context The following describes the circumstances under which the following solution makes sense: It is understood by the entire disk image, the images that inc…

2009-10-24 17:52 · Linux Toy · Windows · Access · DOS · Debian · Linux

将光盘镜像CentOS-5.3-i386-bin-DVD.iso设置成为yum源

#mkdir /centos5.3.dvd (随便起个文件夹名) #mount -o loop CentOS-5.3-i386-bin-DVD.iso /centos5.3.dvd #cd /etc/yum.repos.d/ #mv CentOS-Base.repo CentOS-Base.repo.bak (改名) #vi /etc/yum.repos.d/CentOS-Media.repo (参考里面的[c5-media]的写法,加入下面四行) [centos5.3.dvd] name=centos5.3.dvd baseurl=file:///centos5.3.dvd gpgchec…

2009-09-28 07:43 · Linux Toy · CentOS

拷贝指定的文件出来但保持目录结构

抽取当前目录以下的所有logo1.* 或 logo2.* 到 /media/logo下 tar cvf - `find . -name "logo[1,2].*" -print` | (cd /media/logo;tar xvf - ) 缺点:因为是拷贝所以占用多一倍空间。 如果文件列表多于3000个以上方法不行的,用下边的方法: find . -name '*.txt' -print >/tmp/test.manifest tar -cvzf textfiles.tar.gz --files-from /tmp/test.manifest find . -name '*.txt' | x…

2009-09-18 08:39 · Linux Toy

定制 bt4 frefinal live cd ( ubuntu)

Customising the BackTrack 4 PreFinal ISO <!-- Begin Entry Div --> One of the downsides of leaving the linux live scripts and moving to non lzma enabled squashfs, is that we loose the wonderful and convenient setup for modifying the BackTrack LiveCD on our own. We use to be able to pop in a LZM file…

2009-08-21 10:01 · Linux Toy · Cache · Ubuntu · OS · UP · Linux

linux 下查看 iso 文件信息

root@feng-desktop:/media/sda5/iso # isoinfo -d -i bt3-final.iso CD-ROM is in ISO 9660 format System id: LINUX Volume id: SLAX <<<<看来bt3是源slax来的, 难怪它的安装包都是*.lmz Volume set id: Publisher id: Data preparer id: Application id: SLAX Copyright File id: Abstract File id: Bibliographic File id: Volume set …

2009-08-21 09:55 · Linux Toy · Linux

copy file over ssh with tar

tar is usually used for achiving applications, but what we are going to do in this case is tar it then pipe it over an ssh connection. tar handles large file trees quite well and preserves all file permissions, etc, including those UNIX systems which use ACLs, and works quite well with symlinks. th…

2009-08-15 08:57 · Linux Toy · C · C++ · Unix · C# · SSH

copy file using cpio

http://bradthemad.org/tech/notes/cpio_directory.php Most people live their whole lives without ever using the cpio utility. However, it is a useful thing, and is sometimes better suited to copying lots of files around than tar or cp. Here's a quick primer. Some important flags (In case the man-page…

2009-08-11 17:38 · Linux Toy · C · C++ · PHP · SSH · Linux

copy file using tar

We assume /source/dir is a filesystem, if there are other filesystems under /source/dir they will also be copied to /destination/dir cd /source/dir tar -cf - . | ( cd /destination/dir ; tar -xpvf - )

2009-08-11 17:22 · Linux Toy