Basics Linux command tutorial

Although many Linux distributions nowadays offer great and powerful graphical user interface window (GUI) tools, Linux commands still proved to be very useful and efficient in certain circumstances. Not to mention, working in Linux terminal is fun, fast and a great way at learning Linux operating system.

Some Linux beginner might think that Linux commands are difficult to use. Well, every Linux users have been through that stage and the truth is after some times, many have swear not to live in graphical user interface any more. You can do so many things with Linux commands and when you realise how things work, that's when the fun begin.

Although some Linux distributions such as Ubuntu, openSUSE and Linux Mint do offer a fully desktop environment, other major distributions still booting into the terminal. Every Linux user has to learn at least a few basic important commands such as how to shut the system down, log off and get into the x-window system. If you are planning to install Linux servers, mastering Linux command is mandatory.

To use Linux command is easy. You have to be in the Linux command line terminal or just open one from kde or gnome or whatever x- window system if you are using a desktop Linux. You'll get a command prompt similar to ms-dos in windows. Before we begin, here's a basic Linux command guides:

As mention above, some Linux distributions boot into the Linux terminal. That's traditional and Slackware is one of them. Here is an example of Slackware Linux command line terminal:

Before login:

Slackware login page in terminal 4 screenshot image

After login:

luzar@slackware:~$

After you successfully login into Linux command line terminal, you'll see a similar window as the example above. That is the Linux command prompt. Here are what it means:

  • luzar - Current Linux user account (username).
  • slackware - Linux hostname.
  • ~ (tilde) - Current directory. ~ means home directory
  • $ - The prompt. By default, the dollar sign ($) represents normal user and the hash (#) is root.

The Linux command line variables in the Linux command line terminal maybe different depending on the shell used. Shell is the command line interface which also known as the command interpreter. There are many shells available such as c shell(csh) and korn shell(ksh) but the most common shell for Linux is bash. Bash which stands for Bourne again shell is a default shell for Slackware while Ubuntu using dash (the Debian Almquist Shell). So Linux commands discussed in basicconfig.com tutorials practically based on bash on Slackware examples and dash on Ubuntu command examples.

Understand basic Linux command

Basically, Linux command consists of the command itself, options and arguments. See an example below:

root@slackware:~# usermod -p Password luzar

Here are explanations of the command example above:

  • usermod - This is a Linux command.
  • -p Password - This is the command's option. The command options can be used to manipulate result or change the command's behaviour.
  • luzar - This is a generic argument. An argument can be anything. Normally it supports the command or the command's options.

Below are some basic rules of Linux command:

  • Linux command can be a single command and you can use it without issuing any option. But mostly, Linux command needs an option.
  • Linux command is case sensitive. That means, if the command is shutdown, you must type exactly like that, no upper case or mix upper and lower case such as SHUTDOWN or ShutDown.
  • There must be a space between the command and an option. Example: ls -l not ls-l.
  • The command options can be combine together. Example: ls -al.
  • Some commands need root privilege.

Alright, now that you knew the basics of Linux command, you can start learning the all commands available in Linux system. Here are step by step instructions:

  • Open Linux command prompt - Press ctrl+alt+F2 to open virtual terminal console 2. If you are using ubuntu desktop, click Applications, choose Accessories and click Terminal to open command prompt in x-window.
  • If you opened virtual terminal console, login as a normal user.
  • Now you can type any Linux command that you want to learn.

Wait, how do you know what command to type?

The best way to learn Linux command is by reading its manual page. You don't have to remember all the details in the manual page. Just read the commands meaning and description to learn what the command does. Let's see an example on how to do this.

From the command line terminal, type man a. Press tab key on your keyboard twice.

kucing@ubuntu:~$ man a Display all 126 possibilities? (y or n)

You'll get a message like in the example above. There are 126 Linux commands that start with the letter a. Do you want to display all of them? I have a better idea. Just answer n to the question above and try the example below (don't forget to press the tab key twice):

kucing@ubuntu:~$ man aa aa-audit aa_change_hat aa-enforce aa-logprof aa-unconfined aa-autodep aa-complain aa-genprof aa-status aaxine kucing@ubuntu:~$

Now we split all 126 Linux commands beginning with the letter a to smaller groups using a second letter. Let's continue and see how many commands start with the ab letter:

kucing@ubuntu:~$ man ab

When we type man aband press tab key twice, nothing happens. That means there is no command begin with ab letter. Let's try ac this time:

kucing@ubuntu:~$ man ac access.conf acl acpi_available acpi_listen accessdb aconnect acpid activate acct acpi acpi_fakekey activateCmosToken kucing@ubuntu:~$

There are all the commands start with letter ac. That's how we check what Linux command available in our Linux system. However, the commands maybe different between different Linux distributions. It also depends on what applications or programs installed in the Linux system.

In the example above, we have seen all the commands that begin with ac letter. Now type man command-name to see the details about a command. See example below:

kucing@ubuntu:~$ man acpi

Here is the result, the acpi manual page:

NAME acpi - Shows battery status and other ACPI information
SYNOPSIS acpi [options]
DESCRIPTION acpi Shows information from the /proc or the /sys filesystem, such as battery status or thermal information.
OPTIONS -b | --battery show battery information
-B | --without-battery suppress battery information
-a | --ac-adapter show ac adapter information

The basic manual page format as you can see in the example above shows 4 important topics:

  • NAME - The command's name and what it does.
  • SYNOPSIS - The command's syntax or format. It shows how to use the command.
  • DESCRIPTION - Explanation about the command.
  • OPTIONS - Available options that can be used with the command.

That's how we learn Linux commands. By the time you finished learning Linux command that starts with z letter, you have learned about 700 Linux commands. Don't worry too much about remembering all the commands. Maybe half of the commands mean nothing for a Linux beginner. You can find what commands you need to learn as a new user in the Linux commands section.

The Linux commands guide in basicconfig.com is made for Linux beginner. Each command is presented with simple explanation and practical with examples of the command in action. User will be introduced to the really basic Linux commands and how it is being used when working in the Linux command line terminal.

So for Linux enthusiasts whose just fall in love with it and want to learn more of Linux capability, then the Linux basic commands tutorial is the next destination for you. What you can find in this section is useful Linux commands used regularly by Linux users and system administrator to manage Linux system. The aim is by finishing this guides, user will be able to manage their system and has clear understanding on how Linux command works.

It's not necessary that Linux user must remember all these commands to work in Linux command line terminal. After all, Linux comes with a manual guides and you can always refer to that manual pages when you need help with particular Linux command. The man (manual) command is always there to guide you whenever you need help with Linux command. Linux is like a video game. The more you got into it, the more it suck you in. Today you learn a few commands that can do a few things, tomorrow you'll start installing and configuring new software and Linux tools. You'll never get bored with Linux. With its big potential, you know you have so many things to do. It is only a matter of time and without realizing it, Linux has been part of your life.

Comments

1

Great basics Linux command tutorial. This is really Linux command 101 for beginner. Easy to understand and exactly what I need. Thanks.

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.