Category: Linux

linux mint map network drive
February 4th, 2019 by ronny

Linux Mint map network drive is a must if you are into Linux and home servers. Connect to network drive from Linux can be a bit more challenging compared to Windows, but a lot more stable. The only thing you need to do is to add the network location to fstab for automatic connection instead of mounting it for each time.

The cool thing about mounting a network drive in Linux is that you can mount it to be anywhere you like. In this example we will add a folder called Storage and we will me mount it in our home folder.

This is how to map a drive on a Samba server. You need to be root or sudo to do the changes. Open the /etc/fstab file and in this Linux mount example we will add a network drive on Add the line below to the end of your fstab file.

Linux Mint map network drive.

// /home/john/Storage cifs username=john,password=mypassword,noperm,dir_mode=0777,file_mode=0777,iocharset=utf8,_netdev 0 0

The line above should all be on one line. You will of course need to edit it to match your system. That is how a Linux mount network drive works. To make it active you can just reboot your computer now. You should now see the network location in your home folder. It will also appear when using the df -h command.

Check out on how to remove symbolic links in Linux

Posted in Linux, Linux Mint Tagged with:

F10 in Midnight Commander
January 9th, 2019 by ronny

Because of the default settings in several Linux Distros you will not be able to use F10 to exit Midnight Commander. However the solutions is simple.

I use Linux Mint Debian Edition for most of my Linux Desktop usage. And I belive it is the same issue with F10 opens a menu instead of closing Midnight Commander in several other Distros as well. 

How to fix it

This is how you can start using F10 to close Midnight Commander. First open the Terminal. In the menu go to Edit and select Preferences. In the preferences window uncheck the options that says “Enable the menu accelerator key”.

Now to need to close the terminal and open it again for the change to take effect. Now you should be able to use F10 to close MC. Enjoy your F10 and MC.

Please also check out, if of any interest, how to copy file with progress bar in Linux by using Midnight Commander.

Midnight Commander home page.

Posted in Linux, Linux Mint Tagged with: , , ,

How to remove symbolic link
December 19th, 2018 by ronny

A short tutorial on how to remove symbolic link in Linux, or Softlink. Symbolic links can be removed or deleted in two different ways. One method is to delete the directory the symbolic link is linking to. The other method is to use the unlink command to remove the symlink.

Method one:

Let’s say you have installed Mediawiki and linked it to /var/www/html/mediawiki. And you want to remove that link. You just simply delete it by: rm /var/www/html/mediawiki

Method two:

We use the same example as above. But this time we use the unlink command instead of rm. That is all really. Just type: unlink /var/www/html/mediawiki

No mater what method you choose, both work as the should delete symlink. That’s how to delete symbolic link or remove symbolic link.

Please also check out How to find the fastest Debian mirror for you.

Posted in Linux Tagged with: ,

scp compression
June 10th, 2018 by ronny

Scp compression can speed up SCP file transfer, and sometimes not. To send a file via ssh is practical if you enjoy working inside the terminal window. Scp between Linux servers is my favorite casual file transfer tool when working in ssh.

Scp compression

There is a built-in compression tool into scp. This can save you a lot of bandwidth as it uses gzip to compression your files before transferring your files. Your files will be automatically decompressed on the other end. So it is an easy and convenient way to save bandwidth and speed up SCP file transfer. But not always. Be aware of that.

If you are on a high-speed connection to your remote machine. Either it could be at home or in the same datacenter as you, or maybe between virtual machines on the same host. The SCP compression is more likely to slow down your SCP file transfer instead of speeding it up. The reason is SCP uses the CPU to compress your files. Unless you got a high-end CPU it might take longer to compress the files, than it takes to send them. Or is that true?

I did a few tests on my home network. I got to large files. A 2.5GB Iso file and a 1GB text file I wanted to measure the transmission time to see which method was fastest. My home network runs on a 1Gbit Cisco Switch, and the servers all have 1Gbit network cards. Let us test some secure copy Linux!

Local CPU: Intel(R) Xeon(R) CPU E3-1240 V2 @ 3.40GHz
Remote CPU: Intel(R) Xeon(R) CPU E5620 @ 2.40GHz

Scp compression testing

