Linux.com

Community Blogs



Shovelling Up the Mess left behind by Windows

One of the interesting uses for Linux nowadays is to re-gain compatibility with older Software and Hardware. As far as software is concerned, this can be broadly divided into two groups: Applications and Entertainment (mainly Games).

Application Software

There isn't much call for running older applications beyond a certain age amongst home users; and any company who knows what it is doing will migrate it's data and document formats to newer versions of software as they are procured.

If an application vendor goes out of business, an older version of their software can continue to be run unless there is a conflict with a newer operating system, at which point Virtualization or Emulation can take over.

Of course, the ideal solution is to convert the data into platform-neutral formats, with standards defined by a consortium. This gives businesses the assurance that they will still have access to their data through solutions from competing vendors.

Entertainment Software

For many years now, some of us have been using (or writing!) emulation software to play our favourite titles from platforms which are now consigned to history. We accept that this workaround is needed, as the hardware and operating system we are using now are so radically different to what the title originally required. There is a label describing the hardware / software required to run the title, such as 'ZX Spectrum', 'Amiga' or 'Atari ST', and we can therefore accept that we need an Emulator to run on 'Linux', 'Windows' or 'Wii'.

But 'PC' games are a different matter. There is a whole slew of older games for DOS / Windows 3.x / Windows 9x that will just not run on NT-based Windows, or require work arounds to work, often performing poorly in the process.  Worse still, x64 Windows systems do not have the NTVDM necessary to run DOS programs at all, and support for 16-bit Windows applications has been removed entirely.

 The fact is that nowadays, an x86 / x64 Linux machine equipped with Dosbox, Dosemu, and Wine (including the propreitary forks such as Cedega and Crossover Games) is in a far better position to run these older games than a modern off-the-shelf Windows system. Dosbox also contains an x86 CPU emulator, and can thus be run on any supported architecture.

Hardware

Modern Windows systems are great for supporting new hardware; Linux less so. You buy a £5 webcam today, and it's virtually guaranteed to work on Windows (and 'Mac' if it is written on the label). If the hardware manufacturer is serious about supporting Open Source, and release specifications and / or reference drivers, than you are fairly likely to find a means of getting the device to work on Linux or other Open Source systems.

Otherwise you are relying on a talented person who knows the necessary driver API's (either kernelspace, such as v4l, or userspace, such as SANE) and is prepared to experiment with the hardware, either for their own use or for a bounty, to write the necessary driver support. However, once the support is in Linux, it usually stays. Even if the API's change, there are usually  enough interested maintainers who will modify the code as necessary to make sure that older drivers still compile.

This is in stark contrast to Windows, where all you get from the manufacturer is binary blobs, a few mystic 'sys' and 'inf' files. If Microsoft change their kernel ABI, or port Windows to a new architecture (as x64 arguably is, as you cannot mix x86 and x64 code in a process, least of all the kernel!) then older drivers will break. If the manufacturer has gone out of business, or wishes to not support a device, the end user loses.

Microsoft have also made this situation worse - all drivers installed onto Vista x64 SP1 have to be signed, effectively ending any hopes at writing Kernel-Mode drivers by enthusiastic Windows users (were there ever any?), or companies who don't consider it economically viable to pay WHQL fees to audit the drivers for older devices, when they could just sell a new device.

I have a specific example here - my mother was using a 'Packard Bell'-branded Mustek scanner under Windows. Support for these drivers was dicy under Windows XP SP2 and onwards, often requiring her to reboot after scanning a single page before she could scan another. However, under SANE on Linux it works perfectly under the 'gt68xx' backend, and is likely to do so for many years to come. Yes, the software is more complicated for her to use, but she is relieved that it works flawlessly, and is grateful it will continue to do so.

Thoughts

I'm hoping that Microsoft's power-hungry grab for the brand-label of 'PC' ("Personal Computer") to describe their particular Operating System running on a particular CPU / Hardware architecture will be a part of their undoing.  The fact that in earlier days people were attracted to the 'PC' brand for the large software and hardware compatability will prove that they cannot even be compatible with their own standards, which the community has had to provide.

