FAQforge provides answers for frequently asked questions for the Linux-, MAC and Windows operating systems.

wget command – how to limit the download rate

Monday, May 18, 2015 - posted by admin

Sometimes it is nescessary to limit the download rate of the wget command, e.g. when you are downloading a large file over a slow internet connection. The parameter to apply a download speed limit is the --limit-rate option. This setting is followed by the rate limit plus "k" for kbit or "m" for mbit.

Example:

wget --limit-rate 128k http://downloadserver.tld/bigfile.zip

How to list installed packages on Debian?

Wednesday, May 13, 2015 - posted by admin

To get a list of all installed packages on a Debian or Ubuntu server, run the command:

dpkg --get-selections

This command will show you a rather long list. To save the list to a file, use this command:

dpkg --get-selections > /tmp/packages.txt

the list is saved then in the file /tmp/packages.txt.

If you seek for a specificy package, use the grep command:

dpkg --get-selections | grep nginx

will show you all packages that contain the word "nginx" in their name.

Example:

root@sv1:/# dpkg --get-selections | grep nginx
nginx-common install
nginx-extras install

How to change the Hostname on CentOS 7

Sunday, April 12, 2015 - posted by Till

The easiets way to change the hostname on CentOS 7 is to use the hostnamectl command.

First I will check the current hostname by running "hostnamectl status" on the shell of my server:

hostnamectl status

The output on my system is:

[root@server1 ~]# hostnamectl status
   Static hostname: server1.example.com
         Icon name: computer-vm
           Chassis: vm
        Machine ID: d89865d34b5a4637a9a4ff0ce0f6da02
           Boot ID: 56d1685056d743b39e57a7b9cbfe467c
    Virtualization: vmware
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-123.el7.x86_64
      Architecture: x86_64

Then I change the hostname with the set-hostname option of the hostnamectl command to server2.example.com

hostnamectl set-hostname server2.example.com

Afterwats I check with the command hostname and hostname -f if the hostname change has succeeded.

hostname
hostname -f

The result should be:

[root@server1 ~]# hostname
server2.example.com
[root@server1 ~]# hostname -f
server2.example.com

Instead of the hostname command you could also use the "hostnamectl status" command again to check if the new hostname has been set:

[root@server1 ~]# hostnamectl status
   Static hostname: server2.example.com
         Icon name: computer-vm
           Chassis: vm
        Machine ID: d89865d34b5a4637a9a4ff0ce0f6da02
           Boot ID: 56d1685056d743b39e57a7b9cbfe467c
    Virtualization: vmware
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-123.el7.x86_64
      Architecture: x86_64

How to set a VNC password

Friday, March 20, 2015 - posted by admin

The Linux VNC server provides a command to set a new password. The command is "vncpasswd", the password is stored in encrypted form into the file ~/.vnc/passwd of the home directory of te user. Run:

vncpasswd

to set a new password for the currently logged in user. The command will then prompt for the new password. If you like to set a new VNC password for a different user, then append the password file name to the command. Example for the user "jane":

vncpasswd /home/jane/.vnc/passwd

The above command to set a new password for jane requires it that you are logged in as root user. On Ubuntu systems you can use sudo instead:

sudo vncpasswd /home/jane/.vnc/passwd

How to clear bash history

Thursday, March 19, 2015 - posted by admin

The Bash hisrory on a linux system is stored in the file .bash_history of the home directory of the user. To clear the history for the currently logged in user, run these commands:

cat /dev/null > ~/.bash_history
history -c

If you like to clear the history of a different user, use these commands. In the example I will cler the history for a user named tom:

cat /dev/null > /home/tom/.bash_history

Please note that you have to be logged in as root user to cler the Bash history of another user or use sudo to execute the command.

sudo cat /dev/null > /home/tom/.bash_history

Here is a list of ports that are used commonly on ISPConfig 3 servers. If you dont have all services installed or if you e.g. dont want to connect to MySQL from external servers, then close the unused or unwanted ports.

TCP ports

20 - FTP Data
21 - FTP Command
22 - SSH
25 - Email
53 - DNS
80 - HTTP (Webserver)
110 - POP3 (Email)
143 -Imap (Email)
443 - HTTPS (Secure webserver)
993 - IMAPS (Secure Imap)
995 - POP3S (Secure POPĀ§)
3306 - MySQL Database server
8080 - ISPConfig web interface
8081- ISPConfig apps vhost

UDP ports

53 - DNS
3306 - MySQL

The Following command can be used to check and repair all MySQL databases on a Ubuntu or Debian Linux System.

Ubuntu Linux

sudo mysqlcheck --defaults-file=/etc/mysql/debian.cnf --auto-repair --optimize --all-databases

Debian Linux

mysqlcheck --defaults-file=/etc/mysql/debian.cnf --auto-repair --optimize --all-databases

The benefot of the above comand is that it uses the debian-sys-maint login to MySQL which is available on every Debian and Ubuntu System, so you dont have to provide the MySQL root login details.

How To Disable Error Logging For A Website In ISPConfig 3

Friday, August 8, 2014 - posted by admin

To disable the error.log for a website in ISPConfig on a Apache webserver, follow this steps:

1) Login to ISPConfig

2) Go to the website settings of the website were you like to disable the error.log and there go to the "Options tab"

3) Add the following line in the field labeled "Apache Directives"

ErrorLog /dev/null

and press save:

 

How to Copy Files with SCP between Linux Servers

Saturday, July 19, 2014 - posted by Till

1.1 SCP Command Line-An Overview

 

The SCP command line is commonly used to copy files over SSH, and between popular Operating systems like Linux, Mac and Windows in a secure fashion. SCP is used to copy files to/from a remote server. It also allows you to copy files from one remote server to another remote server, without passing traffic through your PC.

Solution for: system-config-firewall: command not found

Wednesday, February 5, 2014 - posted by admin

When you get the error message "system-config-firewall: command not found" on your CentOS Server while trying to configure the firewall on the shell, then the text interface version of the firewall configuration utility is missing. Install it with this command:

yum install system-config-firewall-tui