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:
I find the ouput of ls -lR to be un-satisfying (why is the path data up there?) and find syntax to be awkward. Running 'du -a' means you will have likely to trim-off filesize data before feeding filenames to the next step in the pipe.
This command dumps all SVN repositories inside of folder "repMainPath" (not recursively) to the folder "dumpPath", where one dump file will be created for each SVN repository.
Same thing, only "head" instead of grep/egrep..
search argument in PATH
accept grep expressions
without args, list all binaries found in PATH
Rainbow, instead of greys
Based on the MrMerry one, just add some visuals to differentiate files and directories
Based on the MrMerry one, just add some visuals and sort directory and files
The important thing to note in this command, is the "-n" flag.
Compile *.c files with "gcc -Wall" in actual directory, using as output file the file name without extension.
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.
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.
Sqlite database keeps collecting cruft as time passes, which can be cleaned by the 'vacuum;' command. This command cleans up the cruft in all sqlite files relating to the user you have logged in as. This command has to be run when firefox is not running, or it will exit displaying the pid of the firefox running.
Renames all the jpg files as their timestamps with ".jpg" extension.
Find Word docs by filename in the current directory, convert each of them to plain text using antiword (taking care of spaces in filenames), then grep for a search term in the particular file.
(Of course, it's better to save your data as plain text to make for easier grepping, but that's not always possible.)
Requires antiword. Or you can modify it to use catdoc instead.
Same as above but slooooow it down
In Debian based distros, this command will list 'binutils' package details which contains 'nm' command. You can replace 'nm' to any other command.
Found this one little more for me. This one removes the perl dependency (from command 2535).
Source for command : http://www.earthinfo.org/linux-disk-usage-sorted-by-size-and-human-readable/
Obviously, you can replace 'man' command with any command in this command line to do useful things. I just want to mention that there is a way to list all the commands which you can execute directly without giving fullpath.
Normally all important commands will be placed in your PATH directories. This commandline uses that variable to get commands. Works in Ubuntu, will work in all 'manpage' configured *nix systems.
command | my_irc
Pipe whatever you want to this function, it will, if everything goes well, be redirected to a channel or a user on an IRC server.
Please note that :
- I am not responsible of flood excesses you might provoke.
- that function does not reply to PINGs from the server. That's the reason why I first write in a temporary file. Indeed, I don't want to wait for inputs while being connected to the server. However, according to the configuration of the server and the length of your file, you may timeout before finishing.
- Concerning the server, the variable content must be on the form "irc.server.org 6667" (or any other port). If you want to make some tests, you can also create a fake IRC server on "localhost 55555" by using
netcat -l -p 55555
- Concerning the target, you can choose a channel (beginning with a '#' like "#chan") or a user (like "user")
- The other variables have obvious names.
Just find out the daemon with $ netstat -atulpe. Then type in his name and he gets the SIGTERM.
Tuned for short command line - you can set the path to sessionstore.js more reliable instead of use asterixes etc.
Usable when you are not at home and really need to get your actual opened tabs on your home computer (via SSH). I am using it from my work if I forgot to bookmark some new interesting webpage, which I have visited at home. Also other way to list tabs when your firefox has crashed (restoring of tabs doesn't work always).
This script includes also tabs which has been closed short time before.