Test 1 – 2.5GB Iso file with no compression
Transfer speed was 89.0MB/s and the time used was 31 seconds.
Test 2 – 2.5GB Iso file with compression
Transfer speed was 89.0MB/s and the time used was 31 seconds.

So exact speed and time in both tests. Buy maybe the iso file was already compressed to a level where it couldn’t be more compressed? That could mean the nothing for SCP to compress. Let us find out with a large text file. I created a random text file on a total of 1GB. A text file can usually be compressed quite a bit.

Test 3 – 1GB text file with no compression
Transfer speed was 83.3MB/s and time used was 12 seconds

Test 4 – 1GB text file with compression
Transfer speed was 83,3MB/s and time used was 12 seconds

Identical results again. How can this be? The computers were not virtual machines on the same host, and the result was identical in both tests. I even tried to scp to a remote host in a data center in another country. Since my internet connection is very limited I didn’t transfer the largest files. There were finally a small difference.

Test 5 – 100MB text file with no compression
Transfer speed was 1.2MB/s and time used was 1 minute and 24 seconds.

Test 6 – 100MB text file with compression
Transfer speed was 1.4MB/s and time used was 1 minute and 13 seconds.

SCP compression – Last test

It makes sense that a compressed text file should take less. But not much of a difference, and it could very well be caused by a lot of things. Like connection, somewhere between here and Germany or my son downloading some crap. Let us run the test again to be sure.

Test 7 – 100MB text file with no compression
Transfer speed was 1.4MB/s and time used was 1 minute and 14 seconds.

Test 8 – 100MB text file with compression
Transfer speed was 1.7MB/s and time used was 1 minute and 0 seconds.

The difference in time is the same, but the speed was a little higher this time. So it looks like you can save some time compressing text files on a very limited connection.

SCP usage

Let us look a little bit on how to use SCP. To SCP multiple files you add the parameter -r (for recursive), that will copy the entire folder. Scp example on how to SCP copy directory:
Scp -r mydirectory user@myhost

You can also use wildcard (*) to copy multiple files at ones. Just use the wildcard like in any other Linux command involving wildcard. An little example SCP to remote using wildcards to copy multiple files. This example will transfer all file starting with myfiles:
Scp myfiles* user@myhost

Another quick example on how to scp from remote to local. There is no need, even though it is quick and simple with ssh, to login to the remote host to send files to your local machine. Just download the file with SCP. Another SCP command example:
Scp user@host:/file-path

If you liked my scp compression article check out my other ssh articles linked above for more information. Or read my article about slow ssh login on Debian systems. Or read more about secure copy.

That it about scp compression.

Posted in Debian Tagged with:

install php ziparchive
May 30th, 2018 by ronny

PHP ZipArchive is a file archive for zip compression used by many web applications and plugins. How to install PHP ZipArchive for Debian is an easy task. Let’s see how we install it.

PHP ZipArchive Library is missing or disabled

PHP ZipArchive Library is missing or disabled is the usual message you get if it is missing or disabled. So let’s assume it is missing, as in not installed. You only need to run one line of commands.

sudo apt-get install php7.0-zip

Now you should have installed PHP ZipArchive. Don’t forget to restart your web server too. If you are running Apache2, just run:

sudo service apache2 restart

PHP ZipArchive should be ready for your web application or plugin now.

To read more about the PHP ZipArchive package, go to the Debian package site.

You might also be interested in how to install phpPGAdmin.

Posted in Apache, Debian, Linux Tagged with:

fastest debian mirror
April 22nd, 2018 by ronny

The fastest Debian mirror or repository can be found by using a small tool called netselect apt (or netselect-apt as the package name). Unless you run your own local apt repository, check this article on how to find the fastest Debian apt mirror for you. This will, of course, vary depending on where you live or connect to the internet from.

Find the fastest Debian mirror for you

You could do a manual mirror check of all the mirror archive you find on the Debian mirror list. That would take like forever. Or you could use netselect that will check the Debian mirrors and find the fastest one for you. It is not always the official Debian mirror in your country that will be fastest for you. 

You install netselect-apt by typing (as root or sudo):

apt-get install netselect-apt

Once the netselect-apt is installed, we fire it up to find our fastest Debian mirror. Before we run it, let’s look at the arguments to use with netselect-apt. 

Netselect-apt options

-a (Use mirrors containing ARCH)

-s (Include the deb-src lines to get the Debian source packages)

-i (Use INFILE instead of downloading mirror list as a temporary file)

-o (Outfile instead of sources.list)

-n (Include the non-free section in sources.list or Outfile)

-f (Use FTP instead of HTTP mirrors)

How to use netselect-apt

The syntax is: netselect-apt [options] [release]

So if we want to find mirror for Debian 9 (stretch) including source and the non-free section we run the command like this. You need to use the name of Debian and not the version number. To find out the name of your version, check out this list.

netselect-apt -s -n stretch

fastest debian mirror 3

For me here in Norway on Altibox network, the output will be like this. The program finds the best and fast mirror, at the moment, of all Debian mirrors. The speed of a mirror server can change from day to day, depending on a lot of factors. Usage and network speed is only a few of them.

If you want to see in a video how to find the fastest Debian mirror, check out the video below.

If you like this find the fastest Debian mirror and need to read up on Debian 9 Static IP, check out that link.

Posted in Debian Tagged with: ,

debian 9 static ip
April 4th, 2018 by ronny

Setting Debian 9 static IP is not too different from the previous version. You might find the network cards named a bit differently now. Apart from that, it is mostly the same. And we will look at an alternative at the end, and an issue while configuring Debian 9 static IP.

Debian 9 Static IP

Edit network interfaces

Let’s look at how to give your Debian 9 a static IP address. The first thing you need is to edit the network interfaces. Launch your favorite text editor and edit /etc/network/interfaces. It will look something like below. In this example, I’m using a wired network interface. It will now be called ens3 instead of eth0 like in earlier versions. Your interface might have a different name.

debian 9 static ip 1

You need to change DHCP to static. Then you need to add the address, gateway, and netmask. In this example, I used for address and 1921.68.2.1 for the gateway (because that is the address of my gateway). Most likely your settings will be different. Change them to fit your network. After editing the network interfaces my config looks like this after setting Debian 9 static IP.

debian 9 static ip 2

Apply the Debian 9 static IP

To apply the changes we need to restart the network service. If you are connected to the computer via SSH, you will need to reboot. You will lose connection when restarting the network service if you are on SSH. If you are local or a KVM console restart your interface like below.

To restart the network service just type into the terminal or console: service networking restart (typing /etc/init.d/networking restart will also do). If you at this point check your network settings with ifconfig or ip addr, the network will be unreachable. To fix this run: ifup ens3 (or whatever your interface is called). Now run: ip addr, to verify your new settings.

debian 9 static ip 3

Here I noticed my new static IP had become a secondary IP. I don’t want that. I only need 1 IP for this machine. At this point, I can use both and (which was the IP given by the DHCP server). I just rebooted to remove the DHCP assigned IP address.

debian 9 static ip 4

Another option to static IP addresses

There is another option to a static IP address. Your router, if it is not too old and simple, has an option to assign IP addresses to specific mac addresses. On my wifi router, also used as a DHCP server it looks like this.

debian 9 static ip 5

This is an inexpensive Asus RT-N66U router. But most wifi routers have this option to assign mac addresses to IP addresses. I prefer using Debian 9 static IP addresses instead of assigning them to the router.

If you are using Debian 8 (Jessie) or Debian 7(Wheezy), check out Debian Static IP how to

Check out this video to see how it is done

Or maybe looking for Debian 9 change hostname permanently

Posted in Debian, Linux Tagged with: ,

Debian ifconfig
April 3rd, 2018 by ronny

Debian ifconfig command not found. Can’t find ifconfig on Debian? You have probably installed a minimum installation without installing the standard system utilities. But do you really need ifconfig? If it just for checking the ip addresses, check out a Debian ifconfig alternative below.

Debian ifconfig 1

Debian ifconfig

First, let us install the ifconfig command. After all, I assume that is how you found this article. I assume you got superuser or admin rights on the computer. Without the standard system utilities installed you need to install almost everything you need yourself. The package you need to install is net-tools.

apt-get install net-tools

Debian ifconfig 2

