APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

How do you do "X" in Unix (Linux,Solaris..)?

© March 2008 Anthony Lawrence

One of the paradigm shifts Windows users (and even some Unix users) have to get by is often seen in a "How do I do X in Y?" question, for example "How do I repeat commands in Unix?". Of course that can be a perfectly legitimate question, but often the person asking is missing an important concept: Unixish systems do not tightly bind the user interface to the system. That particular question is a user interface question, and the answer is (depending upon how much of an s.o.b. you want to be) "That has nothing to do with 'Unix'" or "That depends upon what shell you are using."

For old Unix and Linux hands, the unbinding is obvious: we have choices. We can choose our shells, our windows managers, even our filesystems. Windows users have much less choice, especially "out of the box". An XP system is a tightly bound system of tools - windows work the way windows work, there's one command line shell, and while there are three possible file systems, there's no reason to use the older types unless you are dual booting some ancient Windows or have old disks that need to be accessed.

So Windows users aren't prepared for choice. The same misunderstandings apply to naive Unix users who never understood that they had choices: a csh user suddenly transported to Linux bash may cry "How do I repeat commands in Linux?", a SCO user accustomed to DEL being his INTR character will complain "I can't get ping to stop!" (and a Windows user, accustomed to "ping" quitting by itself, will make the same complaint). None of them understand that it isn't "Linux" or "OS X" that is conspiring to confuse them: it's simply default choices that can be easily changed.

For those that arrived here from some Google search, Linux bash shell repeats commands with 'up arrow' and you'd stop "ping" with CTRL-C, but those are again defaults and might be different.

Windows users (and the naive Unix users, which might include many Mac OS X users) need to adjust their view of how things work. Some time ago I wrote New to Unix. That's helpful, but it doesn't necessarily point your brain in the direction it needs to go - it's not just substituting one set of rules for another (slashes vs. backslashes), it's understanding that a lot of this can be a matter of choice.

How do you know when it's choice and when you are stuck with it? Well, really, you are almost never "stuck"; whatever you need probably can be accomplished some way. The idea is to know what's trivial and what is not, and of course the more you understand about how your system really works, the easier it is to make that judgment. When you first have that "Aha!" moment where you realize that your gui and your shell are just programs that call upon services in the Unix kernel, you have learned a lot. It may still be hard to know when something is really "Unix" and when it is not, but generally you should realize that operating systems themselves do simple things: they read and write data, and not a lot more.

In other words, the operating system doesn't get involved with complicated stuff like editing a file: it just reads the bytes some editing program wants and writes them back to the file system when the editor tells it to. Most everything in between is up to the program you are using - that editor of course calls on the OS to get keystrokes and to send things to your screen, but most of what it does has little to do with the OS itself: with some adjustments, it could work quite happily on an entirely different operating system. Even that business of reading and writing the file system is a bit outside the operating systems real control: it passes off most of the responsibility to a file system driver, which is just a program added on to the base system.. a different program could be substituted and the system would still work as it always has.

For the same reasons, your operating system isn't concerned with legal file names, whether or not you can type both "lc" and "LC", how you stop a command from running (though actually stopping it is the operating systems job) or what colors are shown as the background. I suppose I could give hundreds of other examples, but it boils down to knowing how things work: if you understand that your car is out of gas, you don't expect it to start by hooking up to another car with jumper cables, right? But why do you know that? Because you have at least a rudimentary understanding of how cars work. If you did not, you might not realize the futility of getting a "jump" when your gas tank is empty.

The same is true for operating systems. The more you understand about how they work, the more you'll understand what you should be able to control easily.

Got something to add? Send me email.

(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> Unix shells and GUI's


Inexpensive and informative Apple related e-books:

Photos: A Take Control Crash Course

Take Control of Numbers

El Capitan: A Take Control Crash Course

iOS 8: A Take Control Crash Course

Photos for Mac: A Take Control Crash Course

More Articles by © Anthony Lawrence

Sun Mar 16 22:29:52 2008: 3847   anonymous

You just made a point that an Operating System is actually a kernel, while at the same time referring to Windows or Mac OS X (which include many things other than a kernel) as Operating Systems.

If you really want to avoid the k-word, you could at least be consistent and find another term for what Windows and Mac OS X are.

Mon Mar 17 09:54:46 2008: 3848   TonyLawrence

Well, no, that wasn't my point, and an operating system is not just a kernel. "Linux" by itself is just a kernel. "Ubuntu" is not.

But you are right: I was sloppy here differentiating between the kernel and the rest. This was mean as a very basic article; I didn't want to focus on that particularly, but still I should have been more careful.


Printer Friendly Version

Have you tried Searching this site?

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us

Printer Friendly Version

Software and cathedrals are much the same – first we build them, then we pray. (Sam Redwine)

Linux posts

Troubleshooting posts

This post tagged:




Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode