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:
Create an image of "device" and send it to another machine through the network ("target" and "port" sets the ip and port the stream will be sent to), outputting a progress bar
On the machine that will receive, compress and store the file, use:
nc -l -p <port> | 7z a <filename> -si -m0=lzma2 -mx=9 -ms=on
Optionally, add the -v4g switch at the end of the line in order to split the file every 4 gigabytes (or set another size: accepted suffixes are k, m and g).
The file will be compressed using 7z format, lzma2 algorithm, with maximum compression level and solid file activated.
The compression stage will be executed on the machine which will store the image. It was planned this way because the processor on that machine was faster, and being on a gigabit network, transfering the uncompressed image wasn't much of a problem.
Deletes lines to of a file. You must put the end line first in the range for the curly brace expansion, otherwise it will not work properly.
For example, to remove line 5 from foo, type: vi +5d +wq foo
Use sed to remove comments from a file.
In this example the comments begin with #.
The command '/^#/d' remove line starting with #.
The command 's/#.*$//' remove comments at end of lines.
Use sed to remove the last line of a file only if it is empty.
You can push files to up to 32 servers at once assuming ssh keys are in place.
Great tool, it is part of the pssh suite.
Instead of zeroing the filesystem, this command overwrites N times (default is 3) the disk content, making data recovery much harder.
The command accepts many more options
Need output in mbps (bits)
# ./bytes-second.sh eth0
eth0 interface maximum Speed: 1000Mb/s
RX:12883212 TX:17402002 B/s | RX:98 TX:132 Mb/s
RX:12371647 TX:17830111 B/s | RX:94 TX:136 Mb/s
RX:12502750 TX:17860915 B/s | RX:95 TX:136 Mb/s
if you don't do --numeric-ports, netstat will try to resolve them to names
(follow with next command)
tail -f from.log | colorize.pl +l20:".*" &
Use with http://www.commandlinefu.com/commands/view/10031/intercept-monitor-and-manipulate-a-tcp-connection. - can use to view output of tees that send traffic to files - output will be interwoven with red for sent traffic and green for received.
Ever need to get some text that is a specific number of characters long? Use this function to easily generate it! Doesn't look pretty, but sure does work for testing purposes!
Works for multiple hosts (such as www.google.com) and/or wrong hosts.
Quick shortcut if you know the hostname and want to save yourself one step for looking up the IP address separately.
For a demo try
wmctrl -o 100,0; sleep 3; wmctrl -o 1500,0; sleep 3; wmctrl -o 3000,0; sleep 3; wmctrl -o 4500,0;
Actually
wmctrl -o <width x Number>,0;
to switch to that workspace
Sample input:
kde-open -v
Qt: 4.7.4
KDE Development Platform: 4.7.3 (4.7.3)
KIO Client: 2.0