🖥️man

➡️This is a command-line reference manual for commands and command combinations that you don’t use often enough to remember it. This cheatsheet explains the man command with important options and switches using examples.

▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁

#                ███╗   ███╗ █████╗ ███╗   ██╗
#                ████╗ ████║██╔══██╗████╗  ██║
#                ██╔████╔██║███████║██╔██╗ ██║
#                ██║╚██╔╝██║██╔══██║██║╚██╗██║
#                ██║ ╚═╝ ██║██║  ██║██║ ╚████║
#                ╚═╝     ╚═╝╚═╝  ╚═╝╚═╝  ╚═══╝
                

														  
# Convert a man page to pdf
man -t bash | ps2pdf - bash.pdf

# View the ascii chart
man 7 ascii

#==============================#
# CMD MAN-Pages
#==============================##==============================#
man find |sed -e '/./{H;$!d;}' -e 'x;/modified/!d;i=='
# In the find man page, show whole paragraphs containing the word modified 

man -k 
# only searches in titles and summaries; 

man -K 
# (upper case) does a (slow) fulltext search. mandb refreshes the index file. 

man -k sound
# Use -k to search for something in all man pages, like 'sound'.

man find |sed -e '/./{H;$!d;}' -e 'x;/modified/!d;i==' 
# In the find man page, show whole paragraphs containing the word modified 

man dpkg | sed -n '/Doctal/,/2000 /p'
# Pipe the output of the man command into other commands to trim down the "insane amounts of drivel".

man 5 crontab
# Read it, otherwise you may end up running that backup script every minute during the 4th month of the year.

man dpkg | sed -n '/Doctal/,/2000 /p'
# Pipe the output of the man command into other commands to trim down the "insane amounts of drivel".

man procmailrc | grep -C10 '!' 
# Without opening up the man page viewer, search for instances of '!' and display with surrounding context.

# Maybe this is the problem. The vi man page doesn't even mention how to quit.
man vi | grep -i quit 

# Manpage ausgeben und via email als TXT versenden
man -P cat MANPAGE | mail -s MANPAGE [email protected]

# To get an ASCII man page file without the annoying backspace/underscore attempts at underlining, and weird sequences to do bolding
man ksh | col -b > ksh.txt

man $(ls /bin | shuf | head -1)
# the below one liner will generate random man pages
# Explanation of commands and switches.
#    man – Linux Man pages
#    ls – Linux Listing Commands
#    /bin – System Binary file Location
#    shuf – Generate Random Permutation
#    head – Output first n line of file.

man -k music 
# You don't need to remember all the commands and options if you know how to find documentation.

# Search man pages and present a PDF
man -k . | awk '{ print $1 " " $2 }' | dmenu -i -p man | awk '{ print $2 " " $1 }' | tr -d '()' | xargs man -t | ps2pdf - - | zathura -
# Explanation: This uses dmenu to search through your man pages then produces a pdf for the one you selected
    # man -k . lists all man pages
    # awk '{ print $1 " " $2 }' prints the first column, a space then the second column
    #     This results in lines like this: curl (1)
    # dmenu -i -p man takes a list fron stdin and lets you choose one. It returns what you chose
    #     You can swap dmenu for somethign like rofi if required
    # awk '{ print $2 " " $1 }' puts the second column first
    #     The output is now like (1) curl
    # tr -d '()' removes the brackets
    # xargs man -t puts the result at the end of the command man -t
    #     This makes the command something like man -t 1 curl
    #     the -t flag makes man use troff to format the page
    # ps2pdf - - produces a PDF from the postscritpt output by the previous command
    # zathura - is a pdf reafer that can read STDIN
# Limitations: 
	# You will need a PDF viewer that can read from STDIN
	# You will need ps2pdf installed which is part of ghostscript
	# You will need dmenu or a dmenu compatible program installed.
	# Almost all systems will already have xargs, tr troff, awk installed.

# Quick #bash shell tip on searching the #linux manual...
# ... love your `man` pages because one day ya might be developing on an air-gaped device.
# ... this is generally easier to grok than other things that I do not like to unsee.
man --pager='less -p " -P pager"' man

# ... example for `sshd_config`...
man --pager='less -p "ChrootDirectory"' sshd_config
man --pager='less -p "Shell Function Definitions"' bash

# convert a man file to a html File
zcat /usr/share/man/man8/scanlogd.8.gz | man2html | tee scanlogd.html

#==============================##==============================#
# CMD MAN						       #
#==============================##==============================#
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

  █║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌

              ██╗ ██╗ ██████╗  ██████╗ ██╗  ██╗███████╗██████╗
             ████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
             ╚██╔═██╔╝██║  ██║██║   ██║ ╚███╔╝ █████╗  ██║  ██║
             ████████╗██║  ██║██║   ██║ ██╔██╗ ██╔══╝  ██║  ██║
             ╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
              ╚═╝ ╚═╝ ╚═════╝  ╚═════╝ ╚═╝  ╚═╝╚══════╝╚═════╝

               █║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░