Is there a way to create an alias that will open a pdf or other document to a particular position? For example, I have a 105 page pdf which I want to alias/shortcut to in a directory on my system. But I actually need page 36 of that file and I want an easy way to get there. Is there a way to create an alias that will open the pdf at page 36?

  • 3
    That will depend strongly on what program you use to open them. evince, for example, has a -p switch to open the specified page. – Ulrich Schwarz Aug 17 '16 at 5:48
  • @UlrichSchwarz Do you mean -i, --page-index option? – Costas Aug 17 '16 at 6:12
  • 1
    In any case, that is irrelevant to aliases or symlinks. The only way this could be relevant here is to make a shell script to do it. – Julie Pelletier Aug 17 '16 at 6:25
  • @Costas: both exist, they do different things if the page numbers in your pdf are i, ii, iii, iv, 1, 2, 3,… (-p 3 will give you the page that has page number 3, -i 3 will give you the third page, even if that says "ii" at the bottom.) – Ulrich Schwarz Aug 17 '16 at 9:52

'aliases' usually refer to command line aliases in shells, which may not be what you want if you're using a GUI. The closest thing to 'shortcuts' for files are symbolic links, but they are just a way of referencing a file by another name, not something that can be used to give command line arguments to a program.

A simple shell script may be the closest bet. E.g. create a file with the following content, and make it executable (chmod +x /path/to/the/script):

evince --page-label=36 /path/to/the/file.pdf

Running the script should launch evince and ask it to open the given file, on the given page.

As mentioned in the comments, the options required to open a document on a given position depend totally on the program. For evince, the --page-label parameter is mentioned in the command line help. Many (text mode) text editors and less support the option +NNN to jump to line NNN when opening a file. On the other hand, LibreOffice apparently saves the last viewed position per user in some cases. Check your programs' manuals.

  • An argument in an alias is ok. alias page36="evince --page-label=36 /path/to/the/file.pdf" – Tomasz Aug 18 '16 at 19:05
  • @tomas, sure, aliases with arguments for ls are likely the most common use. But aliases only work on the command line. – ilkkachu Aug 18 '16 at 19:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.