Now you have the ifconfig command available. If you don’t mind Debian ifconfig missing, there is an option built-in. The IP command should be in the sbin folder no matter if you installed the system tools or not. The complete command to display the same info at ifconfig is:

ip addr show

This command can be shortened to:

ip a

It is exactly the same as the ip addr show command. So if Debian doesn’t have ifconfig, try to use the ip command instead. No installation needed. It will be in all installation. However, the net-tools package is only about 500-600kB. So it will hardly use any space on your hard drive. And I guess it comes down to preference if you want to use ifconfig or ip.

Some prefer not to install the Standard System Utilities. If you chose not to install it, your security updates in the apt config (repository) might not be set. And I would check if the security repository is added to the repository list.

Debian ifconfig 3

That’s my article on Debian ifconfig not found. If you experience slow SSH logins check out SSH slow login on Debian based systems.

Posted in Debian, Linux Tagged with:

can't set locale
March 11th, 2018 by ronny

Can’t set locale; make sure $LC_* and $LANG are correct! This suddenly appeared on all my servers one day after some updates. All of them were running Debian. And I thought at first there was some bad packages or settings in some of the new updates. Little did I know the problem wasn’t related to Debian or my server at all. But my Laptop. I had also updated MacOS the same day.

Can’t set locale; make sure $LC_* and $LANG are correct!

If you get Can’t set locale; make sure $LC_* and $LANG are correct, is it only when using a particular program. Or is it when you SSH in from another computer? If you get it from SSH, try to see if you get the same error when using terminal locally. If it only appears when using SSH, you probably have the same issue I had. At least it is something with the SSH client.

To fix your SSH client, assuming you are running MacOS, you need to edit the /etc/ssh/ssh_config file. That is where the problem is. If you have an older OS X like Mountain Lion, you will find the file at /etc/ssh_config. What you need to do is remove or comment out this line: SendEnv LANG LC_*

can't set locale

By removing the SendEnv LANG LC_* you stop your client from sending invalid locale information to your server, or computer you SSH into.

Another type of error that can be caused by invalid locale, is various Python script errors. If you ever got this error “UnicodeEncodeError: ‘ascii’ codec can’t encode character …”. You should also try to remove the SendEnv LANG LC_* from ssh_config. Other users have reported that to be the solution to this issue.

Please also read SSH slow login on Debian based systems

Posted in Linux, Mac Tagged with:

Debian 9 change hostname 1
February 18th, 2018 by ronny

Debian 9 change hostname is done very similarly to the previous Debian versions. With one major difference. It is how you apply the changes. If you don’t apply the changes, the changes will not be taken into effect until you reboot or restart your system. The same way if you use the hostname commands to change the hostname, the hostname is reverted when you reboot. Let us see how to Debian 9 change hostname permanently.

In the following example, let us assume the server name is

Debian 9 change hostname permanently

If you run the command hostname, it will return example. That is the hostname of your system.

root@example:~# hostname


Domain Name

When adding the parameter -d to the hostname command it will give you the domain name currently set for your system.

root@example:~# hostname -d

FQDN / Fully Qualified Domain Name

Change the parameter to -f and you get the FQDN or Fully Qualified Domain Name instead. Here is an example.

root@example:~# hostname -f

Change the hostname

To change the hostname you need to edit the /etc/hostname file. If you use the hostname command, it will not be permanent. The hostname file will only contain the hostname. The picture below is from one of my database servers.

Debian 9 change hostname 2

Change the Domain or FQDN

Any changes to the domain name or the FQDN has to be done in the /etc/hosts file. Here is an example of how a hosts file looks. Again from my database server.

Debian 9 change hostname 3

Apply the changes

As mentioned above the changes needs to be applied, like restarting or reloading the hostname service. If not the changes will not be applied until you reboot or restart your system.

This is how you apply the settings on a Debian 9 system:

sudo hostname -F /etc/hostname

If you are looking for how to change hostname, domain or fqdn on Debian 8 or earlier, check out Debian – Change hostname, domain or FQDN permanently. Or looking for how to change the hostname on an Ubuntu system permanent.

Check out the video below to see how it works.

That is how Debian 9 change hostname works.

Posted in Debian, Linux Tagged with: