The Linux Command Line Series: An Introduction To Linux Commands
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:
[[email protected] ~]$
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:
[[email protected] ~]$
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.
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.
- Linux Command Line: Introduction
- Linux Command Line: ls
- Linux Command Line: cd
- Linux Command Line: mkdir
- Linux Command Line: df
- Linux Command Line: ln
- Linux Command Line: top
- Linux Command Line: mount/umount
- Linux Command Line: Cron/Crontab
- Linux Command Line: chmod
- Linux Command Line: wget
- Linux Command Line: cat
- Linux Command Line: grep
- Linux Command Line: dd
- Linux Command Line: sudo
- Linux Command Line: startx
- Linux Command Line: adduser
- Linux Command Line: at
- Linux Command Line: aterm
- Linux Command Line: nano
- Linux Command Line: hostname