Check Ubuntu version from command line

To discover what ubuntu linux version you have installed on a machine using only a command line you need to execute the following command on a shell:

lsb_release -a

This is a possible output for the command:

Split large files in parts from ubuntu linux without external software

Sometimes happens to me to have a file too large to fit on a pendrive or on a fat partition (wich doesn't support files greater than 4Gb) on Ubuntu or another linux distribution.

To move it from a pc to another you need to split it in parts smaller than 4Gb, move them separately and then rebuild the original file on the targer machine. To do this on ubuntu you don't need special software, you need only a shell with basic commands,

grep with AND operator from file

To make a grep on a file of two words that don't overlap you neet to use the OR operator as in the following example:

egrep ('word1'.*'word2')|('word2'.*'word1') FileName

This has been tested in ubuntu 12.04 but grep is a standard command so it's available in all the linux distributions like linux MInt, other Ubuntu versions, etc... and is also available in Apple systems as Snow Leopard, Lion etc...

Recursively erase files/folders with a find by name

The following command is an easy and fast way to recursively erase all the files and folders matching a specific pattern.

In the following example I needed torecursively  remove all the .svn folders from a specified base folder.

First you need to open a terminal and go to the base folder, then you need to execute the following command:

 

find . -name ".svn" -type d -exec rm -rf {} \; 

 

The \; is part of the command so you have to include it.

How to solve chromium error "your profile could not be opened correctly."

To solve the problem which sometimes occurs in chromium showing, when you start it, a popup "Your profile could not be opened correctly" in Ubuntu.

open a terminal and execute the following command:

mv ~/.config/chromium/Default ~/.config/chromium/Backup

Then start chromium, all will be ok, close it and in a terminal execute the following two lines:

rm -rf ~/.config/chromium/Default

cp -R ~/.config/chromium/Backup ~/.config/chromium/Default

Now open your browser and the issue is fixed!

Ubuntu tips

Here are reported some notes and tips to use Ubuntu.

OpenSSH public key access

This procedure allow to log-in to a ubuntu server with openssh without writing the password every time you access.

Generation of the key:

client$ mkdir ~/.ssh client$ chmod 700 ~/.ssh

client$ ssh-keygen -q -f ~/.ssh/id_rsa -t rsa

Enter passphrase (empty for no passphrase): …

Enter same passphrase again: …

 

Key protection on the client:

client$ chmod 700 ~/.ssh

Syndicate content