Commands by lucasjr76 (1)

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

Comment out a line in a file
This will comment out a line, specified by line number, in a given file.

find both total size and number of files below any given svn directory
afaik, svn doesn't have a good, scriptable way of telling you these two basic pieces of information.

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"

open manpage and search for a string
This will open the manpage for "foobar", and display all instances of "searched_string". You can traverse through them by pressing "n"

Change the ownership of all files owned by one user.
Finds all files in /home owned by UID 1056 and changes to 2056.

OSX command to take badly formatted xml from the clipboard, cleans it up and puts it back into the clipboard.
This command can be used with xclip or xsel for use on a linux box.

Convert images (jpg, png, ...) into a PDF
Converts images (maybe from scans) into a PDF

Create the signature base string required for a Twitter stream feed
This is the SECOND command in a set for five that are needed for a Twitter stream feed. This command creates variable "b", the so-called "base string" required for oauth in Twitter stream feed requests. (The 256 char limit prevents giving it a better name) We use five environment variables created by a previous step: id, k1, once, ts and k3. The five environment variables are created in a separate command, please see my other commands. For more information on the signature base string, see dev.twitter.com/apps, click on any app (or create a new one) and then go to the "OAuth Tool" tab.

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"

List all commands present on system
List all commands present on system by folder. $PATH contains all command folder separated by ':'. With ${PATH//:/ }, we change ':' in space and create a list of folder for ls command.


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: