My Planet.
-
Linux与Windows文件传输或者共享
2008-12-07
公司是做IC的,在公司每个人都有一台Windows PC,但是工作都是通过X server软件登录Unix/Linux Workstation做的,经常需要上传下载很多文件。公司为了保障数据的安全,工作站的ftp服务要么关闭了要么加设密码,Samba服务也是禁止了的。上传下载数据都得找网管,但是事事都找网管,真的很烦,也不是设计人员的风格。这不,实际上对于普通的文本文件,大家都利用剪贴板直接实现了内容互拷,都不会找网管,除非文件太大了或者不是文本的。
其实,公司设计中心的网络本来就是与外部断开的,限不限制PC和工作站之间的文件共享是没有意义的,PC的USB接口等也是封掉了的,限制Linux与Windows文件传输或者共享,只是徒增大家的麻烦罢了。而且Linux与Windows之间进行文件传输的方法是很多的,既然同在一个网内,而且在两者上都有账号登录,那么两者之间的数据传输就是不可能限制的。至少现在我就有一种谁都能实现的传输方式,无论什么样的文件,也不管文件有多大,超级简单(不需要root权限,也不是需要root事先修改某些执行文件的权限),但是这里就不公布出来了,不想讽刺公司制度和网管。(其实就一层窗户纸,说穿了大家都明白怎么做)
以后有空的话再详述一下Linux与Windows文件传输或者共享的方法。
1、Samba
Samba是许多服务以及协议的实现,其包括TCP/IP上的NetBIOS(NBT)、SMB、CIFS (SMB的增强版本)、 DCE/RPC或者更具体来说MSRPC(网络邻居协议套件)、一种 WINS服务器(也被称作NetBIOS Name Server(NBNS))、NT 域协议套件(包括NT Domain Logons、Secure Accounts Manager(SAM)数据库、Local Security Authority(LSA)服务、NT-style打印服务(SPOOLSS)、NTLM以及近来出现的包括一种改进的Kerberos协议与改进的轻型目录访问协议(LDAP)在内的Active Directory Logon服务)。以上这些服务以及协议经常被错误地归类为NetBIOS或者SMB。Samba也能够用于共享打印机。
Samba能够为选定的Unix目录(包括所有子目录)建立网络共享。该功能使得Windows用户可以像访问普通Windows下的文件夹那样来通过网络访问这些Unix目录。2、NFS
NFS 是网络文件系统(Network File System)的缩写,是在 Unix 系统间实现磁盘文件共享的一种方法,它支持应用程序在客户端通过网络存取位于服务器磁盘中数据的一种文件系统协议。最早之前是在1980年代由升阳所发展出来的。功能是透过网络让不同的机器、不同的操作系统能够彼此分享个别的资料。
NFS 的基本原则是“容许不同的客户端及伺服端通过一组 RPCs 分享相同的文件系统”,它是独立于操作系统,容许不同硬件及操作系统的系统共同进行文件的分享。
NFS 提供了以下的服务:
在目录(directory)中寻找文件
列出目录中的文件
管理目录
取得各文件的属性(file attribute)
文件的读/写3、FTP
FTP,这个大家都很熟悉了,文件传输协议。
4、OpenSSH
SSH的英文全称是Secure SHell。通过使用SSH,你可以把所有传输的数据进行加密,这样“中间人”这种攻击方式就不可能实现了,而且也能够防止DNS和IP欺骗。还有一个额外的好处就是传输的数据是经过压缩的,所以可以加快传输的速度。SSH有很多功能,它既可以代替telnet,又可以为ftp、pop、甚至ppp提供一个安全的“通道”。SSH具备很多优势,因此很多现代Linux服务器基于安全考虑已经不再开放传统的telnet和ftp服务,而是采用更安全SSH和sftp。
最初SSH是由芬兰的一家公司开发的。但是因为受版权和加密算法的限制,现在很多人都转而使用OpenSSH。OpenSSH是SSH的替代软件,而且是免费的,可以预计将来会有越来越多的人使用它而不是SSH。5、。。。
-
Using vi.
2007-11-26
Windows network administrators have long used Edit, Notepad, or Wordpad to edit large text and script files. Most UNIX systems have an editor of some sort; the actual utility varies depending on the flavor of UNIX you’re running. Some, like Sun Microsystems, even have full-blown competitors to Microsoft Word. But, all UNIX machines have vi - the visual editor. Once you know your way around vi, you can edit files on any flavor of UNIX, including Linux.
Before I get into how to use vi, it’s important to understand that there are two basic modes for vi: insert mode and command mode. Insert mode is the mode where you type and things appear on the screen. Command mode is the mode where you type and things happen, instead of text appearing.
Use the following command to start editing a file:
$ vi filename.txt
Now you have the text file open and ready to command. Below is a reference of VI commands.
Move Characters
j down
k up
l right
h left
-------------------------
Text
w,W Move forward by word
b,B Move backward by word
e,E End of word
(,) Beginning of next, previous sentence
},{ Beginning of next, previous paragraph
]], [[ Beginning of next, previous section
--------------------------
Lines
<Enter> First nonblank character of next line
0,$ First, last position of current line
^ First nonblank character of current line
+,- First nonblank character of next, previous line
H Top line of screen
M Middle line of screen
L Last line of screen
----------------------------
Searches
/pattern Search forward for pattern
?pattern Search backward for pattern
n,N Repeat last search in same, opposite direction
/,? Repeat previous search forward, backward
fx Search forward for character x in current line
Fx Search backward for character x in current line
-----------------------------
Line Number
CTRL-G Display current line number
nG Move to line number n
G Move to last line in file
:n Move to line n in file
------------------------------
Editing Commands
------------------------------
Insert
i,a Insert text before, after cursor
I,A Insert text before beginning, after end of line
o,O Open new line for text below, above cursor
------------------------------
Change
r Replace character
cw Change word
cc Change current line
cmotion Change text between the cursor and the target of motion
C Change to end of line
R Type over characters
s Substitude: delete character and isnert new text
S Substitute: delete current line and insert new text
--------------------------------
Delete, move
x Delete character under cursor
X Delete character before cursor
dw Delete word
dd Delete current line
D Delete to end of line
p,P Put deleted text after, before cursor
-----------------------------------
Exit Commands
-----------------------------------
ZZ Write and quit file
:x Write and quit file
:wq Write and quit file
:w Write file
:w! Write file, overriding protection
:q Quit file
:q Quit file, overriding protection
Q Quit vi and invoke exThere are many other commands out there, but these are some key commands to edit in VI comfortably.
-
Mplayer installing on Linux
2007-11-26
We can enjoy multimedia entertainment on Linux. Mplayer is recommended. That is like the Stormcodec on Windows. We only need the one player. It is perfect!
Then how to install an Mplayer on Linux?
Below the detailed steps for it. (System is Redhat Enterprise Linux Workstation 4 u2)
First,prepare the source code files. All of them can be downloaded from www:
src: MPlayer-1.0pre8.tar.bz2
skin: Blue-1.4.tar.bz2
codecs: all-20060412.tar.bz2, windows-all-20060115.zip
Put them in a dictionary, such as /home/software/mplayer
Discompress all-20060412.tar.bz2, windows-all-20060115.zip to /usr/local/lib/codecs, and /usr/local/lib/wincodecs
Second, configuration:
tar -xvf MPlayer-1.0pre8.tar.bz2
cd MPlayer-1.0pre8
./configure --enable-gui --enable-largefiles --enable-menu --prefix=/usr/local --with-codecsdir=/usr/local/lib/codecs/ --with-win32libdir=/usr/local/lib/wincodecs/ --confdir=/usr/local/etc/mplayer --cc=gcc
You can costum all the parameters. I'd like to set all the directory under /usr/local. The benefit is described in the article I posted two days ago-- the harddisk partition for linux.
Third, compile and install:
make
make install
Four, configure the skin:
Discompress the Blue-1.4.tar.bz2, and move it to /usr/local/share/mplayer/skin, and rename it as default.
That's all , enjoy your Mplayer. Maybe you will meet some problem, but that is nothing, you can solve them quickly. -
A method of harddisk partition for Linux
2007-11-26
The filesystem of Linux is not the same as that of Windows at all. Now we often use ext3fs. The way of Linux partitions management is more effecient than Windows. In Windows, the drives are marked as drive C, drive D, and so on. There will be a problem , because there are only 26 letters. In Linux, they are hda1, hda2, etc, and in its filesystem, they are all folder with any folder name you like.
After having installing Linux many times, I find this is an effective partition plan for the harddisk(assuming the total disk space for Linux is 20G) :
/---------------1G
/usr------------5G
/usr/local------6.5G
/home-----------6.5G
swap------------1G
Why this is an effective partition plan?
In this way, we mount /usr/local and /home as seperate partitions, so we can keep the data and applications we have installed, when we want to reinstall the Linux system.
Here, I have to mention another good side of Linux. In Windows, there is a registery, so we must reinstall all the applications after having reinstalled the system. But, in Linux, there is no registery, so all the applications are "green software"----a word we usually use in Windows.
Linux has more better sides, and I will describe them later.






