5 terminal commands every Linux newbie should know – PCWorld

I’m a big fan of the anime series Neon Genesis Evangelion. One of the quotes from it that stands out in my head is, “Man fears the darkness, and so he scrapes away at the edges of it with fire.” For newcomers to the world of Linux, the black screen of the terminal can seem like a deep, foreboding darkness, which is desperately replaced by a GUI whenever possible. It doesn’t have to be that way.

A graphical user interface makes modern computing more enjoyable and easier to use the majority of the time. After all, placing an Amazon order using a text-mode browser in a terminal sounds like an over-enthusiastic exercise in masochism. We like our GUIs and graphical browsers, but there are times when you’ll find yourself in the world of the command line. Like any new tool, knowing a few basics can keep your blood pressure in check when a GUI fails to start, or you need to perform maintenance.

For starters, here are five commands you should become comfortable with as a Linux user.

1. sudo

If there is one command that should be treated with equal parts certainty and respect, it’s sudo. Sudo’s effect is quite simple: It runs any command that follows it with superuser (or root) privileges. Running commands with sudo is necessary when doing things like updating the system or changing configuration files.

sudo in action

Since /mnt is owned by root, you have to use sudo to create a directory in /mnt.

Sudo also gives the user the power to destroy a system or violate the privacy of other users. This is why you’ll see the following lecture the first time you use sudo on a system:

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

1)Respect the privacy of others.
2)Think before you type.
3)With great power comes great responsibility.

If you’re looking to edit or change any file that’s outside of your user’s home directory, there’s a good chance you’ll have to use sudo to do it. To be able to use sudo, your user needs to be in the sudoers file or part of a superuser group (usually “wheel” or “sudo”). Ubuntu offers a great guide on the sudoers file.

sudoers file

A look at a typical sudoers file, where the groups that allow root access are specified. It is very unwise to allow sudo access to a user or group without requiring a password.

Since sudo carries so much power, it goes without saying that you should not type it before a command if you don’t know what the command does. There’s an old prank online that instructs newbies to type sudo rm -R /. (Don’t do this.) The command recursively deletes every file on your system, and your OS will happily do it without further prompting. As the lecture file says, when using sudo, “think before you type.”

2. Your package manager tools (yum, apt, or pacman)

The number one reason you’ll be using sudo is to add or remove programs from your PC via your package manager. Although the three major package managers I mention here all differ in their respective command arguments and grammar, they are all capable of the same three basic functions: installing a package, removing a package, and upgrading all the packages on the system. (Note: Unless you’re logged in as root, you will need to prepend these commands with sudo.)

Comments

Write a Reply or Comment:

Your email address will not be published.*