It's not just Microsoft though; by clinging to the brand name of 'Macintosh', Apple has made a similar rod for their own back. If you were using OSX prior to 10.5 on a PPC machine, thanks to the 'Classic' emulator you would be guaranteed to be able to run almost any 'Macintosh' title. However, the shift to 10.5 and Intel processors has ended their 'support' of this. Personally, i  believe the label 'Macintosh' to be highly irrelevant in describing modern Apple systems.

 Conclusions

Having now forgotten the enthusiasts that put them where they now are, Microsoft and Apple haven't banked on them still being around, and being able to influence the decisions of non-enthusiasts. We want to carry on running older games. We don't want to have to ditch perfectly good peripherals due to an upgrade of an operating system.

As those PC users (who know enough to be able to support themselves) try to use their older peripherals and software and find that they fail to work on Windows, yet work fine in Linux, the knowledge and reputation of Linux will increase. So the future is actually kinda bright for us, at least in this area!

Although it might seem like flame bait to suggest it on a Linux site, i'm kind of hoping ReactOS achieves good XP compatability and look and feel. Users are reluctant to change, and at least they can carry on with their Windows habits whilst  embracing the freedom that Open Source software brings.

 Richard Foulkes is not a Technical Journalist. He holds no fashionable Industry qualfications and has never spoken at a conference or even been to one. He makes no claim of being an IT professional. He is also not currently employed.

 

Finally!

I have been waiting for this.

I use to be a "regular" of Linux.com...

