Welcome to Ubuntu Server – A Few Concepts and Commands to Get You Started

Ubuntu Server – Welcome to Ubuntu Server!

In this lesson, we’ll explore navigating the Ubuntu Server command line and using the help system.

I chose to start with a few commands and the help system, because you need that understanding to do much of anything in Linux Server.

That little blinking cursor waiting for input, with no visible help of any kind can be intimidating!

Have no fear.

You’ll be hopping around and entering commands in no time.

Most Used Commands

There are a few commands you’ll use over and over in a given day of Ubuntu Server administration. We’ll cover the top ones, as well as have a look at the help system that’s always available to you.

pwd

How do you know where you are in Ubuntu?

If you have your prompt set at default, the working directory is part of your prompt.

That’s changeable though. Also, if you’re several levels deep in the directory structure, it can become truncated.

To know where you are at any given time in Linux, you can type pwd for print working directory.

ls

If you want to see what’s in a directory, type ls, for list directory contents.

ls and some common options will be covered more shortly.

cd

To move from the directory you’re in to another, you use the cd command, for change directory.

Practice

For practice with the three commands you’ve learned so far, do the following:

  • Change directory to /etc
    • cd /etc
  • List the contents of the /etc directory
    • ls (ls with nothing entered after it will list the content of the present directory)
  • Print your working directory
    • pwd

Help

Well, look at that! Just three commands, and you can see where you are on the system, change to different directories, and list files.

What if, though, you wanted to see something other than what’s available by just typing ls in a directory?

For example, if you have many files listed, and aren’t sure what one you want, but you know the date it was created, how could you see that?

There are two types of help in Ubuntu that can assist you.

Linux Help

One is the —help system. (that’s two dashes or minus signs together).

Type ls —help and hit Enter.

From here on, I won’t say to hit Enter unless it’s unclear when you should do so. It will be implied.

Wow, the help scrolls by pretty quickly.

We’ll cover redirecting output with the pipe | in a later lesson. For now though, type ls —help | less.

This sends the output to a command called less, letting you scroll up and down to read the content.

When you enter a command in Linux, it can often be followed by an additional option that makes it behave differently.

These can be referred to as options, switches, or arguments.

Scrolling up a ways, you can see the -l (lower case l) option. It says it will display a long list format.

Hit q to quit using the less command.

Back at the prompt, type ls -l.

Now, you can see many fields, including the date the file was created.

Manual, or man pages

Linux’s —help system is unique to Linux, and may not be available on all Unix-like operating systems, and may not be available for all commands.

The more universally accepted way to find help in Linux is with the man pages.

Think of it as a huge stack of documentation, organized and made available to you by typing a quick command.

Type man ls.

The output is also a help system, but it’s formatted a little differently.

There’s the Name and what it does

A Synopsis telling you you could type ls options and a file name. The items in square brackets are optional.

and a Description with a sentence then a list of the options.

With some commands, like ls, there can be a huge number of options, so you may have to scroll around a bit to find the one you’re interested in.

You may also come across some you hadn’t though of that can be very useful.

When you’re done, you can type q to quit the man page.

So, now you know some commands to get you started, pwd, cd, and ls, and two ways to get help in Linux.

More Practice

Check out the man pages and help systems for the commands used in this lesson. What did you find when you tried to bring up the man page for the cd command? How about when you used —help?

Next, we’ll gain some understanding of what a shell is and what some more abut the BASH shell.