Skip navigation.

Missing pieces

Everything you should know about technology, but have been missing out

Linux/Unix commandline. Part 1

, , , ...

Command line in general might look something that's not very useful and it's certainly not pretty. But looks can be deceiving, Unix command line actually has long history and people who developed it certainly believed in it too (though there's sort of Unix version 2 available). I would say it's still relevant for some people including me.

Unix (including Linux, I'll just use Unix from now on) is actually kernel and collection of utilities from various sources. For example yes is an utility that prints y on infinite loop. So next time you see program that asks stupid questions that can be dismissed with just y (or any other letter), yes could be handy. I'm not going to show how to use it right now though (maybe in some later post). And yes, it's included in most Unix-style operating systems.

So you can imagine, that somebody got irritated babysitting program that wanted users to answer yes to questions and developed a utility to do the task for him/her and continued being lazy (as good programmers and sysadmins are). I would imagine too that someone saw that the utility was useful and wanted a copy. And then it gets part of the standard, though I'm not sure if yes is part of the POSIX standard or not. Maybe not, as it's not exactly essential utility for the standard at all.

I'll start with something that's bit more easy to grasp, programs that actually have some kind of user interface. Good thing about these programs is that they don't take up much memory, startup doesn't take long and they don't need that much bandwidth if you use them remotely. Downside is that learning curve is usually bit higher than with usual GUI programs, there are keyboard shortcuts to learn and configuring usually happens by editing configuration files with text editor. And that means you have to first find the examples to work with.

Window manager: Screen

Screen is so versatile that it deserves whole article. In short it's like window manager on command line, windows take up full screen though, so screenshot doesn't make much sense. It keeps running if you log out, so most people use it to keep Irssi running while they are logged out from the remote computer where Irssi runs in, but that's only one of its features. For example you can create new windows, share session with yourself or with other user account.

Chat: Irssi

Irssi is IRC-client done right. No public away messages by default (though you can do that with a script, if you want to do that for some strange reason), support for multiple servers and it's easy enough to use for people that don't use command line much otherwise, or at least with some help from someone who knows how to use it. Only thing it lacks is (always) visible user list (though there are at least one script to fix that). If you have friends that don't use IRC, you can use Bitlbee to connect to various instant message networks.

E-mail: Mutt

Mutt is just a e-mail client, so there's no calendar. But it starts up real fast, and every function has keyboard shortcut. It's not so hard to use once you learn most important keyboard shortcuts. There's some tricks though how to use it effectively.

For example you can delete message matching certain pattern and change folder with new messages with few keypresses. Which folder it suggests depends on their order in config file, so you can check always messages in most important folders first, no matter which folder you have open. But whole feature means you need to put those folders into config file, otherwise you can just browse the folders manually as they are on disk.

Text-editor: Vi...wait...Emacs...whatever

There has been war going on between vi (or vim) and Emacs users since they were developed, but most people don't really understand either one of them. By default vi is on command mode and you can't really write anything until you press the right key. And both of them are not easy to even exit (ctrl-x-c in Emacs. esc and then :q! in vi). Both of them take some time to learn properly and are very efficient editors. And any Unix you use, vi is always available, so learning it has some benefits. But if your time is not worth it, try Nano. Or if you miss that paperclip from MS Office, try Vigor :smile:

WWW-browser: Lynx, Links or Elinks

All three are browsers, but links is actually black sheep here. It actually can display pictures and use the mouse if it's in graphical mode. Still very fast, if you don't mind that most of the pages look bit strange. Great browsers if you want to open browser instantly, even if you're not in graphical mode (in more technical terms, X). You can also use them to debug things from remote computer, for example if you are suspecting that some firewall is blocking your connection to some site. Or save pages from scripts.

News-reader: slrn

If you're into news (I mean Usenet, not just news in general), slrn is great program. Default settings are almost sane (I don't like automatically subscribing to new groups though, but at least I found how to automativally unsubscribe from new groups) and it supports non US-ASCII character sets just fine (I had some problems with TIN). It's also possible to read messages straight from server, which didn't also work so well with TIN. Not that hard to use, but as always, there are some keyboard shortcuts to learn to use it effectively. Help is easily available with ?, so no need to panic if you forget some keyboard shortcut.

Multimedia

Sound is not a problem in command line, you just need a player that doesn't need a gui. At least MPD or XMMS2 should be fine enough and there's even more players available. Both are more userfriendly with some nice frontend. Frontends can be graphical too. Separate backend means that you can quit frontend and music keeps playing.

As for movieplayer, MPlayer is good, if you can't display graphics at all for some reason, you can render the video in textmode. Some SDL based games work also, at least Kobo Deluxe did, others that I have tried didn't. There's also NetHack, which doesn't need graphics mode at all. I'm sure that's there at least one picture viewer, but I have not researched them much yet.

I wrote this article on request (or at least sort of, request was to write about Linux command line), so as always, you can make requests. One of the possible ones would be more in depth look into some of the programs that I mentioned, but that happens much faster if there's clearly demand for one, so please let me know if you want to know more.

PS: Screenshots are taken with terminal with transparent background. All pictures are links, so you can see the picture in original size. They almost fit in this blog, but limit for pictures resolution is just little bit lower that the originals have. And sorry about that last picture is JPG, it got automatically converted and filesize actually grew a bit. PNGs size is bit smaller, but resolution is bigger. Well, at least page layout should be alright in most cases.

UNIX? Operating system? You mean there's more than one?

, , , ...

UNIX is not just an operating system, it's whole bunch of them. There's no single UNIX, just a certain specifications operating system has to pass and fee to pay to use the UNIX trademark. There's whole group operating systems that really can't afford the fee, but are still very similar and actually are derived from the original code.

Whole story is bit complicated, so if you just use computers and are not that interested how it really works, this might be bit too much information for you. But if you're interested in digging bit deeper than Windows 95, UNIX goes much beyond that and has not really gone anywhere, just evolved. Next version is already out there, nobody really uses it though.

UNIX has long history that started 1969, in Bell Laboratories. Culprit was man named Ken Thompson. He had some ideas how to improve Multics, but Bell Laboratories was no longer participating in its development. And he wanted to play Space Travel. It was game that he had written. I wonder if Windows was developed to play Solitaire.

Later Dennis Ritchie joined. Dennis Ritchie is the man behind C programming language that was his improvement to B language (short for BCPL). No, there was no A before that, it was just CPL.

What, you have never heard of C? It was intented to ease the development of UNIX and it's still popular language for developing operating systems and other programs.

Why there's so many of Unix derivatives now? Mother company of Bell (AT&T) didn't have rights to sell an operating systems due monopoly status (or anything that didn't have anything to do with phones), so they sold the source code for universities very cheaply. Universities developed the code further and made their own utilities. They copied source code to anyone who wanted a copy and some of that code found its way to original UNIX. One of those universities was Berkley and its distribution was named BSD, short for Berkely Software Distribution. Distribution was founded by Bill Joy who later left and started Sun Microsystems.

Over time there were quite large number of different versions, some of them commercial. They were not very compatible with each other, so often people had to make some modifications to programs source code to get it working in Unix derivative they were using. In 1985 POSIX (Portable Operating System Interface for uniX) tried to fix things. I guess that's the main reason why you can see so many same programs in Unix derivatives.

Once AT&T got their its monopoly status lifted it started developing its own Unix version and licensing source code for other commercial distributors. There were some trouble ahead for the free Unix version known as BSD.

Company named BSDi was selling operating system that was based on BSDs source code. Which in turn had some source from the original Unix. AT&T wasn't very pleased about that fact and sued BSDi. University of Berkley was also later dragged to court. Consequenses were that some code was removed and AT&T promised not to sue university of Berkley over the matter anymore. Another thing was that student named Linus Torvalds started to build his own own operating system (and no Unix code was used, not then and not after that, even if one company is trying to prove otherwise) for his 386 computer as future of BSD was not very bright and Minix was not accepting any patches. Also NetBSD and FreeBSD experienced some setbacks because they needed to remove some important code.

Actually, FreeBSD and NetBSD were based on 386BSD, which in turn was based on Net/2 that was last version of original BSD. Reason why they forked was that some developers didn't get some patches commited to original 386BSD and they decided to fork.

After that things got much better. Linus started receiving patches for his Linux operating system and FreeBSD and NetBSD added missing pieces and got working versions out. Both FreeBSD and NetBSD were forked again though. OpenBSD was forked from NetBSD because development of NetBSD was happening "behind closed doors" and only snapshots of the source was released now and then. Much later FreeBSD also was forked because of differences of opinnion about how support for multiple processors would be implemented. That fork is know as DragonflyBSD.

So that's it, Unix history crammed in just few paragraphs with some BSD flavor and drop of Linux. There's lot of stuff that I didn't mention, but there's books you can read about these things. For example Eric Raymonds The Art of Unix Programming has some chapters about history of Unix. Glen Moody has also written book called "The Inside Story of Linux and the Open Source Revolution" that has more about Linux. Henrik Ingo has also written quite nice book about open source in general, it's called "Open Life: The Philosophy of Open Source"

Even if Unix is a standard, implementations differ quite a bit. If you have to work with various versions of Unix (with trademark right or not), here's good list what utilities you have to use to do certain things.

PS: here's also good summary of the history, shorter and yet more detailed in some places than mine.

Globulation 2

, ,

Globulation 2 is quite innovative open source RTS (real time strategy) game. Innovative means that units don't need babysitting and you can't actually control any particular unit. But let's see how the gameplay actually works.

Like typical RTS, gameplay includes building buildings and units, but the implementation is bit different this time.

You can assign one or more units to a building. If the building is under construction, more builders will gather up resources to finish the building. As you can't directly command any particular unit, nearest free one will come to do the work. If the building is in working order, workers will gather up resources depending on the building type. For example, inn requires wheat, defense tower stones.

You can also repair buildings. But remember that buildings will be out of order while repairs are going on, so it's better leave that defense tower alone while it's under attack and bring some warriors to defend it.

You can also upgrade buildings, for example you can upgrade barracks to train even more stronger warriors. There's also building to make units faster and one for teaching them to swim.

Hive builds units constantly, as long as there's enough food. So there's no need to constantly get more units in the build queue, who needs queue anyway? Ratios in which certain types units are built can be controlled with a slider. So if you need few more explorers, you can increase the slider and higher percentage of new units will be explorers. And if you don't need workers anymore, you can stop producing them. Quite neat, reminds me of the original Master of Orion.

There are also different kind of areas. One is defence area (blue, warriors gather there, otherwise they roam freely in the base), forbidden area (red, quite handy) and clearing area (yellow, resources are cleared from that area).

But sometimes there is need for more direct action. That's why there are flags which attract units. Most important is attack flag. You can attract only warriors that are certain level or over and assign up to 20 warriors to the flag. It's actually quite neat to sweep whole enemy base with a war flag...

There are also exploring and clearing flag. Clearing flag is more effective than clearing area. Sometimes it's hard to get area cleared if workers are busy, unless you use clearing flag.

Single player game is pretty short, seven mission campaign and number of multiplayer maps to to train with. But at least there's some kind of plot going on in the campaign. Most of the missions are not difficult, but two last ones are more challenging. Last one was actually so challenging that it kept me occupied few days.

Graphics are nice, as you can see in the screenshots. OpenGL is also supported, so game is fast enough with older computers if there's 3D acceleration available. Most important use for the OpenGL accerelation is the cloud shadows, otherwise it's not in heavy use. Intromusic is nice, but music during the game gets repetitive quick.

Game doesn't stop with single player game, as there's also multiplayer available. I have not tried it, but it should be fun.

So final judgement is that Globulation 2 is the best open source RTS that I have seen so far. There's not much single player fun, but at least it's fun while it lasts. Plot is not that special, but it makes campaign feel like one. The game is actually quite fast paced, unless you're out of horse power. If the bar in top right is red and reaches the right corner, it would be good time to switch that OpenGL acceleration on if available.

Globulation 2 is available for the usual platforms, Windows, Linux, FreeBSD and Mac OS X. And as the game is open source, you can also join the development, wiki includes some examples of the possible tasks. One of them should be easy enough, join a multiplayer game :smile:

Group for technology minded people

,

I joined new group while ago. I'm not big fan of groups yet, but at least this one caught my attention.

So, for My Opera users out there, there's group for technology oriented people. That group is called techie-chat.

I'll be there helping out if someone has questions and if I found out interesting (and with at least few paragraphs worth of original content) posts about technology here at My Opera, I may post them to groups blog.

Phishing and other online frauds

,

You can always make sure that your passwords travels over the network encrypted, but if you give your password to somebody voluntarily, it doesn't really matter. Opera is developing a phishing filter, but that's not a perfect solution.

So what can you do even without any phising filters? Don't tell your password to anyone, not even to someone claiming to be doing maintenance. Real employees don't need your password, they already have the power to do anything to your account they need to. Other form of phising you can prevent by always typing the address of your banks site by yourself, not by following a link in some e-mail.

Another thing is those Nigerian letters. There's group fighting back them back and they have quite interesting stories. If you get e-mail that offers you large sum of money, it's quite likely your are about to lose some money if you fall for that trap.
December 2009
M T W T F S S
November 2009January 2010
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31