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:
These part of the command:
svn status | grep '^\?' => find new file or directory on working copy
sed -e 's/^\?//g' => remove "^" character on the first character of file name
xargs svn add => add file to subversion repository
You can modify above command to other circumtances, like revert addition files or commit files that have been modified. ^_^
Output: Version 3.2-0 (for example if you type # aptitude show bash | grep Vers
Depends on the language of your distribution, because the name of the word "Version" in other languages may be different.
This command will list a CSV list of infected files detected by clamav through squidclamav redirector.
Show only the subdirectories in the current directory. In the example above, /lib has 135 files and directories. With this command, the 9 dirs jump out.
rpm, sometimes, is not wildcard friendly. To search files installed from package this could be useful.
change PACKAGENAME to any package do you want to search
This command gives a model information of a computer. Also useful in determining the host is a VM machine or actual physical machine.
Useful in scripts while you just need an IP address in a variable.
I've had this as mute.sh in my ~/bin/ for some time.
greps for search word in directory and below (defaults to cd).
-i case insensitive
-n shows line number
-H shows file name
Note that the file at the given path will have the contents of the (still) deleted file, but it is a new file with a new node number; in other words, this restores the data, but it does not actually "undelete" the old file.
I posted a function declaration encapsulating this functionality to http://www.reddit.com/r/programming/comments/7yx6f/how_to_undelete_any_open_deleted_file_in_linux/c07sqwe (please excuse the crap formatting).
If the 'lm' flag is present, then the CPU is 64-bit.
If no output, then CPU is 32-bit.
From 'man netstat'
"netstat -i | -I interface [-abdnt] [-f address_family] [-M core] [-N system]
Show the state of all network interfaces or a single interface
which have been auto-configured (interfaces statically configured
into a system, but not located at boot time are not shown). An
asterisk (``*'') after an interface name indicates that the
interface is ``down''. If -a is also present, multicast
addresses currently in use are shown for each Ethernet interface
and for each IP interface address. Multicast addresses are shown
on separate lines following the interface address with which they
are associated. If -b is also present, show the number of bytes
in and out. If -d is also present, show the number of dropped
packets. If -t is also present, show the contents of watchdog
This is a nice way to kill processes.. the example here is for firefox!!! substitute firefox for whatever the process name is...
To save the result, redirect the output to another file.
grep -v "^$" file1 > file2