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

dump the whole database

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

Rename files in batch

Netstat Connection Check
This command does a tally of concurrent active connections from single IPs and prints out those IPs that have the most active concurrent connections. VERY useful in determining the source of a DoS or DDoS attack.

Extract domain from URl
Extracts 2nd-level domain part (or 3rd level, for co.* or com.*) from the URI's hostname. See sample output.

Realtime apache hits per second
Change the cut range for hits per 10 sec, minute and so on... Grep can be used to filter on url or source IP.

Double your disk read performance in a single command
(WARN) This will absolutely not work on all systems, unless you're running large, high speed, hardware RAID arrays. For example, systems using Dell PERC 5/i SAS/SATA arrays. If you have a hardware RAID array, try it. It certainly wont hurt. You may be can test the speed disk with some large file in your system, before and after using this: $ time dd if=/tmp/disk.iso of=/dev/null bs=256k To know the value of block device parameter known as readahead. $ blockdev --getra /dev/sdb And set the a value 1024, 2048, 4096, 8192, and maybe 16384... it really depends on the number of hard disks, their speed, your RAID controller, etc. (see sample)

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"

Check (partial) runtime-dependencies of Gentoo ebuilds
The output is only partial because runtime dependencies should count in also commands executed via system() and libraries loaded with dlopen(), but at least it gives an idea of what a package directly links to. Note: this is meaningful *only* if you're using -Wl,--as-needed in your LDFLAGS, otherwise it'll bring you a bunch of false positives.

Changing the terminal title to the last shell command
You can set the previous bash command as the terminal title by this command. Explanation: -trap assigns a command to execute at a given bash signal. -in the $BASH_COMMAND you find the last command -you can set the terminal title with the escape sequence: \e]0;this is the title\007 -to let the echo care about the backslashes give the -e to it Since trap is a built in bash command you find more informatin in 'man bash'for more Source: http://www.davidpashley.com/articles/xterm-titles-with-bash.html


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: