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:
You can get others rates changing the "EUR/US" part. look at the url: wap.kitco.com/exrate.wml to get more options.
- convert unixtime to human-readable with awk
- useful to read logfiles with unix-timestamps, f.e. squid-log:
sudo tail -f /var/log/squid3/access.log | awk '{ print strftime("%c ", $1) $0; }
Uses the data in the /proc system, provided by the acpid, to find out the CPU temperature. Can be run on systems without lm-sensors installed as well.
This command changes all filename and directories within a directory tree to unaccented ones. I had to do this to 'sanitize' some samba-exported trees. The reason it works might seem a little difficult to see at first - it first reverses-sort by pathname length, then it renames only the basename of the path. This way it'll always go in the right order to rename everything.
Some notes:
1. You'll have to have the 'unaccent' command. On Ubuntu, just aptitude install unaccent.
2. In this case, the encoding of the tree was UTF-8 - but you might be using another one, just adjust the command to your encoding.
3. The program might spit a few harmless errors saying the files are the same - not to fear.
This create an array 'a' with wole lines. only one occurrence of each line - Not Get lines ++ !
This does the same thing as many of the 'grep' based alternatives but allows a more finite control over the output. For example if you only wanted the process ID you could change the command:
ps -ef | awk '/mingetty/ && !/awk/ {print $2}'
If you wanted to kill the returned PID's:
ps -ef | awk '/mingetty/ && !/awk/ {print $2}' | xargs -i kill {}
Given a file of FQDN, this simple command resolves the IP addresses of those Useful for log files or anything else that outputs domain names.
Check which files are opened by Firefox then sort by largest size (in MB). You can see all files opened by just replacing grep to "/". Useful if you'd like to debug and check which extensions or files are taking too much memory resources in Firefox.
You can use that to create a excludefile for nmap, to find hosts, with no DHCP lease in your DHCP range.
?Cat and grep? You can use only grep ("grep \. filename"). Better option is awk.
I use this in a script on my openwrt router to check if my DynDNS needs to be updated, saves your account from being banned for blank updates.
The example command deletes all aliases for network interface 'em0' assuming that the aliases have netmask of 255.255.255.255 and the master IP has some other netmask (such as 255.255.255.0). See here -> http://my.galagzee.com/2009/07/22/deleting-all-network-interface-aliases/ for more on the rationale of this command.
Retrieve top ip threats from http://isc.sans.org/sources.html and add them into iptables output chain.
Useful for analyzing disk usage. If you prefer GUI try http://en.wikipedia.org/wiki/Filelight or http://www.marzocca.net/linux/baobab/
The command could show you all conecctions if you skip "grep ESTABLISHED"