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

Selecting a random file/folder of a folder
I used only shuf command.

shell bash iterate number range with for loop
Bash's arithmetic evaluation.

Avoid killing the X server with CTRL+C on the tty it was started from

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"

Monitor memory fine-grained usage (e.g. firefox)
Sometimes top/htop don't give the fine-grained detail on memory usage you might need. Sum up the exact memory types you want

Listen to a song from youtube with youtube-dl and mpv
Explanation Firstly the function checks if user gave it any input, and notifies the user if they failed to do so. If user has inputed a search string, the function will call upon youtube-dl to find url of the audio of the first matching youtube video and play that with mpv. Call function by wrapping search string in quotes: listen-to-yt "sultans of swing" You have to paste the line in your .zshrc and source .zshrc for it to work. Limitations The dependancies are youtube-dl and mpv. this oneliner is stolen from http://www.bashoneliners.com/oneliners/302/

Disable the ping response
It really disables all ICMP responses not only the ping one. If you want to enable it you can use: $ sudo -s "echo 0 > /proc/sys/net/ipv4/icmp_echo_ignore_all"

Edit a PDF's metadata using exiftool
Edit the pdf file foo.pdf's metadata. -overwrite_original overwrites the original file (w/o it exiftool creates a new file)

calulate established tcp connection of local machine
If you want prepend/append text just wrap in echo: $echo Connected: `netstat -an|grep -ci "tcp.*established"`

Unzip 25 zip files files at once


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: