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

Execute a command without saving it in the history
Yes, by correctly setting the HIST* variables you can make certain commands not saved in history. But that's complicated and easy to make a mistake. If you set HISTFILE= to blank, nothing in your current shell session will be saved in history. Although this is not a precise answer to the subject, but it's very simple.

list files recursively by size

Check if it's your binary birthday!
Print out your age in days in binary. Today's my binary birthday, I'm 2^14 days old :-) . This command does bash arithmatic $(( )) on two dates: Today: $(date +%s) Date of birth: $(date +%s -d YYYY-MM-DD) The dates are expressed as the number of seconds since the Unix epoch (Jan 1970), so we devide the difference by 86400 (seconds per day). . Finally we pipe "obase=2; DAYS-OLD" into bc to convert to binary. (obase == output base)

check open ports without netstat or lsof

See a full list of compiler defined symbols
From http://lists.debian.org/debian-devel/2001/01/msg00971.html .

Execute multiple commands from history
Assuming that 219,229 and 221 are entries in history, I recall them in a single line for execute multiple commands 219 ifdown wlan0 ... 221 ifup wlan0 ... 229 iwconfig wlan0 mode Managed so the result is execution of # ifdown wlan0 ; iwconfig wlan0 mode Managed ; ifup wlan0

shell bash iterate number range with for loop

Show all configured ipv4
Short list of all ip. Shows even the newly supported multiple ip address on the same interface (see eth1). For ipv6 use -6

generate iso

Resolve a list of domain names to IP addresses
Given a file of FQDN, this simple command resolves the IP addresses of those Useful for log files or anything else that outputs domain names.


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: