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

list block devices
Shows all block devices in a tree with descruptions of what they are.

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

resume scp-filetransfer with rsync
resume a partial scp-filetransfer with rsync

Convert CSV to JSON
Replace 'csv_file.csv' with your filename.

Randomly run command
Randomly decide whether to run a command, or fail. It's useful for testing purposes. . Usage: ran PERCENTAGE COMMAND [ARGS] Note: In this version the percentage is required. . This is like @sesom42 and @snipertyler's commands but in a USABLE form. . e.g. In your complicated shell script, put "ran 99" before a crucial component. Now, it will fail 1% of the time allowing you to test the failure code-path. $ ran 99 my_complex_program arg1 arg2

Mount a partition from dd disk image
Assuming we have a disk image, ie. created by $dd if=/dev/sda of=image.dd we can check the image's partition layout with $fdisk -ul image.dd then, we substitute "x" with starting sector of the partition we want to mount. This example assumes that the disk uses 512 B sectors

Greets the user appropriately

Recursive cat - concatenate files (filtered by extension) across multiple subdirectories into one file
Useful if you have to put together multiple files into one and they are scattered across subdirectories. For example: You need to combine all .sql files into one .sql file that would be sent to DBAs as a batch script. You do get a warning if you create a file by the same extension as the ones your searching for. find . -type f -name *.sql -exec cat {} > BatchFile.txt \;

delete multiple files from git index that have already been deleted from disk
delete multiple files from git index that have already been deleted from disk. this is pretty terrible, I'm looking for a better way. (much better!! http://www.commandlinefu.com/commands/view/1246/git-remove-files-which-have-been-deleted)

Benchmark report generator
Nicely display in html format a detailed report of the machine, including cpu benchmarks.


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: