gs command in Linux with Examples Last Updated : 11 Jan, 2022 Comments Improve Suggest changes Like Article Like Report gs command invokes Ghostscript, which is an interpreter of Adobe Systems PostScript and Portable Document Format(PDF) languages. After executing Ghostscript it reads further input from the standard input stream until it encounters 'quit' command. Syntax: gs [ options ] [ files ] ... Options: Below are some important options of gs command. -P : Makes Ghostscript to look first in the current directory for library files.-q : Quiet startup: suppress normal startup messages, and also do the equivalent of -dQUIET.-rnumber, -rnumber1xnumber2 : Same as -dDEVICEXRESOLUTION=number1 and -dDEVICEYRESOLUTION=number2.If only one number is given, it is used for both X and Y resolutions.-dNOCACHE : Disables character caching. Useful only for debugging.-dNOBIND : Disables the "bind" operator. Useful only for debugging.-dNODISPLAY : Suppresses the normal initialization of the output device. This may be useful when debugging.-dNOPAUSE : Disables the prompt and pause at the end. This may be desirable for applications where another program is driving Ghostscript.-dSAFER : Restricts the file operations that job can perform.-sDEVICE=device : Selects an alternate initial output device.-sOutputFile=filename : Selects an alternate output file (or pipe) for the initial output device. Devices: PDF writer: The pdfwrite device outputs PDF.PS2 writer: The ps2write device outputs postscript language level 2. It is recommended that this device is used for PostScript output.EPS writer : The eps2write device outputs encapsulated postscript.PXL : The pxlmono and pxlcolor devices output HP PCL-XL, a graphic language understood by many laser printers.Text output : The txtwrite device will output the text contained in the document as Unicode. Examples: To view a PDF : gs -dSAFER syllabus.pdfTo convert a figure into png : gs -dSAFER -dNOPAUSE -sDEVICE=png16m -dGraphicsAlphaBits=4 -sOutputFile=front.png a.pdf See front.png created in the directory. To convert image to 150 dpi : gs -dSAFER -dNOPAUSE -sDEVICE=png16m -r150 -sOutputFile=front_1.png c.pdf You can observe the difference between the two images first one is 150 dpi and second is the original image. To convert all pages to image : gs -dSAFER -dNOPAUSE -sDEVICE=pgmraw -r150 -dTextAlphaBits=4 -sOutputFile='paper-%d.pgm' a.pdf To concatenate two PDFs : gs -dSAFER -dNOPAUSE -sDEVICE=pdfwrite -r150 -sOutputFile=concatenate.pdf a.pdf b.pdf c.pdf After executing the above command it will concatenate all three PDFs a.pdf, b.pdf, c.pdf, and save it as concatenate.pdf Comment More infoAdvertise with us V VivekAgrawal3 Follow Improve Article Tags : Linux-Unix Similar Reads gawk command in Linux with Examples The gawk command in Linux is a pattern scanning and processing language. No compilation is required, and variables can be used along with numeric functions, string functions, and logical operators. Gawk is a utility that enables programmers to write highly compact but still effective programs as sta 3 min read gcc command in Linux with examples GCC stands for GNU Compiler Collections which is used to compile mainly C and C++ language. It can also be used to compile Objective C and Objective C++. The most important option required while compiling a source code file is the name of the source program, rest every argument is optional like a wa 2 min read gdb command in Linux with examples GDB, the acronym for GNU Debugger, is a powerful debugging tool used to analyze and debug programs written in languages like C, C++, Ada, and Fortran. It allows developers to inspect the behavior of their programs, step through code, set breakpoints, and examine variable values in real-time. GDB is 8 min read getent command in Linux with examples The 'getent' command in Linux is a powerful tool that allows users to access entries from various important text files or databases managed by the Name Service Switch (NSS) library. This command is widely used for retrieving user and group information, among other data, stored in databases such as ' 5 min read gpasswd Command in Linux with examples gpasswd command is used to administer the /etc/group and /etc/gshadow. As every group in Linux has administrators, members, and a password. It is an inherent security problem as more than one person is permitted to know the password. However, groups can perform co-operation between different users. 4 min read grep command in Unix/Linux The grep command in Unix/Linux is a powerful tool used for searching and manipulating text patterns within files. Its name is derived from the ed (editor) command g/re/p (globally search for a regular expression and print matching lines), which reflects its core functionality. grep is widely used by 7 min read How to Create a new group in Linux | groupadd command In the Linux operating system, user management is a crucial aspect of system administration. One of the fundamental tasks is creating and managing user groups. Groups in Linux allow administrators to organize and control user access to various resources and files. The groupadd command is a powerful 7 min read How to Delete a Group in Linux | groupdel command Group management is a crucial aspect of Linux system administration, and understanding how to create, modify, and delete groups is essential for maintaining a secure and organized environment. In this article, we will delve into the process of deleting a group in Linux using the 'groupdel' command. 3 min read groupmod command in Linux with examples groupmod command in Linux is used to modify or change the existing group on Linux system. It can be handled by superuser or root user. Basically, it modifies a group definition on the system by modifying the right entry in the database of the group. Syntax: groupmod [option] GROUP Files: The groupmo 2 min read Groups Command in Linux With Examples In Linux, there can be multiple users (those who use/operate the system), and groups are nothing but a collection of users. Groups make it easy to manage users with the same security and access privileges. A user can be part of different groups. The 'groups' command is a powerful tool that allows ad 3 min read Like