Command-line is used basically in Linux. This is the communication means between the user and the system. It’s a very complex tool. Each command has its own key unique option, therefore documentation is key when working with a Linux system.
There are many methods to get help from the Linux command lines such as man, help, and info but are only a few we will focus on here.
Built-in Help
When started with the –help parameter, most commands display some brief instructions about their usage. Instructions from –help parameter is rather brief as compared to others.
$help
GNU bash, version 5.0.17(1)-release (x86_64-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.
Man pages
Most commands provide a manual page or a ‘man page’. This documentation comes with the software and can be accessed with the man command. For example, man mkdir
$ man mkdir
This command opens the man page for Mkdir. You can navigate through using up and down arrow keys. To exit the man page press q for quiet.
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
Info pages
The info pages are usually more detailed than the man pages and are formatted in hypertext, similar to web pages on the internet.
$ info mkdir
Next: mkfifo invocation, Prev: ln invocation, Up: Special file types
12.3 ‘mkdir’: Make directories
==============================
‘mkdir’ creates directories with the specified names. Synopsis:
mkdir [OPTION]... NAME...
‘mkdir’ creates each directory NAME in the order given. It reports
an error if NAME already exists, unless the ‘-p’ option is given and
NAME is a directory.
The program accepts the following options. Also see *note Common
options::.
‘-m MODE’
‘--mode=MODE’
Set the file permission bits of created directories to MODE, which
uses the same syntax as in ‘chmod’ and uses ‘a=rwx’ (read, write
and execute allowed for everyone) for the point of the departure.
*Note File permissions::.
-----Info: (coreutils)mkdir invocation, 65 lines --Top--------------------------
Welcome to Info version 6.7. Type H for help, h for tutorial.
Locating Files
The locate command
The locate command searches within the database and then outputs every name that matches a given string.
$ locate note
The find command
The find command is used to search for files in the directories. Find searches a directory tree recursively. It does not maintain the database as locate command. Find requires the path to search.
Next article we will explore directories and listing of files in Linux