The other day I needed to convert a pdf document into an image file using ImageMagick and here are a few things I learned. Note: The following conversion examples were performed in the Linux terminal but ImageMagick is not limited to a Linux OS.
How to convert a single-page pdf into an image file:
convert file.pdf file.png
How to convert a multi-page pdf into multiple image files:
Note: The following command will output image files where the file names will following the pattern file_pg_#.png. e.g. file_pg_0.png, file_pg_1.png, etc.
convert file.pdf file_pg_%d.png
Want to learn more about ImageMagick? Check out their site here.
Occasionally you will need to make a link to a file or directory in Linux. To create a symbolic link you will need to use the ln command, which will follow the form of;
ln -s <target> <link name>
Example: Assume you frequently use gnome-calculator and decide you want a link on your desktop so you can quickly start that application in the future. To accomplish this with a symbolic link you could do the following;
ln -s /usr/bin/gnome-calculator ~/Desktop/calculator
You can also update an old symbolic link by overwriting the link using the following command.
ln -sf /usr/bin/gnome-calculator ~/Desktop/calculator
or when linking to directories you will need to include an n option
ln -sfn /mydir/ linkname
Recently I needed to learn how to access a http resource from work from my home computer. Being relatively new to ssh, I was completely unaware I could forward a port and access the required resource form my home computer.
If you can ssh into your work server, you can perform local port forwarding using the following ssh command.
ssh <username>@<hostname> -L <localport>:<host>:<hostport>
ssh email@example.com -L 8080:localhost:8057
The above example, forwards localhost:8057 from my work server’s to my home computer’s localhost:8080, giving me local access to a resource previously not accessible.
To learn more about local and remote port forwarding check out this website.
Ever want to know what your ip address is on your computer? In Linux, this can be easily determined using the command ifconfig. Typing
ifconfig into the terminal will provide the currently active network interface information including your ip address for your wireless, ethernet or local loopback network interfaces.
For more information about ifconfig check out this site.