All commands (14,187)

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

Look for English words in /dev/urandom
* to get the English dictionary: wget http://www.mavi1.org/web_security/wordlists/webster-dictionary.txt

print line and execute it in BASH
!# is the currennt line so far, by using !#:- you can go from the second arg (it's zero indexed) to the last ($) (did I understand the problem correctly?)

Calculate days on which Friday the 13th occurs (inspired from the work of the user justsomeguy)
Friday is the 5th day of the week, monday is the 1st. Output may be affected by locale.

Decode base64-encoded file in one line of Perl
Another option is openssl.

Mnemonic for `nice` and `renice` command
This is just a phrase I use to help me remember which way is what when using nice (top, renice, etc.), and not a command, (unless you really want this in your .bash_history to help remind you.) I was using the command `man nice ` way too much just to look up which way is what. This saves 9 keystrokes every time I remember it. Make sure you downvote me if you think mnemonics sux. Otherwise I hope this helps someone else.

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"

open a seperate konsole tab and ssh to each of N servers (konsole 4.2+)
creates a new tab for each of N servers in listofservers.txt and ssh's to said servers then, try the "send to all sessions" feature of konsole to do the same work on all servers at the same time. BIG time saver, but be careful!

Remount an already-mounted filesystem without unmounting it
Necessary for fsck for example. The remount functionality follows the standard way how the mount command works with options from fstab. It means the mount command doesn't read fstab (or mtab) only when a device and dir are fully specified. After this call all old mount options are replaced and arbitrary stuff from fstab is ignored, except the loop= option which is internally generated and maintained by the mount command. It does not change device or mount point.

a function to find the fastest DNS server
http://public-dns.info gives a list of online dns servers. you need to change the country in url (br in this url) with your country code. this command need some time to ping all IP in list.

Bash alias to output the current Swatch Internet Time
Output the current time in Swatch “Internet Time”, aka .beats. There are 1000 .beats in a day, and @0 is at 00:00 Central European Standard Time. This was briefly a thing in the late 1990s. More details: https://2020.swatch.com/en_ca/internet-time/ The alias is rather quote heavy to protect the subshell, so the bare command is: $ echo '@'$(TZ=GMT-1 date +'(%-S + %-M * 60 + %-H * 3600) / 86.4'|bc)


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: