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

Detect illegal access to kernel space, potentially useful for Meltdown detection
Based on capsule8 agent examples, not rigorously tested

Automator Bash script to create Clean zips in MacOS Finder without __MACOSX metadata
Finder compresses to ZIP but always includes extraneous metadata files (__MACOSX and .DS_Store) files and folders that may confuse other programs. One alternative is creating them and then editing the ZIP. This can work standalone or in an automator script accepting multiple selections (files or folders) and creating one zip per argument/selected file without that metada.

Count occurrences per minute in a log file
The cut should match the relevant timestamp part of the logfile, the uniq will count the number of occurrences during this time interval.

List all installed kernels on Ubuntu except current one
Lists all installed kernels minus the current one. This is useful to uninstall older kernels that take too much space on /boot partition.

Show directories in the PATH, one per line
This version uses Pipes, but is easier for the common user to grasp... instead of using sed or some other more complicated method, it uses the tr command

Symlink all files from a base directory to a target directory

Get the current gold price
Returns the current price of a troy ounce of gold, in USD. Requires the "jq" JSON parser.

Block all IP addresses and domains that have attempted brute force SSH login to computer
I use iptables. To rate limit connections. Very easy and no ban lists to manage.

save date and time for each command in history
Date-time format: YYYY-MM-DD HH:MM:SS

Watch YouTube and other Flash videos via mplayer (or whatever)
Many sites with Flash video players will download video files to /tmp on Linux, with temporary filenames like "FlashbGTHm4". These will often play in mplayer, totem, or other movie playing software. You must first navigate to a video page, let it start loading, and then pause playback.


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: