How to use help command in linux

Getting your Trinity Audio player ready...

How to use help command in Linux

In this article, we are going to discuss how to use help command in linux. We will see various ways how you can use the help option while navigating with shell or prompt in Linux. 

help command in linux

$ help
GNU bash, version 4.3.28(1)-release (i686-pc-linux-gnu)
These shell commands are defined internally. Type `help' to see this list.
Type `help name' to find out more about the function `name'.
Use `info bash' to find out more about the shell in general.
Use `man -k' or `info' to find out more about commands not in this list.

A star (*) next to a name means that the command is disabled.

job_spec [&] history [-c] [-d offset] [n] or history -anrw [filename] or histor>
(( expression )) if COMMANDS; then COMMANDS; [ elif COMMANDS; then
COMMANDS; ]... [>
. filename [arguments] jobs [-lnprs] [jobspec ...] or jobs -x command [args]
: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill>
[ arg... ] let arg [arg ...]
[[ expression ]] local [option] name[=value] ...
alias [-p] [name[=value] ... ] logout [n]
bg [job_spec ...] mapfile [-n count] [-O origin] [-s count] [-t] [-u fd] 
[-C callbac> bind [-lpsvPSVX] [-m keymap] [-f filename] [-q name] [-u name]
[-r > popd [-n] [+N | -N] break [n] printf [-v var] format [arguments]
builtin [shell-builtin [arg ...]] pushd [-n] [+N | -N | dir] caller [expr] pwd [-LP]
case WORD in [PATTERN [| PATTERN]...) COMMANDS ;;]... esac read [-ers]
[-a array] [-d delim] [-i text] [-n nchars] [-N nchars> cd [-L|[-P [-e]] [-@]] [dir]
readarray [-n count] [-O origin] [-s count] [-t] [-u fd] [-C callb>
command [-pVv] command [arg ...] readonly [-aAf] [name[=value] ...] or readonly
-p
compgen [-abcdefgjksuv] [-o option] [-A action] [-G globpat] [-W w> return [n]
complete [-abcdefgjksuv] [-pr] [-DE] [-o option] [-A action] [-G gl> select 
NAME [in WORDS ... ;] do COMMANDS; done
compopt [-o|+o option] [-DE] [name ...] set [-abefhkmnptuvxBCHP]
[-o option-name] [--] [arg ...] continue [n] shift [n]
coproc [NAME] command [redirections] shopt [-pqsu] [-o] [optname ...]
declare [-aAfFgilnrtux] [-p] [name[=value] ...] source filename [arguments]
dirs [-clpv] [+N] [-N] suspend [-f]
disown [-h] [-ar] [jobspec ...] test [expr]
echo [-neE] [arg ...] time [-p] pipeline
enable [-a] [-dnps] [-f filename] [name ...] times
eval [arg ...] trap [-lp] [[arg] signal_spec ...]
exec [-cl] [-a name] [command [arguments ...]] [redirection ...] true
exit [n] type [-afptP] name [name ...]
export [-fn] [name[=value] ...] or export -p typeset [-aAfFgilrtux] [-p] name
[=value] ...
false ulimit [-SHabcdefilmnpqrstuvxT] [limit]
fc [-e ename] [-lnr] [first] [last] or fc -s [pat=rep] [command] umask [-p] [-S]
[mode]
fg [job_spec] unalias [-a] name [name ...]
for NAME [in WORDS ... ] ; do COMMANDS; done unset [-f] [-v] [-n] 
[name ...] for (( exp1; exp2; exp3 )); do COMMANDS; done until COMMANDS;
do COMMANDS; done
function name { COMMANDS ; } or name () { COMMANDS ; } variables - Names
and meanings of some shell variables getopts optstring name [arg] wait [-n] 
[id ...] hash [-lr] [-p pathname] [-dt] [name ...] while COMMANDS; do 
COMMANDS;done
help [-dms] [pattern ...] { COMMANDS ; }

ls command in linux

ls command in linux is one of the most versatile commands which is extremely important in terms of navigation through shell prompt. It has an extensive list of switches associated with it.

$ls --help
Usage: ls [OPTION]... [FILE]...
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort.
Mandatory arguments to long options are mandatory for short options too.
-a, --all do not ignore entries starting with .
-A, --almost-all do not list implied . and ..
--author with -l, print the author of each file
-b, --escape print octal escapes for nongraphic characters
--block-size=SIZE use SIZE-byte blocks. See SIZE format below
-B, --ignore-backups do not list implied entries ending with ~
-c with -lt: sort by, and show, ctime (time of last
modification of file status information)
with -l: show ctime and sort by name
otherwise: sort by ctime
-C list entries by columns
--color[=WHEN] colorize the output. WHEN defaults to `always'
or can be `never' or `auto'. More info below
-d, --directory list directory entries instead of contents,
and do not dereference symbolic links
-D, --dired generate output designed for Emacs' dired mode
-f do not sort, enable -aU, disable -ls --color
-F, --classify append indicator (one of */=>@|) to entries
--file-type likewise, except do not append `*'
--format=WORD across -x, commas -m, horizontal -x, long -l,
single-column -1, verbose -l, vertical -C
--full-time like -l --time-style=full-iso
-g like -l, but do not list owner
--group-directories-first
group directories before files.
augment with a --sort option, but any
use of --sort=none (-U) disables grouping
-G, --no-group in a long listing, don't print group names
-h, --human-readable with -l, print sizes in human readable format
(e.g., 1K 234M 2G)
--si likewise, but use powers of 1000 not 1024
-H, --dereference-command-line
follow symbolic links listed on the command line
--dereference-command-line-symlink-to-dir
follow each command line symbolic link
that points to a directory
--hide=PATTERN do not list implied entries matching shell PATTERN
(overridden by -a or -A)
--indicator-style=WORD append indicator with style WORD to entry names:
none (default), slash (-p),
file-type (--file-type), classify (-F)
-i, --inode print the index number of each file
-I, --ignore=PATTERN do not list implied entries matching shell PATTERN
-k like --block-size=1K
-l use a long listing format
-L, --dereference when showing file information for a symbolic
link, show information for the file the link
references rather than for the link itself
-m fill width with a comma separated list of entries
-n, --numeric-uid-gid like -l, but list numeric user and group IDs
-N, --literal print raw entry names (don't treat e.g. control
characters specially)
-o like -l, but do not list group information
-p, --indicator-style=slash
append / indicator to directories
-q, --hide-control-chars print ? instead of non graphic characters
--show-control-chars show non graphic characters as-is (default
unless program is `ls' and output is a terminal)
-Q, --quote-name enclose entry names in double quotes
--quoting-style=WORD use quoting style WORD for entry names:
literal, locale, shell, shell-always, c, escape
-r, --reverse reverse order while sorting
-R, --recursive list subdirectories recursively
-s, --size print the allocated size of each file, in blocks
-S sort by file size
--sort=WORD sort by WORD instead of name: none -U,
extension -X, size -S, time -t, version -v
--time=WORD with -l, show time as WORD instead of modification
time: atime -u, access -u, use -u, ctime -c,
or status -c; use specified time as sort key
if --sort=time
--time-style=STYLE with -l, show times using style STYLE:
full-iso, long-iso, iso, locale, +FORMAT.
FORMAT is interpreted like `date'; if FORMAT is
FORMAT1<newline>FORMAT2, FORMAT1 applies to
non-recent files and FORMAT2 to recent files;
if STYLE is prefixed with `posix-', STYLE
takes effect only outside the POSIX locale
-t sort by modification time
-T, --tabsize=COLS assume tab stops at each COLS instead of 8
-u with -lt: sort by, and show, access time
with -l: show access time and sort by name
otherwise: sort by access time
-U do not sort; list entries in directory order
-v natural sort of (version) numbers within text
-w, --width=COLS assume screen width instead of current value
-x list entries by lines instead of by columns
-X sort alphabetically by entry extension
-1 list one file per line
SELinux options:
--lcontext Display security context. Enable -l. Lines
will probably be too wide for most displays.
-Z, --context Display security context so it fits on most
displays. Displays only mode, user, group,
security context and file name.
--scontext Display only security context and file name.
--help display this help and exit
--version output version information and exit

SIZE may be (or may be an integer optionally followed by) one of following:
KB 1000, K 1024, MB 1000*1000, M 1024*1024, and so on for G, T, P, E, Z, Y.
Using color to distinguish file types is disabled both by default and
with --color=never. With --color=auto, ls emits color codes only when
standard output is connected to a terminal. The LS_COLORS environment
variable can change the settings. Use the dircolors command to set it.
Exit status:
0 if OK,
1 if minor problems (e.g., cannot access subdirectory),
2 if serious trouble (e.g., cannot access command-line argument).

Report ls bugs to [email protected]
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
For complete documentation, run: info coreutils 'ls invocation'
$ cd --help
Usage: cd [ options ] [directory]
Or: cd [ options ] old new
OPTIONS
-L Handle each pathname component .. in a logical fashion by moving up one 
level by name in the present working directory.
-P The present working directory is first converted to an absolute pathname
that does not contain symbolic link components and symbolic name 
components are expanded in the resulting directory name.

ls -d command in linux

$ ls -d
.
If used with -d option it will not show the contents of directory.While
with -D it will display contents.
$ ls -D
1 cgroup etc InMageAgent4516 InMageAgent6561 media opt sbin 
tmp var apps core.20311 export InMageAgent5529 lib misc proc 
selinux tmp_install bin dbdumps home InMageAgent5536 lib64 
mnt root srv tools boot dev InMageAgent5540 lost+found net
samba-test sys usr

whatis command in linux with examples

$whatis
usage: whatis keyword ...
$whatis ls
ls (1) - list directory contents
ls (1p) - list directory contents
$whatis cat
cat (1) - concatenate files and print on the standard output
cat (1p) - concatenate and print files
rraiop@dc2nix2d223$whatis ls
ls (1) - list directory contents
ls (1p) - list directory contents

man command in linux

There is another very good option to take help for any commands in linux is the man command in Linux. These are called man pages in the linux world. syntax of man command in linux is as below.

$ man mkdir
MKDIR(1) User Commands MKDIR(1) NAME
mkdir - make directories
SYNOPSIS
mkdir [OPTION]... DIRECTORY...
DESCRIPTION
Create the DIRECTORY(ies), if they do not already exist.
Mandatory arguments to long options are mandatory for short options
too.
-m, --mode=MODE set file mode (as in chmod), not a=rwx - umask
-p, --parents no error if existing, make parent directories as needed
-v, --verbose print a message for each created directory
-Z, --context=CTX set the SELinux security context of each created 
directory to CTX
When COREUTILS_CHILD_DEFAULT_ACLS environment variable is
set, -p/p --parents option respects default umask and ACLs, as it does
in Red Hat Enterprise Linux 7 by default.
--help display this help and exit
--version output version information and exit.

That`s it about how to use help command in Linux. I guess you will find all related options like help, man,whatis, and –help options with any commands handy while navigating through shell/bash prompt.

Conclusion 

Linux is the leading operating system that is ruling and keeps evolving day by day as it is open source. The range of Linux commands and associated switches are too vast. Once you start exploring you will come to know new options with each linux command and many other helping linux commands.

Comments

  1. Pingback: What is Linux ? | RSY DIGITAL WORLD

Leave a Reply