The gestation was long (it's always like that when you wait...), but now I appreciate why!

Bravo for all the work - this new web site is an impressive achievement.

Im'happy, because I've become free - totally free - when the last barrier - an iMac - fell 2 weeks ago. It was replaced, at my request to my employer, by a System76 machine running Ubuntu. So now, at work and at home, I'm free! My wife and I run Ubuntu on all our computers - and we're happy with it!

And all this because some guy, in Finland, some 20 years ago, decided he too wanted to be free!

Need I say more... ?

 

So Tragic

Ive collected some cute things when I was in Linux World expo last time. I have this rubber penguin keychain and used to hang it on my beg.

Isnt it cute?

Before

Before

 

After

 After

Isnt it tragic :(

I brought it everywhere I go, and many times Ive realised it was stucked inside the car when I closed the car door, the building door and everything else. Will find a new one :) 

 

 

A Microsoft problem, or a "Me" problem

I'll be the first to admit that I probably should know Windows better (being in the IT field, after all) than I should, but sometimes I just have this feeling of "why should I when I know the linux way better?" Of course, not everything is that black and white, but perhaps an example is in order.

Today, I was at a friend's house, and they wanted help backing up a hard drive. Now, by some odd piece of work, it was a SATA drive in which the enclosure didn't work for some reason or another. Now, I do have an IDE/SATA to USB converter, so I offered to rip the drive to an ISO for them. They declined and just hooked the hard drive up to their computer. Alas, the drive spun up but was not detected by windows, and their tools apparently won't rip ISOs if it can't detect the drive. So, I offer again to try and manage to detect the drive through "dmesg | tail", but cannot mount it. Either way, that didn't stop me from dd-ing the drive, but the hard drive space of my netbook was definitely a limiting factor.

Since I was going to be there for a while, I plugged in the netbook and had them share a folder on their computer and had it mounted a second later (after apt-getting smbfs from the ubuntu repositories) across the network. After that, it was relatively smooth sailing until it finished (though, I did run ` watch -n 1 -d "ls -alh backup.iso | cut -d ' ' -f5" ' in another window to keep track of the general progress of the process).

Of course, at this point I am stuck with the thought of "most of these tools are common tools on linux", and immediatly follow it up with the thought "why can't windows have such tools on hand?". Now, I grant that similar tools probably exist on Windows, but why would I want to have them when I know that they are built-in on linux?

To me, linux just isn't about being pretty; it's also about having funtion, and I really appreciate the days when a tiny laptop that I just use for surfing the web and chatting with friends comes in and helps solve a big issue, while the "big windows computers" are forced on the sidelines, due to lack of functionality. Why do I derive such enjoyment from such a thought? Perhaps it's because I always hear "oh, but linux isn't compatible" and "but linux can't do that" all the time, and it's nice to actually have the power to show them that linux isn't just for big servers locked up in a room somewhere.

 

What to do when you can't ping a computer

What do you do when you need to check the status of a computer / device on your network that doesn't respond to pings?

A lot of computers / devices on a network are configured to ignore ping requests. This can sometimes leave you wondering if they are really offline. 

internet:~ # ping 10.1.2.161
PING 10.1.2.161 (10.1.2.161) 56(84) bytes of data.

--- 10.1.2.161 ping statistics ---
5 packets transmitted, 0 received, 100% packet loss, time 4009ms

So how do you ping something that doesn't reply?

Read more... Comment (0)
 

Using Shell commands to copy, move and remove files —— Chinese Simplified

cp命令

该命令的功能是将给出的文件或目录拷贝到另一文件或目录中,同MSDOS下的copy命令一样,功能十分强大。

语法: cp [选项] 源文件或目录 目标文件或目录

说明:该命令把指定的源文件复制到目标文件或把多个源文件复制到目标目录中。

该命令的各选项含义如下:

- a 该选项通常在拷贝目录时使用。它保留链接、文件属性,并递归地拷贝目录,其作用等于dpR选项的组合。

- d 拷贝时保留链接。

- f 删除已经存在的目标文件而不提示。

- i 和f选项相反,在覆盖目标文件之前将给出提示要求用户确认。回答y时目标文件将被覆盖,是交互式拷贝。

- p 此时cp除复制源文件的内容外,还将把其修改时间和访问权限也复制到新文件中。

- r 若给出的源文件是一目录文件,此时cp将递归复制该目录下所有的子目录和文件。此时目标文件必须为一个目录名。

- l 不作拷贝,只是链接文件。

  需要说明的是,为防止用户在不经意的情况下用cp命令破坏另一个文件,如用户指定的目标文件名已存在,用cp命令拷贝文件后,这个文件就会被新源文件覆盖,因此,建议用户在使用cp命令拷贝文件时,最好使用i选项。

 

mv命令

用户可以使用mv命令来为文件或目录改名或将文件由一个目录移入另一个目录中。该命令如同MSDOS下的ren和move的组合。

语法:mv [选项] 源文件或目录 目标文件或目录

说明:视mv命令中第二个参数类型的不同(是目标文件还是目标目录),mv命令将文件重命名或将其移至一个新的目录中。当第二个参数类型是文件时,mv命令完成文件重命名,此时,源文件只能有一个(也可以是源目录名),它将所给的源文件或目录重命名为给定的目标文件名。当第二个参数是已存在的目录名称时,源文件或目录参数可以有多个,mv命令将各参数指定的源文件均移至目标目录中。在跨文件系统移动文件时,mv先拷贝,再将原有文件删除,而链至该文件的链接也将丢失。

命令中各选项的含义为:

- I 交互方式操作。如果mv操作将导致对已存在的目标文件的覆盖,此时系统询问是否重写,要求用户回答y或n,这样可以避免误覆盖文件。

- f 禁止交互操作。在mv操作要覆盖某已有的目标文件时不给任何指示,指定此选项后,i选项将不再起作用。

如果所给目标文件(不是目录)已存在,此时该文件的内容将被新文件覆盖。为防止用户用mv命令破坏另一个文件,使用mv命令移动文件时,最好使用i选项。

rm命令

用户可以用rm命令删除不需要的文件。该命令的功能为删除一个目录中的一个或多个文件或目录,它也可以将某个目录及其下的所有文件及子目录均删除。对于链接文件,只是断开了链接,原文件保持不变。

rm命令的一般形式为:

rm [选项] 文件...

如果没有使用- r选项,则rm不会删除目录。

该命令的各选项含义如下:

- f 忽略不存在的文件,从不给出提示。

- r 指示rm将参数中列出的全部目录和子目录均递归地删除。

- i 进行交互式删除。

使用rm命令要小心。因为一旦文件被删除,它是不能被恢复的。了防止这种情况的发生,可以使用i选项来逐个确认要删除的文件。如果用户输入y,文件将被删除。如果输入任何其他东西,文件则不会删除。

 

Chromium

Die Geschichte: Chromium ist ein OpenSource Projekt, das von Google gestartet wurde, mit dem Ziel, einen Browser zu schaffen, der eine neuartige Javascriptverarbeitung beherrscht. Das kommt Google zu Gute, denn die vielen auf AJAX basierenden Webapps laufen in heutigen Browsern nicht zufriedenstellend schnell.

 Das Programm: Google kündigte gleich zu Beginn an, dass der Browser aufden drei großen Plattformen laufen würde. Aber wie das in der Softwarewelt immer so ist, gibt es nur unter Windows eine stabile Version. Da Chromium ja aber ein OpenSource Projekt ist und zudem interessant, gibt es natürlich schon eine Launchpad Paketquelle, die DailyBuilds bereit stellt.

Der alltägliche Gebrauch: Chromium läuft schon stabil genug, um EMails zu lesen oder im Web zu surfen - allerdings sollte man wichtige Dinge immer noch mit einem stabilen Browser erledigen. Manche der Seiten auf der von Google gestarteten Sammlung von  Javascriptanwendungen der neuen Generation funktionieren schon - andere nicht. Manchmal stürzt der Browser ab - manchmal kann die Anwedung noch nicht alle Features des Browsers nutzen da sie noch nicht implementiert sind. Man sollte diesen Browser aber trotzdem ausprobieren ;-).

 Die Installation: Einfach die Launchpad Paketquelle einbinden, aber bitte beachten: Fremdquellen können Schadsoftware ins System einschleusen! 

deb http://ppa.launchpad.net/chromium-daily/ppa/ubuntu jaunty main
deb-src http://ppa.launchpad.net/chromium-daily/ppa/ubuntu jaunty main 

Danach noch mit dem Befehl

gpg --keyserver keyserver.ubuntu.com --recv 4E5E17B5 && gpg --export -a 4E5E17B5 | sudo apt-key add - 

den Schlüssel der Quelle hinzufügen.

 Viel Spass ;-) 

 

Using Shell commands to manage your directories and change working paths —— Chinese Simplified

mkdir命令

功能:创建一个目录(类似MSDOS下的md命令)。

语法:mkdir [选项] dir-name

说明:该命令创建由dir-name命名的目录。要求创建目录的用户在当前目录中(dir-name的父目录中)具有写权限,并且dirname不能是当前目录中已有的目录或 文件名称。

命令中各选项的含义为:

- m 对新建目录设置存取权限。也可以用chmod命令设置。

- p 可以是一个路径名称。此时若路径中的某些目录尚不存在, 加上此选项后, 系统将自动建立好那些尚不存在的目录,即一次可以建立多个目录。

rmdir 命令

功能:删除空目录。

语法:rmdir [选项] dir-name

说明:dir-name表示目录名。该命令从一个目录中删除一个或多个子目录项。需要 特别注意的是,一个目录被删除之前必须是空的。rm - r dir命令可代替 rmdir,但是有危险性。删除某目录时也必须具有对父目录的写权限。

命令中各选项的含义为:

- p 递归删除目录dirname,当子目录删除后其父目录为空时,也一同被删除。如果整个路径被删除或者由于某种原因保留部分路径,则系统在标准输出上显示相应 的信息。

cd 命令

功能:改变工作目录。

语法:cd [directory]

说明:该命令将当前目录改变至directory所指定的目录。若没有指定directory, 则回到用户的主目录。为了改变到指定目录,用户必须拥有对指定目录的执行和读 权限。

该命令可以使用通配符(通配符含义请参见第十章)。


pwd 命令

在Linux层次目录结构中,用户可以在被授权的任意目录下利用mkdir命令创建新目录,也可以利用cd命令从一个目录转换到另一个目录。然而,没有提示符来告知用 户目前处于哪一个目录中。要想知道当前所处的目录,可以使用pwd命令,该命令显示整个路径名。

语法:pwd

说明:此命令显示出当前工作目录的绝对路径。

ls 命令

ls是英文单词list的简写,其功能为列出目录的内容。这是用户最常用的一个命令之一,因为用户需要不时地查看某个目录的内容。该命令类似于DOS下的dir命令。

语法:ls [选项] [目录或是文件]

对于每个目录,该命令将列出其中的所有子目录与文件。对于每个文件,ls将输出 其文件名以及所要求的其他信息。默认情况下,输出条目按字母顺序排序。当未给出目录名或是文件名时,就显示当前目录的信息。

命令中各选项的含义如下:

- a 显示指定目录下所有子目录与文件,包括隐藏文件。

- A 显示指定目录下所有子目录与文件,包括隐藏文件。但不列出"."和 ".."。

- b 对文件名中的不可显示字符用八进制逃逸字符显示。

- c 按文件的修改时间排序。

- C 分成多列显示各项。

- d 如果参数是目录,只显示其名称而不显示其下的各文件。往往与l选项一起使 用,以得到目录的详细信息。

- f 不排序。该选项将使lts选项失效,并使aU选项有效。

- F 在目录名后面标记"/",可执行文件后面标记"*",符号链接后面标记 "@",管道(或FIFO)后面标记"|",socket文件后面标记"="。

- i 在输出的第一列显示文件的i节点号。

- l 以长格式来显示文件的详细信息。这个选项最常用。

每行列出的信息依次是: 文件类型与权限 链接数 文件属主 文件属组 文件大小 建立或最近修改的时间 名字

对于符号链接文件,显示的文件名之后有"-〉"和引用文件路径名。

对于设备文件,其"文件大小"字段显示主、次设备号,而不是文件大小。

目录中的总块数显示在长格式列表的开头,其中包含间接块。

- L 若指定的名称为一个符号链接文件,则显示链接所指向的文件。

- m 输出按字符流格式,文件跨页显示,以逗号分开。

- n 输出格式与l选项相同,只不过在输出中文件属主和属组是用相应的UID号和 GID号来表示,而不是实际的名称。

- o 与l选项相同,只是不显示拥有者信息。

- p 在目录后面加一个"/"。

- q 将文件名中的不可显示字符用"?"代替。

- r 按字母逆序或最早优先的顺序显示输出结果。

- R 递归式地显示指定目录的各个子目录中的文件。

- s 给出每个目录项所用的块数,包括间接块。

- t 显示时按修改时间(最近优先)而不是按名字排序。若文件修改时间相同,则 按字典顺序。修改时间取决于是否使用了c或u选顶。缺省的时间标记是最后一次修 改时间。

- u 显示时按文件上次存取的时间(最近优先)而不是按名字排序。即将-t的时间 标记修改为最后一次访问的时间。

- x 按行显示出各排序项的信息。

用ls - l命令显示的信息中,开头是由10个字符构成的字符串,其中第一个字符表示文件类型,它可以是下述类型之一:

- 普通文件

d ÁõÆÂΩï

l 符号链接

b 块设备文件

c 字符设备文件

后面的9个字符表示文件的访问权限,分为3组,每组3位。

第一组表示文件属主的权限,第二组表示同组用户的权限,第三组表示其他用户的权限。每一组的三个字 符分别表示对文件的读、写和执行权限。

各权限如下所示:

r 读

w ÂÜô

x 执行。对于目录,表示进入权限。

s 当文件被执行时,把该文件的UID或GID赋予执行进程的UID(用户ID)或GID(组 ID)。

t 设置标志位(留在内存,不被换出)。如果该文件是目录,在该目录中的文件只能被超级用户、目录拥有者或文件属主删除。如果它是可执行文件,在该文件执行 后,指向其正文段的指针仍留在内存。这样再次执行它时,系统就能更快地装入该文件。

 

Using Shell commands to manage your text files —— Chinese Simplified

sort命令

sort命令的功能是对文件中的各行进行排序。sort命令有许多非常实用的选项,这些选项最初是用来对数据库格式的文件内容进行各种排序操作的。实际上,sort命令可以被认为是一个非常强大的数据管理工具,用来管理内容类似数据库记录的文件。

Sort命令将逐行对文件中的内容进行排序,如果两行的首字符相同,该命令将继续比较这两行的下一字符,如果还相同,将继续进行比较。

语法:

sort [选项] 文件

ËØ¥ÊòéÔºösortÂëΩ‰ª§ÂØπÊåáÂÆöÊñቪ∂‰∏≠ÊâÄÊúâÁöÑË°åËøõË°åÊéíÂ∫èÔºåÂπ∂Â∞ÜÁªìÊûúÊòæÁ§∫Âú®Ê†áÂáÜËæìÂá∫‰∏ä„ÄǶlj∏çÊåáÂÆöËæìÂÖ•Êñቪ∂Êàñ‰ΩøÁ- ”ÔºåÂàôË°®Á§∫ÊéíÂ∫èÂÜÖÂÆπÊù•Ëá™Ê†áÂáÜËæìÂÖ•„ÄÇ

sort排序是根据从输入行抽取的一个或多个关键字进行比较来完成的。排序关键字定义了用来排序的最小的字符序列。缺省情况下以整行为关键字按ASCII字符顺序进行排序。

改变缺省设置的选项主要有:

- m 若给定文件已排好序,合并文件。

- c 检查给定文件是否已排好序,如果它们没有都排好序,则打印一个出错信息,并以状态值1退出。

- u 对排序后认为相同的行只留其中一行。

- o 输出文件 将排序输出写到输出文件中而不是标准输出,如果输出文件是输入文件之一,sort先将该文件的内容写入一个临时文件,然后再排序和写输出结果。

改变缺省排序规则的选项主要有:

- d 按字典顺序排序,比较时仅字母、数字、空格和制表符有意义。

- f 将小写字母与大写字母同等对待。

- I 忽略非打印字符。

- M ‰Ωú‰∏∫Êúà‰ªΩÊØîËæÉÔºö“JAN<FEB

- r 按逆序输出排序结果。

+posl - pos2 指定一个或几个字段作为排序关键字,字段位置从posl开始,到pos2为止(包括posl,不包括pos2)。如不指定pos2,则关键字为从posl到行尾。字段和字符的位置从0开始。

- b 在每行中寻找排序关键字时忽略前导的空白(空格和制表符)。

- t separator 指定字符separator作为字段分隔符。

 

uniq命令

文件经过处理后在它的输出文件中可能会出现重复的行。例如,使用cat命令将两个文件合并后,再使用sort命令进行排序,就可能出现重复行。这时可以使用uniq命令将这些重复行从输出文件中删除,只留下每条记录的唯一样本。

语法:

uniq [选项] 文件

ËØ¥ÊòéÔºöËøô‰∏™ÂëΩ‰ª§ËتÂèñËæìÂÖ•Êñቪ∂ÔºåÂπ∂ÊØîËæÉÁõ∏ÈǪÁöÑË°å„ÄÇÂú®Ê≠£Â∏∏ÊÉÖÂܵ‰∏ãÔºåÁ¨¨‰∫å‰∏™Âè䉪•ÂêéÊõ¥Â§ö‰∏™Èáç§çË°åÂ∞ÜË¢´Âà†ÂéªÔºåË°åÊØîËæÉÊòØʆπÊçÆÊâÄÁî®Â≠óÁ¨¶ÈõÜÁöÑÊéíÂ∫èÂ∫èÂàóËøõË°åÁöÑ„ÄÇËØ•ÂëΩ‰ª§Âä†Â∑•ÂêéÁöÑÁªìÊûúÂÜôÂà∞ËæìÂá∫Êñቪ∂‰∏≠„ÄÇËæìÂÖ•Êñቪ∂ÂíåËæìÂá∫Êñቪ∂ÂøÖÈ°ª‰∏çÂêå„ÄǶÇÊûúËæìÂÖ•Êñቪ∂Á- ”Ë°®Á§∫ÔºåÂàô‰ªéʆáÂáÜËæìÂÖ•ËتÂèñ„ÄÇ

该命令各选项含义如下:

- c 显示输出中,在每行行首加上本行在文件中出现的次数。它可取代- u和- d选项。

- d 只显示重复行。

- u 只显示文件中不重复的各行。

- n 前n个字段与每个字段前的空白一起被忽略。一个字段是一个非空格、非制表符的字符串,彼此由制表符和空格隔开(字段从0开始编号)。

+n 前n个字符被忽略,之前的字符被跳过(字符从0开始编号)。

- f n 与- n相同,这里n是字段数。

- s n 与+n相同,这里n是字符数。

 

Using Shell commands to backup and compress —— Chinese Simplified

tar命令

tar可以为文件和目录创建档案。利用tar,用户可以为某一特定文件创建档案(备份文件),也可以在档案中改变文件,或者向档案中加入新的文件。tar最初被用来在磁带上创建档案,现在,用户可以在任何设备上创建档案,如软盘。利用tar命令,可以把一大堆的文件和目录全部打包成一个文件,这对于备份文件或将几个文件组合成为一个文件以便于网络传输是非常有用的。Linux上的tar是GNU版本的。

语法:tar [主选项+辅选项] 文件或者目录

使用该命令时,主选项是必须要有的,它告诉tar要做什么事情,辅选项是辅助使用的,可以选用。

主选项:

c 创建新的档案文件。如果用户想备份一个目录或是一些文件,就要选择这个选项。

r 把要存档的文件追加到档案文件的未尾。例如用户已经作好备份文件,又发现还有一个目录或是一些文件忘记备份了,这时可以使用该选项,将忘记的目录或文件追加到备份文件中。

t 列出档案文件的内容,查看已经备份了哪些文件。

u 更新文件。就是说,用新增的文件取代原备份文件,如果在备份文件中找不到要更新的文件,则把它追加到备份文件的最后。

x 从档案文件中释放文件。

辅助选项:

b 该选项是为磁带机设定的。其后跟一数字,用来说明区块的大小,系统预设值为20(20*512 bytes)。

f 使用档案文件或设备,这个选项通常是必选的。

k 保存已经存在的文件。例如我们把某个文件还原,在还原的过程中,遇到相同的文件,不会进行覆盖。

m 在还原文件时,把所有文件的修改时间设定为现在。

M 创建多卷的档案文件,以便在几个磁盘中存放。

v 详细报告tar处理的文件信息。如无此选项,tar不报告文件信息。

w 每一步都要求确认。

z 用gzip来压缩/解压缩文件,加上该选项后可以将档案文件进行压缩,但还原时也一定要使用该选项进行解压缩。

gzip命令

减少文件大小有两个明显的好处,一是可以减少存储空间,二是通过网络传输文件时,可以减少传输的时间。gzip是在Linux系统中经常使用的一个对文件进行压缩和解压缩的命令,既方便又好用。

语法:gzip [选项] 压缩(解压缩)的文件名

各选项的含义:

-c 将输出写到标准输出上,并保留原有文件。

-d 将压缩文件解压。

-l 对每个压缩文件,显示下列字段:

压缩文件的大小

未压缩文件的大小

压缩比

未压缩文件的名字

-r 递归式地查找指定目录并压缩其中的所有文件或者是解压缩。

-t 测试,检查压缩文件是否完整。

-v 对每一个压缩和解压的文件,显示文件名和压缩比。

-num 用指定的数字num调整压缩的速度,-1或-fast表示最快压缩方法(低压缩比),-9或-best表示最慢压缩方法(高压缩比)。系统缺省值为6。

unzip命令

用MS Windows下的压缩软件winzip压缩的文件如何在Linux系统下展开呢?可以用unzip命令,该命令用于解扩展名为.zip的压缩文件。

语法:unzip [选项] 压缩文件名.zip

各选项的含义分别为:

-x 文件列表 解压缩文件,但不包括指定的file文件。

-v 查看压缩文件目录,但不解压。

-t 测试文件有无损坏,但不解压。

-d 目录 把压缩文件解到指定目录下。

-z 只显示压缩文件的注解。

-n 不覆盖已经存在的文件。

-o 覆盖已存在的文件且不要求用户确认。

-j 不重建文档的目录结构,把所有文件解压到同一目录下。

 

Checking for the latest Apache source version - Lazy sysadmin version...

This is a short little write-up on how to stay current with the latest version of the Apache HTTP server. Since I crated a script to do all the hard work, I will mostly explain the sequence of events and additional steps you may need to take before and after the script is run.

High Level Steps

The steps that we will take is as follow:

Preparation:

  • Import the Apache PGP KEYS file (once off)
  • Prep our environment (once off)
  • Get the script!


Actions in the script:

  • Load our current version
  • Go through the shortlist of mirrors (loop) and process on the first positive match
  • Get the list of files
  • Extract the version info from the file
  • Is there a new version available (compare with our current latest version)? No - EXIT; YES carry on...
  • Download the file
  • Security check (MD5 and PGP)
  • Notify
  • Update latest current version
  • Run additional scripts
  • STOP

Finally we take a look at actions we will typically take after we have the source.

Preperation

PGP Keys:

If you have not done so already, get the latest KEYS file from the main Apache site:
$ wget http://www.apache.org/dist/httpd/KEYS
$ gpg --import KEYS

If you need more info about the gpg application, please have a look here: http://www.gnupg.org/documentation/howtos.en.html


The environment the script will run in:

You should find a place to store the downloaded files and the tracker file. The script by default put's everything in /tmp - but this is not ideal as it get's cleaned out from time to time and the files will be lost after a reboot.

 

On RedHat based systems, I would suggest /usr/src/redhat/SOURCES/ as the destination directory for the Apache source. You could place the tracker file in your home directory if you want.


Getting the script:

Download the latest version of the script:
$ wget http://sites.google.com/site/unforgetstuff/Home/perl-stuff/check_latest_apache_version.pl?attredirects=0

Dependencies - Perl modules:

Some of the dependencies may be available on your Linux distro. If it's not, you can install them using either instruction from http://www.cpan.org/modules/INSTALL.html or http://www.perl.com/doc/manual/html/lib/CPAN.html

 

In the future I hope to add support for:
Right now, I use the gpg app just to report the result.

Configuring the script

If you open the downloaded file, you will see all the parameters you can change is in the top 30 odd lines.

$branch - Just set this to the major branch you are watching. For me this is 2.2 (script default)

@mirrors - This is a list of mirrors. You MUST have at least one. More is better, for in case your primary mirror is not available.

The other variables should be fairly self explanatory :-)

Running the Script

After you have downloaded, you can just change the permissions to make it executable and run it first by hand to test and when you are happy with the results add it to your crontab :-)

Conclusion

This was one of those quick morning hacks and I will be using and improving the script in the following months.

For RedHat(RPM) based systems, I suggest you look at ways to use the post action script to automatically build your next RPM. You are of course welcome to post that bit on your blog or on the Apache Group page.

 

 
Page 111 of 130

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board