This is part of the tutorial on UNIX Commands.

# What the heck is a UNIX command line?

Nowadays, most unices (that's the multiple of "unix") are shipped with a graphical user interface (GUI) and a window manager like Gnome or KDE. If you want to use UNIX as a desktop, e.g. for writing documents or surfing the internet, you're probably just fine with the tools offered with the desktop. You can easily explore your files in a file browser and start all of your applications (such as an office suite or a web browser) from the menus provided by the desktop environment.

But once you want to do a bit more with your machine, you'll have to reside to a command line interface, that puts you right at the controls of your operating system. From such a command line, you can enter commands with your keyboard, and ask your computer to issue the commands and thus do useful stuff with your operating system. People familiar with DOS are probably familiar with such a command line. It allows you to browse your file system, let's you copy and move files around in your file system, but you can also start programs from the command line.

## Getting a command line

There are two possible options to log on to a UNIX system. A first option is that you get a command line to start with. If this is the case, you're all set to start experimenting with the commands I'll be explaining in this tutorial.

Another option is that you get a graphical user interface, and it's not possible to type in any commands when viewing the desktop. If this is the case, look in the menus where you can find all applications that come with the opertaing system. Look for an application called terminal, terminal emulator, term, xterm, console or something similar. Under Redhat linux desktops, you can find a terminal under the system tools menu.

Once the terminal or terminal emulator is started, you get a text window in which you get a command line. In the top left corner, something like [johndoe@dyn-058234 johndoe]$ is displayed, and you can type stuff from your keyboard. If you randomly type something from your command line and press enter, chances are that the command line returns you with a command not found message or something similar. We're first going to inspect what the message [johndoe@dyn-058234 johndoe]$ is all about. The first johndoe means that you are user johndoe who is working on the system. In my case, the system is called dyn-058234, and that is exectly what is shown as a second part of the message. The last part, which is also johndoe, tells me in what directory I currently am. As a default, most systems create a directory for each of its users, with the same name as the user's login. We'll learn more about this in the following parts.

Chances are that you only see something like johndoe\$ or something similar as the initial message. If this is the case, than this denotes the directory you're currently residing in, and your command line doesn't tell you anything about which user you are and which machine you're logged on to. This is not bad, it can differ from machine from machine, it's just a way of telling you who and where you are, but it won't influence how you can issue commands at the command line.

## What a command usually looks like

A command is usually split up into a couple of parts, and depending on the program, or the implementation of the program, the command may look different. Most commonly, a command is split up into the command itself, and a couple of parameters that need to be passed to the command. The command and its parameter are usually seperated with a space, but more than one space, or a tab, or a combination of these are allowed too.

A parameter that needs to be passed to a command usually starts with a dash (-) or two dashes (--), depending on the command and the parameters. Other parameter can be files or strings that need to be passed to the command, also depending on the command that is being issued. We'll see plenty of different types of commands an their parameters in this tutorial. this may all sound a bit vague, but about everything is possible. The main thing you'll have to remember is that you issue a command by typing in the command, and put the parameters behind it, seperated by a space.

Here are some examples of commands we'll be using in the following section:

pwd
ls -al
cd ..
grep hello file

## What is so special about UNIX commands?

The cool, and at first daunting thing about UNIX is that there are hundreds of small commands available. This is daunting, as it takes some time to get used to all of the commands. The cool thing is that all of these commands can do a very small task, and it is very easy to combine these little commands to do something special and more complex. As this tutorial progresses, you'll see how the command can be used to do useful things with your operating system in order to obtain all kinds of information from your system.