Linux Commands Examples

A great documentation place for Linux commands


, compose, print execute programs via entries in the mailcap file

see also : view - see - compose - print - update-mime


run-mailcap --action=ACTION [--option[=value]] [MIME-TYPE:[ENCODING:]]FILE [...]

The see, edit, compose and print versions are just aliases that default to the view, edit, compose, and print actions (respectively).

add an example, a script, a trick and tips

: email address (won't be displayed)
: name

Step 2

Thanks for this example ! - It will be moderated and published shortly.

Feel free to post other examples
Oops ! There is a tiny cockup. A damn 404 cockup. Please contact the loosy team who maintains and develops this wonderful site by clicking in the mighty feedback button on the side of the page. Say what happened. Thanks!



Use vim to edit ANY text on Linux

It would depend on what file manager you are using, but most of them you can usually add some sort of right-click menu item to "Open in Vim".

I use Dolphin for KDE4. To add menu items (called service menus) you create a .desktop file in your service menus folder. In my system this resides in /usr/share/kde4/services/ServiceMenus but it may vary for your system.

Create the file open_in_vim.desktop with the following contents:

[Desktop Entry]

[Desktop Action openInVim]
Name=Open in Vim
Exec=gvim %u

Restart Dolphin (or Konqueror) and you should see this option when you right-click on a file.

If you would also like to be able to open folders in vim, then change the mime type to all/all.

If you would prefer to have "Open in Vim" appear under the Actions menu then remove the line, X-KDE-Priority=TopLevel

Granted, it's not intuitive, but you don't have to pay money in order to do it!


Tool like Media File Segmenter for Linux

Try ffmpeg. It's powerful & cross-platform. It may already exist in your linux distro. To copy 2 minutes of video after the first and convert from mpg to ts:

ffmpeg -vcodec copy -ss 00:01:00 -t 00:03:00 \
       -i input.mpg -vcodec copy -acodec copy \
       -f mpegts output.ts

It's a good choice if you have lots of videos in essentially random formats. It's a 'swiss army knife' for video.

If you are starting with mpeg, you could also try mpegtx, which includes a variety of mpeg tools including a splitter. Easier IMHO than ffmpeg to split. To split a file into 10 chunks each with a basename of 'chunk':

mpgtx -10 input.mpg -b chunk

You may also be able to use VLC as a splitter, but I never have. There are topics discussing it, however.


Irfanview nearest equivalent for linux

The standard answer is GIMP of course. But you might also like ImageMagick for batch processing.


Change first byte of file in Linux?

You can do something like echo -ne \\xFF | dd conv=notrunc bs=1 count=1 of=YOURFILE, replacing FF with your hex value. Try it first though :)


How can I edit a file if there is no vi, vim, joe, etc?

Did you wipe out /bin or something? Otherwise maybe you could hack something together with the text utilities in the GNU Coreutils that should be standard on a linux system.


Vim press ENTER to continue

Maybe this ?

:silent !ls


Command-line video concatenation and recompression?

My best bet is ffmpeg. It is powerful enough to do what you want.


Cheat Engine for Mac OS X or Linux

Mac OS X

There is a Mac port for Cheat Engine available for download from Softpedia.



Scanmem is a simple interactive debugging utility for Linux, used to locate the address of a variable in a running process. This can be used for the analysis or modification of a hostile process on a compromised machine, for reverse engineering, or as a "pokefinder" to cheat at video games.

GameConqueror is a GUI for scanmem, aims to provide more features than scanmem, and CheatEngine-alike user-friendly interface.

     [GameConqueror 0.12 on Xubuntu 12.04 LTS]

Ubuntu / Debian

Both scanmem and gameconqueror are available in the default Debian repositories and the Ubuntu "universe" repository.

They can be installed with the command:

sudo apt-get install scanmem gameconqueror


scanmem can be installed with the command:

sudo yum install scanmem

, but gameconqueror is not packaged for RPM.


The source code for scanmem and gameconqueror is available here.

It can be compiled like other Linux source software.


In vim's visual mode (type "v"), how do I select multiple lines?

Same as normal mode; use <n>G to go to a specific line.

Also, ShiftV.


How to copy remote machines text to local machines clipboard through SSH?

If you enable X forwarding then xclip can do this.

xclip -i -selection clipboard somefile


Could less show the viewed proportion of text file?

Do you mean like with the -M switch?


Modifiying a file in editor automatically

Notepad++ allows scripts and macros, it is also opensource, so you could easily change the "Save" command to run the script, with a little bit of elbow grease.


How can the Table of Contents in a PDF file be edited?

PDF is an image format. There is no storage of the contents of the table, only a "picture" of it. It can only be edited if the PDF's OCR can read the table as text, which is unlikely. You will need to use another application to create the table and then convert it to PDF.


VIM Editor: File Enconding and Line Endings

" Stick with the UTF-8 encoding.
if has('multi_byte')
  " Encoding used for the terminal.
  if empty(&termencoding)
    let &termencoding = &encoding

  " Encoding used in buffers, registers, strings in expressions, "viminfo"
  " file, etc.
  set encoding=utf-8

  " Encoding used for writing files.
  setglobal fileencoding=utf-8

" Use both Unix and DOS file formats, but favor the Unix one for new files.
set fileformats=unix,dos

NOTE: The merit of the last line is that both formats are displayed correctly in Vim buffer. For example, if you'd remove dos from fileformats, then all the dos files that you would open in Vim from now on would be cluttered with ^M symbols at line endings. This ^M is nothing else, but \r which Vim, in this case, would fail to interpret properly. Therefore, it is strongly recommended to keep fileformats as shown above. Don't worry, any new files that you create will be using unix format by default (as stated in the comment above).

If you encounter some file with dos format and want to convert it into unix, then type the following:

:set ff=unix


run-mailcap (or any of its aliases) will use the given action to process each mime-type/file in turn. Each file is specified as its mime-type, its encoding (e.g. compression), and filename together, separated by colons. If the mime-type is omitted, an attempt to determine the type is made by trying to match the file’s extension with those in the mime.types files. If the encoding is omitted, it will also be determined from the file’s extensions. Currently supported encodings are gzip (.gz), bzip (.bz), bzip2 (.bz2), and compress (.Z). A filename of "-" can be used to mean "standard input", but then a mime-type must be specified.

Both the user’s files (~/.mailcap; ~/.mime.types) and the system files (/etc/mailcap; /etc/mime.types) are searched in turn for information.

see picture.jpg
compose text/html:index.htm
extract-mail-attachment msg.txt | see image/tiff:gzip:-

All options are in the form --<opt>=<value>.

Performs the specified action on the files. Valid actions are view, cat (uses only "copiousoutput" rules and sends output to STDOUT) , compose, composetyped, edit and print. If no action is specified, the action will be determined by how the program was called.


Turns on extra information to find out what is happening.


Ignores any "copiousoutput" directive and sends output to STDOUT.


Displays the found command without actually executing it.


run-mailcap (and its aliases) is in the public domain (the only true "free").

see also



run-mailcap (and its aliases) was written by Brian White <bcwhite[:at:]pobox[:dot:]com>.

How can this site be more helpful to YOU ?

give  feedback