Sometimes you might need to test whether a specific port is open in Linux based on your firewall rules. Without having to install specific software (e.g, telnet server for port 21) you can test this using netcat.
This can be handy if you need to prove to a service provider that they are blocking your ports.

Example, port 21

On the server side:
For ports under 1000 you must be root/sudo user

sudo netcat -l 21

On the client side

netcat [server ip] 21

It will look like nothing has happened. On the client side, just type some random words, e.g. “Hello World!” and hit [ENTER]. If the connection was successful, you should see the same words echoed on the server side.

To end the session you can either use CTRL+C on the server side (will kill both sides) or CTRL+D on the client side (will only kill the client side)

In a previous article, Linux – Enable auto-login via SSH, I explained how you can eliminate the need to enter your password every time you log on to a specific host.

You might run into a problem where you get the following error message:
“Agent admitted failure to sign using the key”

You then need to type in the password again. Pointless.

To fix it is quite simple:
Continue reading

Ubuntu text boot

First things first – remember, always back up important system files before editing!

If you want to view the tradional kernel message output when booting into Ubuntu, you can do it as follows:

Edit /etc/default/grub and edit the following line:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

Change it to:
Continue reading

apt-get logo

Experience the following?:

<snipped>
...
...
Hit http://us.archive.ubuntu.com trusty-backports/multiverse Translation-en    
Hit http://us.archive.ubuntu.com trusty-backports/restricted Translation-en    
Hit http://us.archive.ubuntu.com trusty-backports/universe Translation-en      
Ign http://us.archive.ubuntu.com trusty/main Translation-en_US                 
Ign http://us.archive.ubuntu.com trusty/multiverse Translation-en_US           
Ign http://us.archive.ubuntu.com trusty/restricted Translation-en_US           
Ign http://us.archive.ubuntu.com trusty/universe Translation-en_US             
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/trusty-updates/main/i18n/Translation-en  Hash Sum mismatch
 
E: Some index files failed to download. They have been ignored, or old ones used instead.

The cause is likely a corrupt package file previously downloaded. You can fix it by doing the following:

sudo rm -rf /var/lib/apt/lists/*
sudo apt-get update

apt-get logo

More often than not, I have to deploy a system which will not have access to the internet or an apt-proxy/apt-cacher installations somewhere. This means I cannot install new packages which might be required at a later stage.

I’ll use an example install of postgresql to explain how you can get all the required files (specifically for your machine) and deploy it on your server.
Continue reading

avconv must be installed

Make sure you have a list of JPEG files in one directory and that they are named sequentially i.e.

DSC_5015.JPG
DSC_5016.JPG
DSC_5017.JPG
...
...

Some versions of avconv will insist on the files starting with ‘0000’ somewhere in the first file. To rename the files, use the following command:-

ls *.JPG| awk 'BEGIN{ a=0 }{ printf "mv %s myfile%04d.JPG\n", $0, a++ }' | bash

This will rename all your files to:-

myfile0000.JPG
myfile0001.JPG
myfile0002.JPG
...
...

If you wan to create a clip with the original resolution (4256 x 2832 in this case) with high quality, use the following command:-

avconv -y -r 10 -i myfile%4d.JPG -r 10 -vcodec libx264 -q:v 3  -vf crop=4256:2832,scale=iw:ih tlfullhiqual.mp4;

-y forces avconv to overwrite any file
-r 10 creates a clip with 10 frames per seconds (for some versions of avconv you have to specify it twice)
-i specifies the input file(s). %4d means any 4 decimal numbers
-vcodec specifies the video codec to be used (H.264 in this case)
-q:v specifies the quality, value ranges from 1 (best) to 31 (worse)
crop= specifies which area of the images will be cropped
scale= indicates how much scaling must take place (in the above example iw:ih indicates that the output width and height will be that of the in width and in height)
the last parameter is the output file

To create a clip that is a quater of the height and width as the original with less image quality, use the following command:-

avconv -y -r 10 -i myfile%4d.JPG -r 10 -vcodec libx264 -q:v 20 -vf crop=4256:2832,scale=iw/4:ih/4 tlsmallowqual.mp4;

To create a .flv file

avconv -y -r 10 -i myfile%4d.JPG -r 10 -vcodec libx264 -q:v 3 -vf crop=4256:2832,scale=320:-1 -c:v flv tlsmallest.flv;

Here I moved the quality up, because the resolution is low

Enter your Ubuntu credentials

This is an update of a previous post, found here. I’ve added a section to the bottom which explains how you can connect to the same session each time.

If you need to connect to a Linux machine, and in the scope of this guide, Ubuntu 14.04 (I’m sure this guide should be fine for earlier versions as well), then your options include:

  • Pure and simple SSH – The admin’s super tool! (just install openssh-server – works every time!)
  • VNC – I don’t like this method because you need to install software on your client AND server
  • XRDP – This still involves VNC to some degree but you can use the normal Windows Remote Desktop Client

The latter is the one I’ll guide you through here. Continue reading