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:
Runs a diff on two files ignore comments and blank lines (diff -I=RE does not work as expected). Adapted from a post found on stackexchange.
CPU flags:
rm --> 16-bit processor (real mode)
tm --> 32-bit processor (? mode)
lm --> 64-bit processor (long mode)
CPU flags:
rm --> 16-bit processor (real mode)
tm --> 32-bit processor (? mode)
lm --> 64-bit processor (long mode)
This command tell you if your hardware is 32 or 64 bits even if you install a 32bits OS on a 64 bits hardware.
If your distro don't support the -q switch, try doing :
grep &>/dev/null '\<lm\>' /proc/cpuinfo && echo 64 bits || echo 32 bits
This functionality seems to be missing from commands like dpkg. Ideally, I want to duplicate the behavior of rpm --verify, but it seems difficult to do this in one relatively short command pipeline.
The closer to zero the better.Credit to TheSeb on macrumors: http://forums.macrumors.com/showthread.php?t=1289884
Find all the occurrences in the git repo of 'foo' and replace with 'bar'
it shows whether your CPU supports 64 bit (x86-64) mode. uname -a only shows whether you have 64 bit (x86-64) or 32bit (i386) OS installed, this one-liner answers question: Can I install 64bit OS on this machine?
Executing pfiles will return a list of all descriptors utilized by the process
We are interested in the S_IFREG entries since they are pointing usually to files
In the line, there is the inode number of the file which we use in order to find the filename.
The only bad thing is that in order not to search from / you have to suspect where could possibly be the file.
Improvements more than welcome.
lsof was not available in my case
Kind of fun if you're that was inclined. I figured most of my commands start with s. sudo, screen, ssh etc. This script tells me what else they start with.
ls -lhR
Lists everithing using -l "long listing format" wich includes the space used by the folder. Displays it in -h "human readable form" (i.e. 2.2G, 32K), and -R recurses subfolders.
grep -e using a regex, show lines containing the word "total" or a ":" at the end of the line (those with the name of the folder) only.
Substitute for #11720
Can probably be even shorter and easier.
Case insensitive. Also you can pull in the songs from a blacklist, one per line -
while :; do (mpc current | grep -i -f blacklist.txt && mpc next); sleep 5; done
Requirements: curl, grep, awk, internet connection with access to wikipedia
Loaded page: http://en.wikipedia.org/wiki/List_of_programming_languages
If you can make shorter version of this listgetter, you are welcome to paste it here :)