As the doctor gone rogue

November 3, 2015

Add exising users to an existing group in Ubuntu

Filed under: ubuntu — Tags: , — hypotheses @ 1:22 am

sudo usermod -a -G groupName userName

October 9, 2015

apt-get error with … for package ‘linux-headers-3.2.0-60’ is missing final newline

Filed under: Uncategorized — Tags: , , , — hypotheses @ 7:49 am

I recently clone a virtual machine image and setting up locally. When trying to install a new package through <code>apt-get</code> in Ubuntu. I ran into a strange problem of “missing final newline” in linux-headers.

Trying to google for solution, I found a page in 2004 mentioning this problem. It suggested that a file in /var/lib/dpkg/info/smbf.list is the cause of the error. So, I tried to locate this file but without any success.

I notice that there is “linux-headers-3.2.0-60.list” and a few other files with similar names in this folder. So, well, why not trying to delete them.

It seems like deleting these files fix the problem and allow apt-get to install the package without any problems. So far the system seems normal. We haven’t allowed any additional access through the server, only deleting a few files that don’t look essential for the OS to run.

Further remove other apt-get unused file through apt-get clean seems to solve the problem.

June 21, 2013

How to install software or upgrade from old unsupported release? – Ask Ubuntu

Filed under: miscellaneous — Tags: , , — hypotheses @ 10:34 pm

I'm trying to install CNVWorkshop (cnv.chop.edu), but now facing problem of running Ubuntu 10.10 which has faced the end-of-life since April 2013. So, now running "sudo apt-get install" anything would not work, since the repo was set to look for files from archive.ubuntu.com.
AAfter spending sometimes 'google' as usual, here's where I end up.

Not that I intended not to upgrade to a newer release, but this is probably a relatively faster way to deploy another software that I still need to use.

sudo sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list
sudo apt-get update && sudo apt-get dist-upgrade

 

via How to install software or upgrade from old unsupported release? – Ask Ubuntu.

March 2, 2011

Using cut to extract specific columns from a fixed-width format file

Filed under: bash, data management — Tags: , , , , — hypotheses @ 12:07 pm

Occasionally, I will have to deal with a text file in a fixed width text format. In Linux, you can extract specific columns easily using cut

cut -b 1-10,15-20 < infile

This will give you column 1-10 and 15-20 of your “infile”

The additional option that is nice when you want to get rid of a few columns and keep the rest of them is using the option –complement (although from what I have heard, some systems might not have this implemented).

cut –complement -b 11,14,32,43-47,58-62,73-77,88-92,103-108 < infile

Other use of cut is to extract columns from any other type of file with delimiter such as “,” or space

by adding the option -d”_your_delim_” to the example above, and you can extract your infile.csv or infile.txt as well.

 

Create a free website or blog at WordPress.com.