Commands using uniq (255)

What's this?

commandlinefu.com 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

Create a mirror of a local folder, on a remote server
Create a exact mirror of the local folder "/root/files", on remote server 'remote_server' using SSH command (listening on port 22) (all files & folders on destination server/folder will be deleted)

Another way to calculate sum size of all files matching a pattern
Here the pattern is '*.jar', you could pass in any pattern. Another, maybe nicer way to do this is http://www.commandlinefu.com/commands/view/1921/summarise-the-size-of-all-files-matching-a-simple-regex You could replace sed with tr

How many Linux and Windows devices are on your network?
Shows how many Windows and Linux devices are on your network. May add support for others, but that's all that are on my network right now.

Coping files, excluding certain files
Preserve file structure when coping and exclude some file o dir patterns

Periodic Log Deletion
deletes logs not modified in over [#] days - modify to compress or move, as needed

Prints per-line contribution per author for a GIT repository
Uses line-porcelain in git blame, which makes it easier to parse the output.

Turning off display
To turn off monitor: xset dpms force off To turn on, simply press a key, or move mouse/mousepad.

change directory to actual path instead of symlink path
If you use symlinks a lot, especially nested symlinks, this puts you back on the absolute path to command-line-fu-nirvana. (Note the backticks around pwd).

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

Makes the permissions of file2 the same as file1
Also works with: $chgrp --reference file1 file2 $chown --reference file1 file2


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.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

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: