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 would like to ignore a directory including its subdirectory. For example, a tmp/ directory
All with only one pipe. Should be much faster as well (sort is slow). Use find instead of ls for recursion or reliability.
Edit: case insensitive
If your grep doesn't have an -o option, you can use sed instead.
Just a little simplification.
This is a command template for achiving the following:
* loop over files --> find -name "" | while read file; do ...; done
* output progress --> echo -n .
* execute some command on each file and save output for later usage --> output=$()
* if command failed, open subshell and echo newline --> || (echo;...;...;)
* echo output of command --> echo "$output"
This works fine too.
You define your variable MYVAR with the desired search pattern:
...which can then be searched with the find command.
This is useful if you in a script, where you want the arguments to be fed into the find command.
The provided search is case insensitive (-iname) and will find all files and directories with the pattern MYVAR (not exact matches). This may go without saying, but if you want exact matches remove the \* and if you want case sensitive, use the -name argument.
Then pipe to 'xargs ls' for a familiar listing, possibly using find's -print0 and xarg's -0 options.
This will deal nicely with filenames containing newlines and will run one lzma process per CPU core. It requires GNU Parallel http://www.youtube.com/watch?v=OpaiGYxkSuQ
Quick method of isolating filenames from a full path using expansion.
Much quicker than using "basename"
This will list all symlinks that are directories under the current directory. This will help you distinguish them from regular files.
nmap for windows and other platforms is available on developer's site: http://nmap.org/download.html
nmap is robust tool with many options and has various output modes - is the best (imho) tool out there..
from nmap 5.21 man page:
-oN/-oX/-oS/-oG : Output scan in normal, XML, s|
Gnu grep allows to restrict the search to files only matching a given pattern. It also allows to exclude files.
I like this better than some of the alternatives using -exec, because if I want to change the string, it's right there at the end of the command line. That means less editing effort and more time to drink coffee.
Lists a sample of all installed toilet fonts
documents all active ips on a subnet and saves to txt file.
I use this sometimes when ctags won't help.
The following command finds all the files not modified in the last 5 days under /protocollo/paflow directory and creates an archive files under /var/dump-protocollo in the format of ddmmyyyy_archive.tar
Please be careful while executing the following command as you don?t want
to delete the files by mistake. The best practice is to execute the same
command with ls ?l to make sure you know which files will get deleted when
you execute the command with rm.
You might want to check what file and directory names would be renamed or chopped if you create iso 9660 level 2 image out of them. Use this command to check first.