Using +F will put less in follow mode. This works similar to 'tail -f'. To stop scrolling, use the interrupt. Then you'll get the normal benefits of less (scroll, etc.). Pressing SHIFT-F will resume the 'tailling'.
If you want a visual representation of the parent/child relationships between processes, this is one easy way to do it. It's useful in debugging collections of shell scripts, because it provides something like a call traceback. When a shell script breaks, just remember "awwfux".
Get your colorized grep output in less(1). This involves two things: forcing grep to output colors even though it's not going to a terminal and telling less to handle those properly.
e.g.
manswitch grep -o
This will take you to the relevant part of the man page, so you can see the description of the switch underneath.
Validates and pretty-prints the content fetched from the URL. Show Sample Output
The "pstree" command uses special line-drawing characters. However, when piped into the "less" pager, these are normally disabled.
Example :
LC_ALL=C man less | less +/ppattern
I put this in a shell script called "svndiff", as it provides a handy decorated "svn diff" output that is colored (which you can't see here) and paged. The -r is required so less doesn't mangle the color codes. Show Sample Output
It allows customizing by means of lesspipe. You need to write a ~/.lessfilter script and put this into your ~/.bashrc: eval $(lesspipe) export LESS=-r
The same as typing 'less filename' then 'G' or '>' or the END key. Comes in handy with shell scripts or aliases: alias weblog='less +G /var/log/httpd/access_log' alias errlog='less +G /var/log/httpd/error_log'
To sort hidden files first, simply switch the two inner `ls` commands.
I have this aliased to `dira`
`dir` is aliased to the simpler version with no hidden files:
ls -l --color=always | less -R
Usage : tt [OCCURRENCE] tt will display a tree from your actual path tt .svn will display only line containing .svn Show Sample Output
This command enables the user to append a search pattern on the command line when using less as the PAGER. This is especially convenient (as the example shows) in compressed files and when searching man pages (substituting the zcat command with man, however).
just like the original - just colored and with less
I've been using colordiff for years. wdiff is the new fav, except its colors. Word delimited diffs are more interleaved, easing the chore of associating big blocks of changes.
From the manpage:
man less
-X or --no-init
Disables sending the termcap initialization and deinitialization strings to the terminal. This is sometimes desirable if the deinitialization string does something unnecessary, like clearing the screen.
Bonus:
If you want to clear the screen after viewing a file this way that had sensitive information, hit or just type clear. Since is readily available, I don't know why less bothers to automatically clear. If you're viewing the file at all, chances are you want to see the output from it after you quit.
Show Sample Output
Really useful way to combine less and grep while browsing log files. I can't figure out how to make it into a true oneliner so paste it into a script file called lgrep: Usage: lgrep searchfor file1 [file2 file3] Advanced example (grep for an Exception in logfiles that starts with qc): lgrep Exception $(find . -name "qc*.log") Show Sample Output
This is a simple bash function and a key binding that uses commandlinefu's simple and easy search API. It prompts for a search term, then it uses curl to search commandline fu, and highlights the search results with less.
This will open the manpage for "foobar", and display all instances of "searched_string". You can traverse through them by pressing "n"
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for: