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

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

Shell function to create a directory named with the current date, in the format YYYYMMDD.
Creates a directory named with the current date, in the format YYYYMMDD. If you give it a directory name as an argument, it will create the new directory inside the specified directory. This is an alternative to command #1993.

Show Shared Library Mappings
shows which shared lib files are pointed to by the dynamic linker.

Use Dell Service Tag $1 to Find Machine Model [Model Name and Model Number]
255 Max Characters CommandLineFu for $dellurl='http://support.dell.com/support/topics/global.aspx/support/my_systems_info/en/details?c=us&cs=04&l=en&s=hied&ServiceTag='

Parallel file downloading with wget
xargs can be used in this manner to download multiple files at a time, and xargs will in this case run 10 processes at a time and initiate a new one when the number running falls below 10.

Get your commandlinefu points (upvotes - downvotes)
This version prints current votes and commands for a user. Pass the user as an argument. While this technically "fits" as a one liner, it really is easier to look at as a shell script with extra whitespace. :)

Generate a graph of package dependencies
Requires: imagemagick and graphviz On Debian systems, displays a graph of package dependencies. Works also with other image formats, like svg : $ apt-cache dotty bash | dot -T svg | display

recursive search and replace old with new string, inside files
If you can install rpl it's simpler to use and faster than combinations of find, grep and sed. See man rpl for various options. time on above operation: real 0m0.862s, user 0m0.548s, sys 0m0.180s using find + sed: real 0m3.546s, user 0m1.752s, sys 0m1.580s

identify NEEDED sonames in a path
This works in combination with http://www.commandlinefu.com/commands/view/10496/identify-exported-sonames-in-a-path as it reports the NEEDED entries present in the files within a given path. You can then compare it with the libraries that are exported to make sure that, when cross-building a firmware image, you're not bringing in dependencies from the build host. The short version of it as can be seen in the same output is $ scanelf -RBnq -F "+n#f" $1 | tr ',' '\n' | sort -u

Eavesdrop on your system
This command takes a snapshot of the open files for a PID 1234 then waits 10 seconds and takes another snapshot of the same PID, it then displays the difference between each snapshot to give you an insight into what the application is doing.


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: