Archive for the 'Linux' Category
I finally made the leap to doing most of my research on computers that run on Linux. The distribution I’m using is Ubuntu. So far I’ve found it quite good. One thing I do frequently is open a Terminal (command) window in a specific directory. However, when you open the Terminal, it by default opens [...] Read more »
April 24th, 2010 | Posted in Linux | No Comments
I was trying to install some packages in R recently that depended on the XML package. I used the nifty install.packages() command, but I was getting an error:
“cannot find xml2-config”
This error was preventing these other packages from being installed properly. It turns out that I needed to install a library called libxml2-dev. In my case, [...] Read more »
April 22nd, 2010 | Posted in Linux, R | No Comments
I installed cygwin, which allows you to execute Linux-based applications on your Windows machines. But what I wanted to do was connect (using ssh) to a Linux box and run an application that has a GUI from there. In this case, I wanted to be able to connect to server and run firefox from the [...] Read more »
December 28th, 2009 | Posted in Linux | No Comments
Cygwin is a software tool that allows you to run Linux programs in Windows. I have had good success in using it to run commands locally and to connect to other servers via ssh, scp, etc. I just got a new computer and installed the latest version of Cygwin, but when I tried to ssh [...] Read more »
September 29th, 2009 | Posted in Linux | No Comments
I’m learning something new about Linux every day, so this is something that will probably be obvious to many of you out there. But I needed today to read the contents of a file into a variable in a bash script. The simple way to go about doing this is to use the following command:
myvar=`cat [...] Read more »
September 11th, 2009 | Posted in Linux | No Comments
I am running an application in one location on the file system, and I need to be able to invoke an application that is in a different directory on the file system. Due to personal preference, this other directory is not specified in the PATH variable. So I’m wondering how I can get Linux to [...] Read more »
September 9th, 2009 | Posted in Linux, Tip | No Comments
In Linux, you sometimes want to run a command when the server first starts up. I was doing this recently where I would have to manually go in and run a command each time the server got rebooted. This was a pain, so with a little help from my friend Martin, I learned how to [...] Read more »
September 4th, 2009 | Posted in Linux, Tip | No Comments
I’m sure this one will be obvious to many readers, but it wasn’t to me, so I’m going to share it. A bash script is a file that you can run at the command line in Linux/Unix environments to automate something. In my case, I have a Java program that I need to run over [...] Read more »
June 30th, 2009 | Posted in Linux | No Comments
I recently had a scenario where part of what I wanted to do was in Java, and the other part was in an application that was written in Python. Rather than than rewrite my entire code base in one language or the other, I wanted to find a (quick and dirty) way to invoke the [...] Read more »
June 4th, 2009 | Posted in Java, Linux, Python, Tip | No Comments
In Linux, you have the ability to determine which processes are running at a given time on the server. This post explains how to do this using the top command.
Let’s say you have a process that is not getting as much CPU time as you would like, maybe because it is getting beat out by [...] Read more »
January 7th, 2009 | Posted in Linux, Tip | No Comments
Linux comes in many flavors. If you did not perform the installation (or forgot), you may need to find out which flavor is being run on a given box. In Linux, it is pretty easy to do this. Simply type the following command at the command line, and it will give detail about it:
cat /proc/version Read more »
January 6th, 2009 | Posted in Linux, Tip | No Comments
If you want to be able to encrypt and decrypt files with Python, you might check out the following sites:
http://www.dlitz.net/software/pycrypto/
http://www.amk.ca/python/code/crypto.html
However, if you know you’re going to only be using Linux, I recommend doing file encryption as explained in this post. You can invoke commands at the command line by following the explanation here. Read more »
December 20th, 2008 | Posted in Linux, Python, Tip | No Comments
Say you log in to a Linux machine but then want to switch to a different user. You can do this without logging out as the first user. A time when this might come in handy is when you are logged in as a regular user but want to install some software as the root [...] Read more »
December 20th, 2008 | Posted in Linux, Tip | No Comments
When you are installing modules in Python that need to be available to Python scripts stored in various locations on the server, you can use PYTHONPATH to specify where those resources are on the server. This environment variable tells Python where to find those modules/libraries.
This post explains how to set environment variables in Linux. You [...] Read more »
December 12th, 2008 | Posted in Linux, Python, Tip | No Comments
In Linux, a common way to edit text files is to use a utility called vi. I haven’t used it a lot, but from what people tell me, it takes awhile to get used to (you do everything with keystrokes rather than a mouse), but once you figure it out it is very powerful.
To edit [...] Read more »
December 11th, 2008 | Posted in Linux, Tip | No Comments
I have an application that relies on environment variables to find shared object files. If these are not in place, I get an error like “lib.so: cannot open shared object file: No such file or directory.”
If I set these variables the following way, it works temporarily:
export VARIABLE_NAME=/path/abc
But I want it to persist for all sessions [...] Read more »
December 9th, 2008 | Posted in Linux, Tip | No Comments
Let’s say you have a file on your Linux server and want to copy it to another server. Or vice versa. You can also copy files from one remote server to another. An easy way to do this is with the scp tool, which is built on top of ssh.
Open a command line. The command [...] Read more »
December 3rd, 2008 | Posted in Linux, Tip | No Comments
This is pretty straightforward to experienced Linux users, but it wasn’t obvious to me when I started using Linux. Linux has a nifty program that will tell you what processes are currently running, how much memory/CPU they are using, etc. It also allows you to kill processes that may be running in the background.
At the [...] Read more »
October 30th, 2008 | Posted in Linux, Tip | No Comments
One tool I’ve found really useful and easy to use for encrypting files is called bcrypt. This is an open source project that uses the BlowFish encryption algorithm. All you have to do is enter the file pattern for the files you want to encrypt and a password. Then when you want to decrypt them, [...] Read more »
October 4th, 2008 | Posted in Linux, Tip | 3 Comments
First you must determine the PID of the process you want to kill. This can be done usually pretty easily with the top command in Linux. When you type top at the command line, it shows you the processes that are consuming the most resources at the time on the system. Most likely the one [...] Read more »
August 27th, 2008 | Posted in Linux, Tip | No Comments