The Linux Command Line Series: An Introduction To Linux Commands

The Linux Command Line Series: An Introduction To Linux Commands
Page content

What is the command line?

The command line is a tool that’s been around since the very earliest days of computing. Basically it is a terminal window that allows you to enter commands that are executable files that serve a purpose. Those commands can be as simple as the ls command that lists files in a directory or as complex as the iptables command that help create firewall chains for security. The command line is very basic but can do incredibly complex tasks (as well as simple tasks). At the heart of the command line is the prompt. In Linux the common prompt is the Bash prompt. Bash is an open source UNIX shell that stands for Bourne-again Shell (which is a pun on the earlier Bourne shell). The Bash prompt will look something similar to this:

[jlwallen@localhost ~]$

This default prompt gives you two pieces of information:

  • jlwallen = the username that is currently using the prompt.
  • @localhost = the name of the machine the user is logged into.

Obviously what this indicates is that the command line can be run on either a local machine (in this case localhost) or a remote machine. A remote prompt might look something like this:

[root@192.168.1.10 ~]$

The above prompt tells me that I am currently the root user logged into machine 192.168.1.10.

If you are running a Linux installation, you have Bash and the command line interface.

Using the command line

The first thing you have to do, in order to use the command line is to open up a terminal. Terminals come in all sorts of flavors: konsole, gnome-terminal, aterm, eterm, rxvt, etc.. To open up a terminal window you simply need to look to your desktops’ start menu. Within that menu you will typically find a terminal under the System submenu. The entry you are most likely looking for is Terminal.

Once the terminal window is open you will see the bash prompt where you can begin to enter commands. Now, unlike the DOS command (which is used in Windows) you do not have to be in the directory where the command is in order to run it. In Linux there are directories that give users global access to commands. This allows you to enter the ls command within any directory and you will get back the contents of that directory. The /usr/bin directory is one of those directories that give users global access. Another directory, /usr/sbin, is a directory that allows only the root user access (global) to its commands. So in order to run the useradd command (a command to add a user to the system) you have to have to be the root user. To become the root user you have to know the root user password. We’ll discuss more on root access later on in the series.

Terminal windows

The gnome-terminal running the top command.

Final Thoughts

You have now been introduced to the Linux command line. As this series continues we will take a look at some of the various commands you can use in this terminal. You will begin to see just how powerful the CLI really is.

This post is part of the series: Linux Command Line

If you ever plan on doing any administration on a Linux machine, you would be well served to get to know the command line interface. In this Bright Hub series you will be introduced to various concepts surrounding one of the most powerful admin tools around.

  1. Linux Command Line: Introduction
  2. Linux Command Line: ls
  3. Linux Command Line: cd
  4. Linux Command Line: mkdir
  5. Linux Command Line: df
  6. Linux Command Line: ln
  7. Linux Command Line: top
  8. Linux Command Line: mount/umount
  9. Linux Command Line: Cron/Crontab
  10. Linux Command Line: chmod
  11. Linux Command Line: wget
  12. Linux Command Line: cat
  13. Linux Command Line: grep
  14. Linux Command Line: dd
  15. Linux Command Line: sudo
  16. Linux Command Line: startx
  17. Linux Command Line: adduser
  18. Linux Command Line: at
  19. Linux Command Line: aterm
  20. Linux Command Line: nano
  21. Linux Command Line: hostname