Commands using sed (1,319)

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

Shell function to create a menu of items which may be inserted into the X paste buffer.
The function will take a comma separated list of items to be 'selected' by xsel -i: $ smenu "First item to paste,Paste me #2,Third menu item" You will then be prompted to choose one of the menu items. After you choose, you will be able to paste the string by clicking the middle mouse button. The menu will keep prompting you to choose menu items until you break out with Control-C.

post data with a http request

Install pip with Proxy
Installs pip packages defining a proxy

Get AWS temporary credentials ready to export based on a MFA virtual appliance
You might want to secure your AWS operations requiring to use a MFA token. But then to use API or tools, you need to pass credentials generated with a MFA token. This commands asks you for the MFA code and retrieves these credentials using AWS Cli. To print the exports, you can use: `awk '{ print "export AWS_ACCESS_KEY_ID=\"" $1 "\"\n" "export AWS_SECRET_ACCESS_KEY=\"" $2 "\"\n" "export AWS_SESSION_TOKEN=\"" $3 "\"" }'` You must adapt the command line to include: * $MFA_IDis ARN of the virtual MFA or serial number of the physical one * TTL for the credentials

sends your internal IP by email
This is useful if you have need to do port forwarding and your router doesn't assign static IPs, you can add it to a script in a cron job that checks if you IP as recently changed or with a trigger script. This was tested on Mac OSX.

Outputs a 10-digit random number

Vi - Matching Braces, Brackets, or Parentheses
This is a simple command for jumping to the matching brace, square bracket, or parentheses. For example, it can take you from the beginning of a function to the end with one key stroke. To delete everything between the pairs of {}, [], or (), issue the command: $ d% To replace text between pairs of braces, brackets, or parentheses, issue the command: $ c% You can also use this command to find out if an opening brace has been properly closed.

VMware Server print out the state of all registered Virtual Machines.
I use this command on my machines running VMware Server to print out the state of all registered Virtual machines.

Change active bond slave
This forces a bonded interface to switch to another slave in the bond as its active slave.

Print just line 4 from a textfile
this method should be the fastest


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: