Home Cd software What is the Linux command line and how do you use it?

What is the Linux command line and how do you use it?

0


On most Linux computers, you have the ability to open a window and type commands that tell your machine to do things. Sometimes when your computer starts up or something freezes, this text-based interface takes up your entire screen.

This is the Linux command line. It’s older than the various desktop interfaces, but there’s a reason it’s still around and widely used. A lot of people swear by it.

A brief history of the command line

The interface you use to view and interact with an operating system, whether textual or graphical, is called a shell. The earliest shells were text-based. This is because the first electronic computers were not household appliances. Instead, they were giant mainframe computers that took up entire rooms.

Back then, computing power was quite low and network connections were slow. You can store very many files, and many users can simultaneously connect to a system over a very slow connection when you are only working with text.

In 1969, Dennis Ritchie and Ken Thompson of Bell Labs developed the Unix operating system, one of the first mainframe operating systems to be widely adopted.

Unix operated on mainframes as a shared system, with people interacting with the computer from individual terminals consisting only of a keyboard and screen. Users did everything from creating and browsing files to transmitting data by typing commands using a shell, which the mainframe then interpreted.

If something goes wrong, a system administrator can check through a console, a dedicated text entry, and a display device used for system-related messages such as BIOS, bootloader, or kernel messages. Linux is a Unix-like system which reproduces much of the functionality of Unix, but as free software available to everyone.

The Thompson shell (written by Ken Thompson) was the initial shell for Unix, but a replacement came from Stephen Bourne in 1979, known as the Bourne shell. In 1989, Brian Fox created the Bourne Again shell (bash for short) as free software replacing the Bourne shell as part of the GNU Project. This is the default shell for most Linux operating systems.

So, we have several of the names that are still in common use for the command line today: command line, shell, terminal, console, and bash.

How to use the Linux command line

linux command line gnome terminal

To get started, all you need to do is click on the command line application for your Linux distribution. For many, the name is simply “Terminal.” This is because the applications are essentially modern virtual versions of the first Unix terminal.

A blank terminal window doesn’t seem to display much, but it does give you three pieces of information: your username, hostname (either your local PC or a remote server), and your current directory (by default, your personal file, indicated by a ~). The $ marks the end of the prompt.

When you type a command in the terminal and press Enter, results often appear instantly. Many basic commands are short, such as the cd command to change directories, ls to list the files in the current directory, or rm to delete a file.

Most of the commands follow standard syntax. The formula goes like this:

command option target

The target is often a file or a folder. Here is an example using the ls command:

ls -a Downloads

In the above-mentioned excerpt, ls is the command, -a is the option, and Downloads is the folder that your target command is.

So what is this command for? Well, by default ls lists all visible files in your current directory. The -a The option tells ls to show hidden files or folders as well. The target directory Downloads tells ls to list the files in the Downloads folder rather than the folder you are currently working in.

There are countless command line programs, many of which come preinstalled by default. If you’re ready to get started, check out our Linux command line cheat sheet.

Why could you use the command line today?

Some tasks are just faster on the command line. One use case that many long-time Linux users share is software management. If you know the exact name of an app you want, typing the install command in a terminal is faster than opening a Linux app store. That’s not to say that Linux app stores are slow.

Type a apt Where dnf Ordering is faster than using any app store, including those on Windows, macOS, Android, or iOS. The command line also tends to provide more information in the process.

The command line offers quick ways to perform very specific tasks that you repeat periodically, such as cloning a hard drive or renaming a large number of photos. There are graphics apps that do these things, but if you do the task the same every time, just entering a single command can save you time. You can even automate these tasks by writing a script.

Some commands launch what looks like full applications that run in the terminal, such as the High command which can replace your graphics system monitor tool.

linux command line top system monitor terminal

Knowing your way around a terminal also expands the type of hardware you know how to use. For example, you can set up your own server, at home or remotely. Maybe you decide to turn a Raspberry Pi or an old laptop you have into a home media server or your own cloud storage device.

And if for some reason you find yourself faced with a computer that won’t boot, knowing the command line increases the chances that you can fix your system on your own without having to reinstall your operating system.

Does Linux require the command line?

At this point, you no longer need to familiarize yourself with the command line to use Linux. Due to the desktop environments and available applications, Linux is as easy to use as any other operating system, if not easier.

But while learning the command line isn’t necessary, it does have its advantages. And if you fall deeply in love with the terminal, you can install a program such as Tmux which allows you to run and view multiple commands simultaneously.


multitasking-linux-terminal

The essential Tmux commands cheat sheet

Read more


About the Author


LEAVE A REPLY

Please enter your comment!
Please enter your name here