Get Some Help With Linux Commands

There are two things (that I know of) you can do in Linux to get some help with the commands in the terminal.

Use man command

This gives you a manual page for your command. The syntax is

man <command>

For example, if I want to see the manual for cd command, I would enter

man cd

The out put would be everything I need to know about cd, what it is what it does, its options, who made it…

Once you are done with reading the manual, and you want to quit, hit

Esc or q

Use –help

When you try to execute a command in the wrong way, Linux usually suggest you to try –help. Do that, sometimes it works and what it gives you is similar to what the man command would give you. For example

sudo --help

The input above will give you all options available for sudo command without any explanation or lengthly credits and copy right statements. The output looks like this, short and to the point.

ma65p@ma65p-laptop:~$ sudo –help
sudo: please use single character options
usage: sudo -h | -K | -k | -L | -l | -V | -v
usage: sudo [-bEHPS] [-p prompt] [-u username|#uid] [VAR=value]
{-i | -s | }
usage: sudo -e [-S] [-p prompt] [-u username|#uid] file …

But if you enter

man sudo

then the output looks like this

SUDO() MAINTENANCE COMMANDS SUDO()

NAME
sudo, sudoedit – execute a command as another user

SYNOPSIS
sudo -h | -K | -k | -L | -l | -V | -v

sudo [-bEHPS] [-a auth_type] [-c class|-] [-p prompt] [-u username|#uid] [VAR=value] {-i | -s | command}

sudoedit [-S] [-a auth_type] [-c class|-] [-p prompt] [-u username|#uid] file …

DESCRIPTION
sudo allows a permitted user to execute a command as the superuser or another user, as specified in the sudoers file. The real and effective uid and gid are set to match those of the target user as specified in the passwd file and the group vector is initialized based on the group file (unless the -P option was specified). If the invoking user is root or if the target user is the same as the invoking user, no password is required. Otherwise, sudo requires that users authenticate themselves with a password by default (NOTE: in the default configuration this is the user’s password, not the root password). Once a user has been authenticated, a timestamp is updated and the user may then use sudo without a password for a short period of time (15 minutes unless overridden in sudoers).

When invoked as sudoedit, the -e option (described below), is implied.
Manual page sudo() line 1

Last words

I’m sure some of you have been using one or two Linux command regularly. For me, I use top and cd the most. There are many commands in Linux that are fun and useful. For instance, some of you might have know the fortune command that gives you random fortune and jokes, some of which are not too bad. Using terminal and command could be painful sometimes because there is no way we know all those commands in Linux, there are hundreds of them, and each have a dozen different options, one of which could be fatal to our system (and ourselves). The key to avoid a disaster is to know what we are doing, and linux offers some great help. No, not the Ubuntu forum, you have to wait for someone to answer. No, not google, what if your internet is not working?. The commands above will help you sometimes in the future and it is a great tool to learn what you are doing.

Advertisements