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:
Saves one character, the original is probably clearer
You can also cut charactes starting from X to N.
In case sed and awk are not available you may use this to remove the last character from a string with "rev" and "cut".
This is just a "cut" addicted variant of the previous unixmonkey24730 command...
This works more reliable for me ("cut -c 8-" had one more space, so it did not work)
Expand a URL, aka do a head request, and get the URL. Copy this value to clipboard.
Videos are found using their MIME type. Thus no need to for an extension for the video file.
This is a efficent version of "jnash" cmd (4086). Thanks for jnash. This cmd will only show video files while his cmd show files having "video" anywhere in path.
Grabs the Apache config file (yielded from httpd) and returns the path specified as DocumentRoot.
attempts to delete all local branches. git will fail on any branches not fully merged into local master, so don't worry about losing work. git will return the names of any successfully deleted branches. Find those in the output with grep, then push null repositories to the corresponding names to your target remote.
- your local and remote branches are identically named, and there's nothing extra in the remote branch that you still want
- EDIT: you want to keep your local master branch
extracts the 5th column using the delimiter ','
Count and Find all IP connected to my host through TCP connection.
find all computer connected to my host through TCP connection
I liked vaporub's suggestion, here a little simplification of the sed command.
netstat has two lines of headers:
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
Added a filter in the awk command to remove them
Useful after a complete system update (without a new kernel) when you want to know, which processes need to be restarted