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.
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:
Convert comma separated files to tab separated files.
(MySQL eats tab separated files with much less instruction than comma seperated files.)
substitute the URL with your private/public XML url from calendar sharing settings
substitute the dates YYYY-mm-dd
adjust the perl parsing part for your needs
I tried out on my Mac, jot to generate sequence ( 0,25,50,..), you can use 'seq' if it is linux to generate numbers, need curl installed on the machine, then it rocks.
@Satya
Fetches the IPs and ONLY the IPs from ifconfig. Simplest, shortest, cleanest.
Perl is too good to be true...
(P.S.: credit should go to Peteris Krumins at catonmat.net)
Limited, but useful construct to extract text embedded in XML tags. This will only work if bar is all on one line.
If nobody posts an alternative for the multiline sed version, I'll figure it out later...
If you use 'tail -f foo.txt' and it becomes temporarily moved/deleted (ie: log rolls over) then tail will not pick up on the new foo.txt and simply waits with no output.
'tail -F' allows you to follow the file by it's name, rather than a descriptor. If foo.txt disappears, tail will wait until the filename appears again and then continues tailing.
Add this to your $HOME/.bashrc file. It will only set this prompt if it is running inside screen ($WINDOW var is set)
Looks like this...
[email protected]:~[2]$
Breaks down and numbers each line and it's fields. This is really useful when you are going to parse something with awk but aren't sure exactly where to start.
Directly attach a remote screen session (saves a useless parent bash process)
command to decrypt:
openssl enc -aes-256-cbc -d < secret.tar.enc | tar x
Of course, don't forget to rm the original files ;) You may also want to look at the openssl docs for more options.
This executes faster than
cygstart.exe
I put this in a script and added it to my path:
cat `which explore.sh`
#!/bin/bash
if [ $# -eq 0 ]; then
explorer.exe $( cygpath `pwd` -w ) &
else
explorer.exe $( cygpath $1 -w ) &
fi;
Using the script you just type
explore.sh file_or_executable
Note: you can do this for any file that has an associated executable in the windows registry. This is quite handy if you want to open pictures or movies from xterm.
converts any number on the 'stdin' to SI notation. My version limits to 3 digits of precious (working with 10% resistors).
This command finds the 5 (-n5) most frequently updated logs in /var/log, and then does a multifile tail follow of those log files.
Alternately, you can do this to follow a specific list of log files:
sudo tail -n0 -f /var/log/{messages,secure,cron,cups/error_log}
Instead of calculating the offset and providing an offset option to mount, let lomount do the job for you by just providing the partition number you would like to loop mount.
Shows a single line per interface (device), with its IPv4 settings.
Shorter command, better readability in output.
a variation of avi4now's command - thanks by the way!
That one works on Linux. On BSD and Solaris, the ifconfig output is much easier to parse:
/sbin/ifconfig -a | awk '/inet/{print $2}'
making lots of configurations to apache and restarting the server only to find it broken just plain sucks.