Commands using sort (800)

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

stream a youtube video with mpv where $1 is the youtube link.
opens a new session with video stream

Grab an interface's IP from ifconfig without screen clutter
Sometimes, you don't really care about all the other information that ifconfig spits at you (however useful it may otherwise be). You just want an IP. This strips out all the crap and gives you exactly what you want.

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"

Capture screen and mic input using FFmpeg and ALSA
Yet another x11grab using ffmpeg. I also added mic input to the capturing video stream using alsa. Yet I need to find out how to capture audio which is currently playing.

AES file encryption with openssl
To decrypt: openssl aes-256-cbc -d -in secrets.txt.enc -out secrets.txt.new Reference: http://tombuntu.com/index.php/2007/12/12/simple-file-encryption-with-openssl Optional parameter -a makes output base64 encoded, can be viewed in text editor or pasted in email

Start an X app remotely
Launch a gui app remotely. In this example smplayer is installed on the remote machine, and movie.avi is in the remote user's home dir. Note that stdout/stderr is still local, so you'll have feedback locally, add '&>/dev/null' to suppress. This is surprisingly not well known (compared to running an X app locally via ssh -X). (NB. if your distro requires ~/.Xauthority file present, then try -fX if you have problems) Resubmitted (and trimmed, thanks sitaram) due to ridiculous voting on previous submission. Fingers crossed, it gets a better rating this time.

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

Copy ssh keys to user@host to enable password-less ssh logins.
Alternative for machines without ssh-copy-id

make, or run a script, everytime a file in a directory is modified
Uses inotifywait from inotify-tools ( http://wiki.github.com/rvoicilas/inotify-tools/ ), that is compatible only with linux. Usefull when you work with files that have to be compiled.. latex, haml, c..

check open ports without netstat or lsof


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: