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.
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:
If you want avoid to be annoyed when playing your favourite video files with your video player, first run this command to stash wrong files (and test tricks to play these wrong files).
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
For debian and ubuntu :
sudo apt-get install pdfcrack
You need to install WWW::Mechanize Perl module with
# cpan -i WWW::Mezchanize
or by searching mechanize | grep perl in your package manager
With this command, you can get forms, images, headers too
Require lftp and this script to work (adapt path and credentials as needed):
echo $'#!/bin/bash\n# coded by sputnick under GPL 20101007\nlftp -u user,passwd [email protected] -e "$(cat)"' > /PATH/TO/ftp-latest; chmod +x !$
You should install qpdf.
That way, you can have a copy without any password required.
LC_ALL=C man less | less +/ppattern
That way, you can make a mix on the fly with the mp3 files in the current directory to make a bunch mp3 file.
Remove everything except that file with shell tricks inside a subshell to avoid changes in the environment.
You can use
vim scp:[email protected]//file
too in a simple case.
Perl is installed by default on most modern OS when jot is not.
You have to do that before :
cd ~/.mozilla/firefox/<YOUR PROFILE>
Require bash. If you use something else, you may use
echo <CODE> | python
Forked from ArkSeth python script.
That works in all softs, CLI or GUI... I don't want to waste time to all the time typing the same stuff . So, I have that command in my window manager shortcuts ( meta+l ). All the window managers have editable shortcuts AFAIK. If not, or you don't want to use it that way, you can easily use the xbindkeys soft.
I you're using kde4, you can run :
then open "inputs actions" and create a new shortcut.
For Gnome take a look there : http://www.cyberciti.biz/faq/howto-create-keyboard-shortcuts-in-gnome/
A more advanced one, with strings and newlines :
xvkbd -xsendevent -text "---8<-----\nToday date is: $(date +%Y%m%d)\n---8<-----"
For complicated or long paste, you can feed xvkbd with a file :
xvkbd -xsendevent -file <file>
You can simulate ^C ( control+c ) too or others combinations of keys :
xvkbd -text "\C\Ac"
There's no man page nor help ( On my Archlinux distro ), but you can see online doc there : http://homepage3.nifty.com/tsato/xvkbd/
man 5 shadow
I think it's more reliable, because
dont show "locked" but "L" as second field on my Archlinux for a particular user.
( unixhome alternative ).
Then hit ^C to stop, get the file by scp, and you can now use wireshark like this :
If you have tshark on remote host, you could use that :
wireshark -k -i <(ssh -l root <REMOTE HOST> tshark -w - not tcp port 22)
The last snippet comes from http://wiki.wireshark.org/CaptureSetup/Pipes
If you want all the URLs from all the sessions, you can use :
perl -lne 'print for /url":"\K[^"]+/g' ~/.mozilla/firefox/*/sessionstore.js
Thanks to tybalt89 ( idea of the "for" statement ).
For perl purists, there's JSON and File::Slurp modules, buts that's not installed by default.
Thanks to comment if that works or not...
If you have already typed that snippet or you know you already have IO::Interface::Simple perl module, you can type only the last command :
perl -e 'use IO::Interface::Simple; my $ip=IO::Interface::Simple->new($ARGV); print $ip->address,$/;' <INTERFACE>
( The first perl command will install the module if it's not there already... )
For debian likes, that's in python-xml package.