Living in the Linux Terminal: Introduction to the Terminal
This is a multi-part series on DevOps 101. Access the complete DevOps series by clicking HERE
Access the Living in the Linux Terminal: Having fun in the Terminal (Next post in the Living in the Linux Terminal) by clicking HERE
The Linux terminal is a text-based interface that allows you to control your Linux computer. It’s a powerful tool that can be used to do everything from managing files to running programs to administering your system.
The terminal is often called a shell, and it’s the way that you interact with the Linux kernel. The kernel is the core of the Linux operating system, and it’s responsible for managing all of the hardware and software on your computer.
When you open the terminal, you’ll see a prompt that looks something like this:


The prompt tells you who you are (username), the name of your computer (hostname), and the current directory (the $
symbol).
To run a command, you type it at the prompt and press Enter. For example, to list the contents of the current directory, you would type ls
and press Enter.
The terminal is a powerful tool, but it can be intimidating at first. However, there are a few basic commands that you should learn to get started.
ls
– Lists the contents of the current directory.cd
– Changes the current directory.pwd
– Prints the current working directory.mkdir
– Creates a new directory.rmdir
– Removes an empty directory.touch
– Creates a new file.cat
– Displays the contents of a file.man
– Displays the manual page for a command.
These are just a few of the many commands that you can use in the terminal. For more commands, please continue reading below.
What is a Linux Command?
A Linux command is a program or utility that runs on the command line. The command line is a text-based interface that allows you to interact with the Linux kernel. The kernel is the core of the Linux operating system, and it’s responsible for managing all of the hardware and software on your computer.
Linux commands are typically written in a single line of text, and they can be used to do a variety of tasks, such as:
- Managing files and directories
- Running programs
- Administering your system
- Accessing remote systems
- Scripting
There are many thousands of Linux commands available, and they can be quite complex. However, there are a few basic commands that you should learn to get started.
Here are some of the most common Linux commands:
ls
– Lists the contents of the current directory.cd
– Changes the current directory.pwd
– Prints the current working directory.mkdir
– Creates a new directory.rmdir
– Removes an empty directory.touch
– Creates a new file.cat
– Displays the contents of a file.man
– Displays the manual page for a command.
These are just a few of the many commands that you can use in the Linux terminal. For more commonly used commands, check out the following posts:
What is Command Argument?
A Linux argument is a piece of data that is passed to a command when it is executed. Arguments can be used to control the behavior of the command, or to provide input to the command.
For example, the ls
command can be used to list the contents of a directory. If you want to list the contents of the /etc
directory, you would type ls /etc
. The /etc
directory is the argument that is passed to the ls
command.
Arguments are typically separated by spaces. For example, the cat
command can be used to display the contents of a file. If you want to display the contents of the /etc/passwd
file, you would type cat /etc/passwd
. The /etc/passwd
file and the cat
command are the arguments that are passed to the cat
command.
Some commands have optional arguments. These arguments are not required, but they can be used to change the behavior of the command. For example, the grep
command can be used to search for a pattern in a file. The -n
option can be used to display the line number of each match. So, to search for the pattern “hello” in the /etc/passwd
file and display the line number of each match, you would type grep -n hello /etc/passwd
. The hello
pattern, the -n
option, and the /etc/passwd
file are the arguments that are passed to the grep
command.
Arguments can be any type of data, including strings, numbers, and directories. The type of data that an argument can be depends on the command that is being executed.
What is a Shell?
A shell is a computer program that exposes an operating system’s services to a human user or other programs. In general, operating system shells use either a command-line interface (CLI) or graphical user interface (GUI), depending on a computer’s role and particular operation.
Shells are actually special applications that use the kernel API in just the same way as it is used by other application programs. A shell manages the user– system interaction by prompting users for input, interpreting their input, and then handling output from the underlying operating system (much like a read–eval–print loop, REPL). Since the operating system shell is actually an application, it may easily be replaced with another similar application, for most operating systems.
There are many different types of shells available, each with its own strengths and weaknesses. Some of the most popular shells include:
- Bash (Bourne-Again Shell): The most popular shell on Linux and Unix systems.
- Zsh (Z Shell): A powerful shell with many features and customization options.
- Ksh (Korn Shell): A versatile shell that is often used for system administration tasks.
- Csh (C Shell): A shell that is popular on BSD systems.
The shell that you use will depend on your personal preferences and the needs of your system.
Here are some of the things that you can do with a shell:
- Run commands
- Manage files and directories
- Start and stop programs
- Configure your system
- Write shell scripts
Why Learn Command Line Interface?
There are many reasons why you should learn the Linux CLI. Here are a few of the most important reasons:
- It gives you more control over your system. With the CLI, you can do things that you can’t do with a GUI, such as configuring your system, managing files and directories, and starting and stopping programs.
- It’s faster and more efficient. Once you learn the basic commands, you can use the CLI to get things done much faster than you can with a GUI.
- It’s more portable. The CLI is the same on all Linux distributions, so you can learn it once and use it on any Linux system.
- It’s more powerful. The CLI gives you access to the full power of the Linux operating system.
In the old days, operating systems didn’t have GUIs. The only way to interact with the computer was through the CLI. So, if you wanted to do anything, you had to learn how to use the CLI.
Even though most operating systems have GUIs now, the CLI is still a valuable skill to have. It’s faster, more efficient, and more portable than a GUI. And, in some cases, it’s the only way to do certain things.
Windows vs Linux CLI
- PowerShell: PowerShell is a task-based command-line interface (CLI) that is specifically designed for system admins and is based on the .NET Framework. It is a more powerful CLI than the Windows Command Prompt and can be used to perform complex tasks.
- Bash: Bash is a command-line and scripting language for most Unix/Linux-based operating systems. It is a powerful CLI that can be used to do many things, such as managing files and directories, running programs, and configuring the system.
Here is a table that summarizes the differences between PowerShell and Bash:
Feature | PowerShell | Bash |
---|---|---|
Availability | Available on Windows | Available on Linux distributions |
Power | Powerful | Powerful |
Commands | Cmdlets | Commands |
Automation | Extensive | Extensive |
Object-oriented programming | Yes | No |
Syntax | Different | Similar |
If you are new to CLIs, I recommend starting with Bash. It is a simple CLI that is easy to learn. Once you are comfortable with Bash, you can learn PowerShell if you need a more powerful CLI.
Verdict
Are you new to Linux and looking to dive deeper into it? If so, the Linux Terminal is a powerful tool that can be used to interact with the Linux Kernel, manage files, run programs, and even configure your system. With a text-based interface, you can enter commands and get prompt responses, which makes the experience faster and more efficient than using a GUI. While it may seem intimidating at first, familiarizing yourself with a few basic commands can help you get started. Check out our comprehensive guide to Linux for DevOps or the Linux Command Set 2 for DevOps for a list of commonly used commands. Learning the Linux Terminal is a valuable skill that will give you more control, efficiency, and power in Linux computing.
More great stuff related to the terminal coming soon! Stay tuned and share and subscribe for more!
Access the Living in the Linux Terminal: Having fun in the Terminal (Next post in the Living in the Linux Terminal) by clicking HERE
This is a multi-part series on DevOps 101. Access the complete DevOps series by clicking HERE