Linux/Unix

AWK Remove Lines of Multiple Files

My girlfriend is a statistician and acquired some data in the form of 200 text files. The problem is that each file had two lines of non-informative description which needed removing. The goal was to process the data to remove the descriptive header. Instead of removing the lines from every file, I wrote this for [...]

Posted in Linux/Unix | No Comments »

rsync Tutorial and Help with Examples

rsync is what people used to use before Dropbox. It is used to sync remote folders with local ones. Say for example tha I have some work on my office computer in folder ‘foo’. It is the weekend and I need to work on this project but I don’t want to go into the office. [...]

Posted in Linux/Unix | No Comments »

How to crop a pdf when using the ps2pdf converter via -dEPSCrop

Often I find myself converting eps or ps to pdf files for inclusion in a latex document using the ps2pdf converter. The problem is that often when using ps2pdf I get a large white border around the figure of interest in my pdf file which was not included in the eps file. Obviously this is [...]

Posted in Linux/Unix | No Comments »

GNU Wget Tutorial

As a student, you may find yourself wanting to download lots of lecture slides and other materials off a module homepage, which can become quite an arduous task. Thankfully, GNU created Wget which is already on most linux machines. It is best demonstrated by example: wget -r -l5 -np -k -nH –cut-dirs=5 –load-cookies cookies.txt http://www2.warwick.ac.uk/fac/sci/physics/current/teach/module_home/px421/ [...]

Posted in Linux/Unix | No Comments »

Libraries

Compiling converts your source code into object or machine code, which the processor can understand. So the compiler produces an object file (.o) from your source code. The linker then pieces the object files together and herefrom produces an executable. If you wish to “compile only” i.e. to obtain merely the object file, you can [...]

Posted in Linux/Unix | No Comments »

at command

Scheduling a process to run automatically at a certain date and time can be quite useful. This is achieved with the at command. The at command reads a series of commands from the standard input and lumps them together into one single at-job to be executed at some point in the future. Syntax: at [-V] [...]

Posted in Linux/Unix | No Comments »

Kill – Killing Processes and the top Command

Sooner or later you will want to kill a process, whether it be some code executed in the background that is taking too long or simply a program that is misbehaving. If the code has been executed by the user in the background, then one can use the jobs command with the kill command: michael@michael-laptop:~$ [...]

Posted in Linux/Unix | No Comments »

Background Processes and the jobs Command

If your code takes a long time to run after execution, you may consider running it in the background. Consider the executable “test”, I run it as follows 1. Running Processes in the Background michael@michael-laptop:~$ ./test while it is running, you do much with the terminal. You can abort it with CTRL + C or [...]

Posted in Linux/Unix | No Comments »

Creating SSH Keys with ssh-keygen and ssh-copy-id

Have you ever gotten tired of constantly entering your password whenever ssh’ing a remote computer? You don’t need to! You can create a pair of SSH keys, namely a private and public one, which will save you from re-entering your password in the future. The private key you keep secret in your home folder and [...]

Posted in Linux/Unix | No Comments »