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:
this version only uses shell builtins
Typing a word in terminal is easier than digging your phone out, opening your two-factor authentication app and typing the code in manually.
This alias copies the one-time code to your clipboard for 3 seconds (long enough to paste it into a web form), then restores whatever was on the clipboard beforehand.
This command works on Mac. Replace pbpaste/pbcopy with your distribution's versions.
This can be easier to look at in ls output. Not as clean as +%Y%m%dT%H%M%S, but quicker to write.
If you're running a command with a lot of output, this serves as a simple progress indicator.
This avoids the need to use `/dev/null` for silencing. It works for any command that outputs lines, updates live (`fflush` avoids buffering), and is simple to understand.
Very convenient to for sending data to the clipboard for processing.
However, note that tee will affect the buffering of the output (stdout won't be update very live).
Same functionality without using bash functions.
If a session with named the same as your username already exists, then attach to it, otherwise create it
"git grep" automatically excludes untracked files (e.g. compiler output) and files under .git directory. If no directory or file is given, it will recursively search through the current directory.
Place this in your .bashrc (or run it once) to set the `tasks` alias. Next time you enter `tasks` into a terminal, it will give you a list of all TODO and FIXME comments in the current directory and child directories, giving you a quick overview of what you still have to do!
Starts and shows a timer. banner command is a part of the sysvbanner package. Instead of the banner an echo or figlet commands could be used. Stop the timer with Ctrl-C and elapsed time will be shown as the result.
bash output is inserted into the clipboard, then mousepad is started and the clipboard content is pasted. xsel and xdotool needs to be installed. Instead of the mousepad any other editor can be used. I've successfully tested the Sublime Text Editor and it opens a new tab for each new paste. Check Sample output for a usage example. This command is originated from here - http://goo.gl/0q9UT4
Clear the screen and list file
Add an "alert" alias for long running commands
same as "unset HISTFILE" - but the advantage is that you can "tab-complete" it and when you do, you won't mistype it (which could lead to not unsetting the HISTFILE).
put the alias in the ~/.bash_profile or ~/.bashrc file in your users home directory, respawn, enjoy! :)
This alias is super-handy for me because it quickly shows the details of each file in the current directory. The output is nice because it is sortable, allowing you to expand this basic example to do something amazing like showing you a list of the newest files, the largest files, files with bad perms, etc..
A recursive alias would be:
alias LSR='find -mount -printf "%.5m %10M %#9u:%-9g %#5U:%-5G %TF_%TR %CF_%CR %AF_%AR %#15s [%Y] %p\n" 2>/dev/null'
MAC OSX doesn't come with an updatedb command by default, this will emulate the updatedb thats on a typical Linux OS.
Simply add it to your ~/.bash_profile
MAC OSX doesn't come with a locate command, This will do the same thing as the locate command on a typical Linux OS.
Simply add it to your ~/.bash_profile
Terminal Color tester using python, works with py2 and 3