commandlinefu.com is the place to record those command-line gems that you return to again and again.
Delete that bloated snippets file you've been using and share your personal repository with the world. 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.
If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/
You can sign-in using OpenID credentials, or register a traditional username and password.
First-time OpenID users will be automatically assigned a username which can be changed after signing in.
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:
Just type man and the name of the command you want information on followed by enter.. POW!!! there you have all you need to know on the subject.
Uses the formatting of a man page to show an outline of its headers and sub-headers.
It shows the complete ascii table, and it works in BSD too, not only in Linux.
Typographically speaking, it's generally the [accepted wisdom][1] that about 60 characters per line makes for optimal reading (would that more Web pages followed this convention!). I know I got tired of reading manpages with text as wide as my screen! However, the command above sets manwidth to 70 rather than 60 because paragraphs in manpages are generally indented.
I recommend the following snippet for your .${SHELL}rc, which sets manwidth to 70 unless your terminal is smaller than 70 characters:
function man () {
if [[ $COLUMNS -gt 70 ]]; then
MANWIDTH=70 command man $*
else
command man $*
fi
}
[1]: https://en.wikipedia.org/wiki/Column_(typography)
Yeah yeah, another "render man page in pdf", but this time it creates a temporary PDF that stays resident in memory for viewing, but is eliminated on the filesystem.
Replace evince with your PDF viewer of choice.
Read all chapters up to 'Jumping', improve your effectiveness of wirking in terminal.
Most useful are the Moving and Searching commands
ulimit [-SHacdflmnpstuv [limit]]
Provides control over the resources available to the shell and to processes started by it, on systems that allow such control. The -H
and -S options specify that the hard or soft limit is set for the given resource. A hard limit cannot be increased once it is set; a
soft limit may be increased up to the value of the hard limit. If neither -H nor -S is specified, both the soft and hard limits are set.
# jumps straight to the definition of ulimit in the bash man page.
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.
Find the usage of a switch with out searching through the entire man page.
Usage: manswitch [cmd] [switch]
Eg:
manswitch grep silent
____________________________
In simple words
man <cmd> | grep "\-<switch>"
Eg:
man grep | grep "\-o"
This is not a standard method but works.
Simple edit to work for OSX.
Now just add this to your ~/.profile and `source ~/.profile`
Quick and dirty version. I made a version that checks if a manpage exists (but it's not a oneliner). You must have ps2pdf and of course Ghostscript installed in your box.
Enhancements appreciated :-)
when we work with terminal often we open man pages for help if we did some mistakes
and when we want to open the man page for command we are working with this one helps
as many people may be knowing that '!!' performs the last command action
we use it in sudo !! to perform the last action with root previleages
man !! will also be helpful and handy
thanx
Another one.
Maybe not the quicker because of the sort command, but it will also look in other man sections.
updated with goodevilgenius 'shuf' idea
I'm not sure why you would want to do this, but this seems a lot simpler (easier to understand) than the version someone submitted using awk.
Build an awk array with all commands and then select a random one at the end.
This avoids spawning extra processes for counting with wc or generating random numbers.
Explicitly call /bin/ls to avoid interactions with aliases.
Great idea camocrazed. Another twist would be to display a different man page based on the day of the year. The following will continuously cycle through all man pages:
man $(ls /bin | sed -n $(($(date +%j) % $(ls /bin | wc -l)))p)
Broaden your knowledge of the utilities available to you in no particular order whatsoever! Then use that knowledge to create more nifty one-liners that you can post here. =p
Takes a random number modulo the number of files in $dir, prints the filename corresponding to that number, and passes it as an argument to man.