🖥️less
➡️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 less command with important options and switches using examples.
3 minute read
▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁
# ██╗ ███████╗███████╗███████╗
# ██║ ██╔════╝██╔════╝██╔════╝
# ██║ █████╗ ███████╗███████╗
# ██║ ██╔══╝ ╚════██║╚════██║
# ███████╗███████╗███████║███████║
# ╚══════╝╚══════╝╚══════╝╚══════╝
# To disable the terminal refresh when exiting
less -X
# To save the contents to a file
# Method 1 - Only works when the input is a pipe
s <filename>
# Method 2 - This should work whether input is a pipe or an ordinary file.
Type g or < (g or less-than) | $ (pipe then dollar) then cat > <filename> and Enter.
#==============================#
# CMD less
#==============================##==============================#
less +F filename.log
# Using +F option or pressing F in less is similar to `tail -f filename.log` but can use less his features.
less -j2 /var/log/syslog
# Set the search jump target to 2 lines down so that you see the previous line of context on searches within less.
# FYI, in less if you set -j-1 (value -1), it will put the match at the bottom of the terminal. -j-2 = two lines up. -j.5 = at half screen.
less tip: press 10<rightarrow>
# to move 10 spaces to the right and left to move left, etc. You can use numeric prefixes for many commands.
less -j10 /var/log/syslog
# Set the search jump target to 10 lines down so that you see 9 previous lines of context on searches within less.
less log log.2 log.3 | grep " 404 " | more
# Did you know that if your output from 'less' is a pipe, it behaves like cat. Undocumented
# "Where is that damn rehearsal email at?" Check files modified in the past 30 days with the word rehearsal in them. Within less, use :n to view to the next file.
less $( grep -li rehearsal $( find Maildir -type f -mtime -30 ) )
#==============================##==============================#
# CMD LESS
#==============================##==============================#
Cheatsheets are an excellent complement to other information sources like Linux man-pages, Linux help, or How-To’s and tutorials, as they provide compact and easily accessible information. While man-pages and detailed tutorials often contain comprehensive explanations and extensive guides, cheatsheets summarize the most important options forthe command less in a clear format. This allows users to quickly access the needed information for less without having to sift through lengthy texts. Especially in stressful situations or for recurring tasks, cheatsheets for less are a valuable resource to work efficiently and purposefully.
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
█║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌
██╗ ██╗ ██████╗ ██████╗ ██╗ ██╗███████╗██████╗
████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
╚██╔═██╔╝██║ ██║██║ ██║ ╚███╔╝ █████╗ ██║ ██║
████████╗██║ ██║██║ ██║ ██╔██╗ ██╔══╝ ██║ ██║
╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═════╝
█║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.