Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Apr 202010
 

Are there any Linux equivalent of the Mac OS X "open" command?

Answer:

The Mac OSX's open command is a very handy tool for opening file, without the need to sepcify the program name.

In Linux, you have two choices:

1. xdg-open

# xdg-open test.html

2. see

# see test.html

Both command will open the file by your default web browser.

Apr 112010
 

Insert search string back to the result in sed

Answer:

Following command will replace "foo" by "bar", using the sed.

# echo "foo" | sed 's/foo/bar/'

But how to append the word "foo" at the end of "bar"?

Here is the solution with the & (& defines the pattern found in the search string)

# echo "foo" | sed 's/foo/bar&/'