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

VIM: Replace a string with an incrementing number between marks 'a and 'b (eg, convert string ZZZZ to 1, 2, 3, ...)

copy ACL of one file to another using getfacl and setfacl
If you copy windows file in e.g. cygwin the ACL might miss on the copied file. With this command you can copy the ACL of an existing file to another. WARNING: Existing ACL will get lost.

vim multiple files at one time, split vertically.

Look for IPv4 address in files.
It finds a SNMP OID too :-(

Matrix Style
I like the fact the Patola's version uses only ones and zeros, but I also like the sparse output of the other versions. This one combines both of those features and eliminates some unnecessary cruft. You can vary the sparseness by changing "$(($RANDOM % 5))" to another number. The number in this term "$(($RANDOM % 4))" controls how frequently the numbers are output bold.

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

List your interfaces and MAC addresses
Requires sysfs mounted on /sys - may only be useful for Linux systems. Could also use "printf '%-8s %s\n' $(basename $f) $(cat $f/address)" instead of echo.

Find out which debian package a command (executable) belongs to on debian-based distros
This revision to my command (command #8851) was called for when it failed to find the parent package of 'rlogin', which is really a deep symbolic link to /usr/bin/ssh. This revision fixes this newfound issue, while ensuring fixes of other older issues work too.

awk using multiple field separators
You can use multiple field separators by separating them with | (=or). This may be helpful when you want to split a string by two separators for example. #echo "one=two three" | awk -F "=| " {'print $1, $3'} one three

clear current line


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: