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.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
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:
CHANGELOG
Version 1.1
removedir () { echo "You are about to delete the current directory $PWD Are you sure?"; read human; if [[ "$human" = "yes" ]]; then blah=$(echo "$PWD" | sed 's/ /\\ /g'); foo=$(basename "$blah"); rm -Rf ../$foo/ && cd ..; else echo "I'm watching you" | pv -qL 10; fi; }
BUG FIX:
Folders with spaces
Version 1.0
removedir () { echo "You are about to delete the current directory $PWD Are you sure?"; read human; if [[ "$human" = "yes" ]]; then blah=`basename $PWD`; rm -Rf ../$blah/ && cd ..; else echo "I'm watching you" | pv -qL 10; fi; }
BUG FIX:
Hidden directories (.dotdirectory)
Version 0.9
rmdir () { echo "You are about to delete the current directory $PWD. Are you sure?"; read human; if [[ "$human" = "yes" ]]; then blah=`basename $PWD`; rm -Rf ../$blah/ && cd ..; else echo "I'm watching you" | pv -qL 10; fi; }
Removes current directory with recursive and force flags plus basic human check. When prompted type yes
1. [user@host ~]$ ls
foo bar
2. [user@host ~]$ cd foo
3. [user@host foo]$ removedir
4. yes
5. rm -Rf foo/
6. [user@host ~]$
7. [user@host ~]$ ls
bar
tail would be considered dull, but pair this with being able to push out unix commands over ARD, and life gets easier. (Same can be said for my TimeMachine scrape command, http://xrl.us/begrzb)
Very similar but no use of `tr` for
function liner() {
local num_lines=${1:-42}
local line=$(printf %${num_lines}s)
echo ${line// /#}
}
This uses urandom to produce a random password. The random values are uuencoded to ensure only printable characters. This only works for a number of characters between 1 and 60.
This command defragment the SQLite databases found in the home folder of the current Windows user.
This is usefull to speed up Firefox startup.
The executable sqlite3.exe must be located in PATH or in the current folder.
In a script use:
for /f "delims==" %%a in (' dir "%USERPROFILE%\*.sqlite" /s/b ') do echo vacuum;|"sqlite3.exe" "%%a"
macchanger will allow you to change either 1) mfg code, 2) host id, or 3) all of the above. Use this at wifi hotspots to help reduce profiling.
Another one.
Maybe not the quicker because of the sort command, but it will also look in other man sections.
updated with goodevilgenius 'shuf' idea
use today's time stamp to make a unique directory for today or an hour ago ...
Depends on zsh and gst123 ( http://space.twc.de/~stefan/gst123.php )
cd in_your_music_root_folder and then issue the command
Remove annoying improperly packaged files that untar into the incorrect directory.
Example, When you untar and it extracts hundreds of files into the current directory.... bleh.
the last person who posted used the most roundabout way to concatinate files, there's a reason there's a "conCATinate" command... Using this method, you also get to choose the order of the files, below another person just did *.txt > combined.txt which is fine but the order depends on the implementation of "cat" which is probably alphabetical order of filenames.
Of course, the httpd can be replaced with any other process name
# # ####### # # ####### # # ####### ###### # ######
# # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # #
####### ##### # # # # ### # # # # # ###### # # #
# # # # # # # ### # # # # # # # # # #
# # # # # # # # # # # # # # # # # #
# # ####### ####### ####### ####### # ## ## ####### # # ####### ######