When ssh into a production server, Debian, and noticed there is a warning or error as follows: Terminal manpath: can’t set the locale; make sure $LC_* and $LANG are correct mkyong@test-server:~$ Check the server’s locale; there are warning about the LC_CTYPE and LC_ALL variables. Terminal $ locale locale: Cannot set LC_CTYPE to default locale: No […]

Read more Cannot set LC_CTYPE to default locale: No such file or directory

This article shows a shell script to backup or export a MySQL / MariaDB database, gzip the exported file, and upload the gzipped backup file to Amazon S3. Table of contents 1. Install AWS CLI 2. Backup MySQL/MariaDB database to S3 (Shell Script) 3. How to run the backup script? 4. Run the backup script […]

Read more How to backup MySQL / MariaDB database to Amazon S3, shell script example

In the ConfigServer Security & Firewall (CSF) configuration file, update the CT_LIMIT value to limit the number of connections per IP address. This is a simple trick to prevent some types of Denial of Service (DOS) attack. Note To stop the Denial of Service (DoS) attack immediately, read this null route example. 1. /etc/csf/csf.conf SSH […]

Read more CSF – How to limit the number of connections per IP address

On Debian, you can use apt-cache policy ‘package name’ to check the package version. 1.1 Display Tomcat7 version. $ sudo apt-cache policy tomcat7 tomcat7: Installed: (none) Candidate: 7.0.52-1ubuntu0.3 Version table: 7.0.52-1ubuntu0.3 0 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages 500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages 7.0.52-1 0 500 http://archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages 1.2 Display OpenJDK-7 version. $ sudo […]

Read more Debian – Show apt-get package version

On Debian, type cat /etc/debian_version to display the Debian version. Terminal $ cat /etc/debian_version 9.5 Alternatively, cat /etc/issue Terminal $ cat /etc/issue Debian GNU/Linux 9 \n \l The last one, lsb-release -a, it will display the Debian detail. Terminal $ lsb-release -a -bash: lsb-release: command not found $ sudo apt-get install lsb-release $ lsb_release -a […]

Read more How to check Debian version

To allow multiple private keys connect to different servers, edit ~/.ssh/config : ~/.ssh/config Host 10.10.10.1 IdentityFile ~/.ssh/linode_rsa Host 200.20.20.2 IdentityFile ~/.ssh/id_rsa If you SSH to 10.10.10.1, private key ~/.ssh/linode_rsa will be used. If you SSH to 200.20.20.2, private key ~/.ssh/id_rsa will be used. 1. Single Private Key for Multiple Servers 1.1 You have following public […]

Read more Multiple SSH private keys Examples

Dual boot Windows and Ubuntu, but Ubuntu is unable to access the Windows partition /dev/sdb3, shows the following error message : Error mounting /dev/sdb3 … status 14: The disk contains an unclean file system (0, 0). Metadata kept in Windows cache, refused to mount. Failed to mount ‘/dev/sdb3’: Operation not permitted The NTFS partition is […]

Read more Ubuntu : Status 14: The disk contains an unclean file system

Normally, you use Secure copy or SCP to download a file from another server via SSH connection. For example, scp username@remotehost:remoteFileToDownload localFolderNameToSaveTheFile 1. SCP Examples 1.1 Download File From Server Example to download a log file (hc.audit.log) from server (198.58.x.x), into your current local folder. scp [email protected]:/var/log/tomcat7/hc.audit.log . 1.2 Upload File To Server Example to […]

Read more Download file from server using SSH

Deployed a Debian 7.5 on Linode server, the default is using OpenJDK 1.6. How to upgrade to OpenJDK 1.7? $ java -version java version "1.6.0_31" OpenJDK Runtime Environment (IcedTea6 1.13.3) (6b31-1.13.3-1~deb7u1) OpenJDK 64-Bit Server VM (build 23.25-b01, mixed mode) Tracing the java, it’s using the Debian’s alternative settings : $ ls -lsa /usr/bin/ | grep […]

Read more Debian : Change default Java version

The wget is a useful command to download a website in Linux. For example , wget [url]. [mkyong@snake ~]$ wget -r -p -k -E http://www.google.com –2009-07-19 14:07:27– http://www.google.com/ Resolving www.google.com… 64.233.189.104 Connecting to www.google.com|64.233.189.104|:80… connected. HTTP request sent, awaiting response… 302 Found Location: http://www.google.com.my/ [following] –2009-07-19 14:07:27– http://www.google.com.my/ Resolving www.google.com.my… 64.233.189.147 Connecting to www.google.com.my|64.233.189.147|:80… connected. […]

Read more How to download a website in Linux (wget)

CPULimit is a simple program to limit the CPU usage of certain application in Linux. It’s reside in the Ubuntu repositories by default. We can install it by issue the following command in Ubuntu sudo apt-get install cpulimit Output mkyong@mkyong:~$ sudo apt-get install cpulimit [sudo] password for mkyong: Reading package lists… Done Building dependency tree […]

Read more How to Limit the application CPU usage in Linux (CPUlimit)

The “dmidecode” is a handy tool in Linux to display the hardware specification detail. For example, memory, processor , BIOS and etc. man dmidecode DMI TYPES The SMBIOS specification defines the following DMI types: Type Information —————————————- 0 BIOS 1 System 2 Base Board 3 Chassis 4 Processor 5 Memory Controller 6 Memory Module 7 […]

Read more How to know the Hardware Details in Linux

In Unix system like Debian, Ubuntu or Red Hat, It is possible to set a static IP address with ifconfig command. My current Debian system IP address is 10.70.0.61 mkyong:~# ifconfig eth0 Link encap:Ethernet HWaddr 00:15:17:1D:CE:2F inet addr:10.70.0.61 Bcast:10.70.3.255 Mask:255.255.252.0 I want change it to 10.70.0.66, just issue following command to set a static IP […]

Read more How to set static IP address on Unix

Today my boss ask me install a tomcat in linux machine. After i ssh into that machine, i wonder what is the Linux distribution version? Red Hat? Ubuntu? Fedora? Debian? However with a simple command, i can check what is linux distribution version mymachine:~# cat /proc/version Linux version 2.6.18-5-686-bigmem (Debian 2.6.18.dfsg.1-13etch3) ([email protected]) (gcc version 4.1.2 […]

Read more How to check Linux / Unix distribution version

Problem Ubuntu…beside Default VI is suck, here is another issue for me. My mouse wheel scrolling is not working in Ubuntu8.04. However i installed Ubuntu in vmware, but i do not think it is vmware cause of this issue. Solution Here i find some useful information regarding Mouse Wheel Scrolling malfunction issuse, please check Ubuntu […]

Read more How to Enable Mouse Wheel Scrolling in Ubuntu (VMware)