Get started Bring yourself up to speed with our introductory content.

Work a command-line interface in Linux with these permissions and prompts

The command-line interface is an integral part of the Linux management environment. With sudo permissions and remote connectivity, working with a command line is easy.

To properly use a command line in Linux, you must consider two factors: if you need sudo permissions and what commands...

you want to use. The answers depend on the scale of your operations, what permissions you already have and what changes you'll make in your role.

We'll start with how to connect to Linux. If you're sitting behind a physical Linux machine, connecting is easy, but what about machines that need to be accessed from a distance? Next, you'll learn when to use superuser privileges, and in which cases you shouldn't, and you'll read a bit about working with commands.

The first step to using a command-line interface in Linux is to connect to a server. Many Linux servers run as cloud instances or virtual machines. As a result, you might not see a login prompt on the console you want to connect to; you might need to make a remote connection. If your Linux machine is hosted in a cloud or in a data center, you'll need to connect with Secure Shell (SSH).

Using SSH is easy from a Mac or Linux computer. Simply open a terminal and type the SSH command, followed by username@servername. On a Windows computer, you must first install software that makes the SSH connection for you, such as MobaXterm or PuTTY.

Which user?

You need a username to connect remotely to Linux. Every Linux computer has a user account with the name root, but you shouldn't use this account; it poses a threat to application setups that run with non-administrative privileges. It also complicates tracking session activity, so if a malfunction does occur, it is difficult to identify where the error occurred. The root user is also referred to as the almighty user because it has no restrictions.

On Windows, there is no equivalent to the Linux root user; a Windows Administrator account is limited in its capabilities. To connect to a command-line interface in Linux on Windows, you'll need access to the user account from whoever installed the machine.

Once you have the username and password, you should be able to open a login session to your Linux machine as an ordinary user.

Using sudo with a command-line interface in Linux

If you're on Ubuntu, administrative tasks run through sudo, which implements system-wide changes. For instance, instead of typing useradd linda, you'd use the command sudo useradd linda. Sudo commands do have one requirement though: The account needs sudo privileges.

To run ordinary prompts with a command-line interface in Linux, you don't need specific permissions.

On Ubuntu, the first user that was created has sudo privileges. On Red Hat, the account you use needs to be a member of the wheel group. You can get these permissions from your server administrator if you don't already have them.

To run ordinary prompts with a command-line interface in Linux, you don't need specific permissions, but you must know what each command does, which is challenging. Hundreds of commands are typically available, and each has multiple command-line options. For new Linux console users, this presents a steep learning curve. However, you can build a knowledge base with programming courses, reference sheets and online forums.

If you need more information about a command, you can read its documentation using man, followed by the command. For instance, type man useradd to get a full description of how to use the useradd command, and type q to leave the man page. Documentation in man exists for nearly all of the commands, and it is an excellent informational resource built into the Linux command-line interface.

This was last published in June 2018

Dig Deeper on Data center server infrastructure and OSes

Join the conversation

4 comments

Send me notifications when other members comment.

Please create a username to comment.

What Linux commands do you find most useful?
Cancel
That depends on the task at hand...  for example if I'm looking at storage resources, I use "du", "df" and "ls"  to find what's consuming space on my file systems.  There are a ton of options to these commands which make them quite useful.  Which brings up two additional commands...  "man" and "info" :)
These command are basically your online help/manuals for example "man ls" or "info ls"
Cancel
Most useful commands for me are, ssh, htop, tmux/screen/byobu, apt-get, yum, arp, grep, more/less, and any in house bash scripts I've created.
Cancel
This is an interesting question. What is the task at hand?

I find ssh, sudo, vi, crontab, the assorted LVM commands, PATH statements, find, grep, mailx, route, various text manipulation tools like cut and tr to be what I use often, but I haven't installed my Fedora environment yet and don't know what I'll be using as I explore RHEV.
Cancel

-ADS BY GOOGLE

SearchWindowsServer

SearchServerVirtualization

SearchCloudComputing

Close