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 files recursively by size

tail: watch a filelog
-f file(s) to be monitorized -n number of last line to be printed on the screen in this example, the content of two files are displayed

Output as many input
Output of a command as input to many

Bash alias to output the current Swatch Internet Time
Output the current time in Swatch “Internet Time”, aka .beats. There are 1000 .beats in a day, and @0 is at 00:00 Central European Standard Time. This was briefly a thing in the late 1990s. More details: https://2020.swatch.com/en_ca/internet-time/ The alias is rather quote heavy to protect the subshell, so the bare command is: $ echo '@'$(TZ=GMT-1 date +'(%-S + %-M * 60 + %-H * 3600) / 86.4'|bc)

Remove lines that contain a specific pattern($1) from file($2).
The -i option in sed allows in-place editing of the input file. Replace myexpression with any regular expression. /expr/d syntax means if the expression matches then delete the line. You can reverse the functionality to keep matching lines only by using: $ sed -i -n '/myexpression/p' /path/to/file.txt

Testing hard disk reading speed

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"

Print number of mb of free ram
This will show the amount of physical RAM that is left unused by the system.

Rename files in batch

put command in a loop to keep trying a connection
This will keep trying to reconnect your netcat connection can be used with SSH or Telnet, just substitute nc for ssh or telnet very useful for troubleshooting VPNs were you want to send continuous packets towards a destination to trace.


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: