
Linux Basics – man and mkdir

The Linux man command is one of the lesser known helpers for those new to Linux. Typing in ‘man find’ give you a whole manual page on the ‘find’ command and this is what ‘man’ is short for – Manual.
Let us see part of the ‘man find’ command and its output:
FIND(1) General Commands Manual FIND(1) NAME find - search for files in a directory hierarchy SYNOPSIS find [-H] [-L] [-P] [-D debugopts] [-Olevel] [starting-point...] [expression] DESCRIPTION This manual page documents the GNU version of find. GNU find searches the directory tree rooted at each given starting-point by evaluating the given expression from left to right, according to the rules of precedence (see section OPERATORS), until the outcome is known (the left hand side is false for and operations, true for or), at which point find moves on to the next file name. If no starting-point is specified, `.' is assumed. If you are using find in an environment where security is important (for example if you are using it to search directories that are writable by other users), you should read the `Security Considerations' chapter of the findutils documentation, which is called Finding Files and comes with findutils. That document also includes a lot more detail and discussion than this manual page, so you may find it a more useful source of information. OPTIONS The -H, -L and -P options control the treatment of symbolic links. Command-line arguments following these are taken to be names of files or directories to be examined, up to the first argument that begins with `-', or the argument `(' or `!'. That argument and any following arguments are taken to be the expression describing what is to be searched for. If no paths are given, the current directory is used. If no expression is given, the expression -print is used (but you should probably con‐ sider using -print0 instead, anyway). This manual page talks about `options' within the expression list...........etc,etc
The actual entry continues for quite a bit.
Searching the Linux man entry
Searching for a keyword in a manual entry is the same syntax as ‘vi’ – type a forward slash (/) followed by the search string and then press enter. You can jump to the next entry found by pressing ‘n’.
Searching for a term across ALL man pages is accomplished by using man -k [search string]. You could even go so far as to type ‘man man’ to get instructions on the Linux man command! This is actually a good place to start as the structure of the ‘man’ system is explained here and makes the ‘man’ system a bit easier to understand.
Linux man can be invoked for all the standard Linux commands, but some extra software or custom written commands may not have Linux man entries.
Remember: Linux man is your helper – no need to always use Google.
The mkdir command
Creating a directory is pretty easy. The command we are after is mkdir which is short for Make Directory. In the most basic form, we can type ‘mkdir [mynewdirectory] and the new directory will be created in our current directory (pwd). Once again the directory creation can either be a RELATIVE PATH or an ABSOLUTE PATH.
A handy switch to use is ‘-p’ if we need to create the path.Thus, if we are in the directory ‘/opt’ and we need ‘/opt/books’, it is simple enough. Issue ‘mkdir books’ and it is done. If we need ‘/opt/books/ebooks/linux’ then we can use the ‘-p’ switch (for path). Issue ‘mkdir -p /opt/books/ebooks/linux’ and it will be done. Adding the ‘-v’ switch will make mkdir tell us what is doing as well. The opposite command is ‘rmdir directoryname’. The ‘rmdir’ command will only delete EMPTY directories. Thus it is a safer option than rm -rf directoryname.
Happy hosting!