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

Set your profile so that you resume or start a screen session on login
From screen's manpage: "Attach here and now. In detail this means: If a session is running, then reattach. If necessary detach and logout remotely first. If it was not running create it and notify the user. This is the author's favorite." Toss this in your ~/.bash_profile so that you never have that "oh crap" moment where you wanted to run something in screen and didn't.

find the biggest files recursively, no matter how many
This command will find the biggest files recursively under a certain directory, no matter if they are too many. If you try the regular commands ("find -type f -exec ls -laSr {} +" or "find -type f -print0 | xargs -0 ls -laSr") the sorting won't be correct because of command line arguments limit. This command won't use command line arguments to sort the files and will display the sorted list correctly.

Generate random valid mac addresses
Ruby version. Also, a perl version: $perl -e 'printf("%.2x.",rand(255))for(1..5);printf("%.2x\n",rand(255))'

Sort lines on clipboard
Does the same thing in environments where you have "xclip" instead of "pbpaste"/"pbpate" and "pbcopy".

Get your external IP address without curl
Curl is not installed by default on many common distros anymore. wget always is :) $ wget -qO- ifconfig.me/ip

Last Minute Cheap Essay
Writing a paper is never an easy chore. When students start college, they are confronted with a variety of new situations, but one of the most difficult is completing projects before the deadline. Many students' physical and mental health can suffer as a result of pressure, stress, and anxiety. International students face significant difficulties because English is a difficult language for them. After lessons and long college hours, many students don’t have the time or energy to write extensive essays. Students can be seen juggling classes, jobs, social lives, and finding time for themselves. I need someone to write an essay for me, you might be thinking. Prepare to be surprised! With our assignment service, we can help you get rid of all of your troubles. We will write an A+ essay for you to ensure that you get good grades on your tasks.

A command to post a message and an auto-shortened link to Twitter. The link shortening service is provide by TinyURL.
A command to post a message and an auto-shortened link to Twitter. The link shortening service is provided by TinyURL.

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"

Search git logs (case-insensitive)
Normally, searching git log comments is case sensitive. The -i luckily applies to the --grep switch.

Umount only the NFS related to 'string'
Sometimes, you have a lot of NFS in the server and you can't or shouldn't use umount -a. Whis this command, you only umount the fs related to the 'string'


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: