Commands using uniq (252)

What's this? is the place to record those command-line gems that you return to again and again. 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.

Share Your Commands

Check These Out

Loop over the days of a month, in $YYYY$MM$DD format
Edit YYYY and MM at the beginning of the command with the year and month you want. Note that `DD=$(printf "%02d" $d)` will pad single digit integers with a leading zero. Substitute `echo $YYYY$MM$DD` at the end of the line with the command you want to launch, for instance --yyyymmdd $YYYY$MM$DD Also available on GitHub as bash util:

ps grep with header
Yet another ps grep function, but this one includes the column headings.

VIM: when Ctrl-D and Ctrl-U only scroll one line, reset to default
Resets the scroll parameter to the default (half the rows in the current window). The scroll parameter can be inadvertently set to 1, e..g., if you type '1 Ctrl-D' or '1 Ctrl-U' in normal mode.

generate a random 10 character password
Generate a table of random 10 character passwords

Search some text from all files inside a directory

Run a command that has been aliased without the alias
Most distributions alias cp to 'cp -i', which means when you attempt to copy into a directory that already contains the file, cp will prompt to overwrite. A great default to have, but when you mean to overwrite thousands of files, you don't want to sit there hitting [y] then [enter] thousands of times. Enter the backslash. It runs the command unaliased, so as in the example, cp will happily overwrite existing files much in the way mv works.

Find usb device
I often use it to find recently added ou removed device, or using find in /dev, or anything similar. Just run the command, plug the device, and wait to see him and only him

Start a command on only one CPU core
This is useful if you have a program which doesn't work well with multicore CPUs. With taskset you can set its CPU affinity to run on only one core.

Command line calculator
This function defines a command line calculator that handles everything pythons math module can handle, e.g. trigonometric functions, sqrt, log, erf, ... (see It even knows about the constants pi and e.

Configuring proxy client on terminal without leaving password on screen or in bash_history
Prompts the user for username and password, that are then exported to http_proxy for use by wget, yum etc Default user, webproxy and port are used. Using this script prevent the cleartext user and pass being in your bash_history and on-screen

Stay in the loop…

Follow the Tweets.

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.


Subscribe to the feeds.

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: