Wednesday, December 31, 2014

HowTo: Use ps, kill, nice, and killall To Manage processes in FreeBSD and OS X Unix Operating System

I 'm a new Unix system user. How can I manage process on a FreeBSD operating systems?

A process is nothing but an executing program on FreeBSD or Unix-like system. Each process on the system provides the resources needed to run a program such as vim or firefox. Each process has:

Friday, December 5, 2014

Install LEMP (Linux, Nginx, MySQL and PHP) Stack on Ubuntu Linux 14.04 LTS

I'm a new Ubuntu Linux user. How do I install the LEMP stack on an Ubuntu Linux 14.04 LTS server using command line options to serve dynamic web apps?

As one of the most popular Linux distribution in the world, Ubuntu has released the latest version on April 17, 2014. The latest version is 14.04 with code name Trusty Tahr. Ubunt 14.04 is a LTS (Long Term Support) version. This means that Ubuntu 14.04 will be supported for the next 5 years from the release date. In this tutorial we will cover Nginx, MySQL and PHP installation on Ubuntu Linux v14.04.

Wednesday, December 3, 2014

How To Add, Delete, and Grant Sudo Privileges to Users on a FreeBSD Server

I 'm setting up a new FreeBSD server. I do not want to use a default root user who has full system access. How can I setup and grant sudo privileges to users on a FreeBSD VPS or server?

The root account has full system level access and usually reserved for admin tasks only.


Set Up SSH Tunneling on a Linux / Unix / BSD Server To Bypass NAT

'm a new Linux / Unix system user. How can I set encrypted tunnel between my desktop/laptop computer and server in a remote data center to bypass the limits in a network? How do I create a reverse SSH tunnel on Unix-like systems?

SSH tunnelling can be thought as a poor-man's-VPN. It is handy in situations where you would like to hide your traffic from any body who might be listening on the wire or eavsdropping.

Friday, September 5, 2014

Ubuntu Linux Create and Add Swap File Tutorial

I'm a new Ubuntu Linux version 14.04 LTS user. I need additional swap space to improve my Ubuntu server performance. How can I add a swap space on Ubuntu Linux 14.04 LTS using command line over the ssh based session?

Swap space is nothing but a disk storage used to increase the amount of memory available on the Ubuntu Linux server. In this tutorial, you will learn how to create and use a swap file on an Ubuntu Linux server.

Saturday, August 23, 2014

Linux: Hide Processes From Other Users

I run a multi-user system. Most users access resources using ssh client. How can I stop leaking process information to all users on Linux operating systems? How do I prevent users from seeing processes that do not belong to them on a Debian/Ubuntu/RHEL/CentOS Linux server?

If you are using Linux kernel version 3.2+ (or RHEL/CentOS v6.5+ above) you can hide process from other users. Only root can see all process and user only see their own process. All you have to do is remount the /proc filesystem with the Linux kernel hardeninghidepid option.

Wednesday, July 23, 2014

CentOS / RHEL 7 Restart / Stop / Start Networking Command

I recently installed CentOS Linux version 7 or Red Hat Enterprise Linux version 7. How can I restart networking service using command line options? How can I start / stop and restart networking service on a CentOS/RHEL 7 based system?

CentOS 7 / RHEL 7 / Fedora Linux (many other modern distor) uses Systemd. It is a system and service manager for Linux operating systems. In newer distro such as CentOS7/RHEL7 systemd replaces Upstart as the default init system.


Friday, June 27, 2014

Linux / Unix logtop: Realtime Log Line Rate Analyser

How can I analyze line rate taking log file as input on a Linux system? How do I find the IP flooding my Apache/Nginx/Lighttpd web-server on a Debian or Ubuntu Linux?

You need to use a tool called logtop. It is a system administrator tool to analyze line rate taking log file as input. It reads on stdin and print a constantly updated result displaying, in columns in the following format:

Thursday, June 26, 2014

Install EPEL Repo on a CentOS and RHEL 7.x

How do I install the extra repositories such as Fedora EPEL repo on a Red Hat Enterprise Linux server version 7.x or CentOS Linux server version 7.x?

You can easily install various packages by configuring a CentOS 7.x or RHEL 7.x system to use Fedora EPEL repos and third party packages. Please note that these packages are not officially supported by either CentOS or Red Hat, but provides many popular packages and apps.

Connect To Amazon AWS EC2 Instance From a CentOS / RHEL Using SSH Client

i have created/launched Amazon Machine Image (AMI) instance powered by a CentOS/RHEL/Red Hat Enterprise Linux. How can I connect to my instance using OpenSSH Linux/Unix/OSX ssh client?

You can use OpenSSH ssh client program for logging into a remote machine and for executing commands on a remote machine. The same client can be used to login into Amazon AWS EC2 instance powered by a CentOS Linux / Fedora / RHEL.

Wednesday, June 25, 2014

CentOS / RHEL 7: Install GCC (C and C++ Compiler) and Development Tools

How do I install gnu gcc compiler and related tools such as autoconf, automake, flex, c++ compiler, and bison on a CentOS 7 or Red Hat Enterprise Linux version 7 server?

You can setup a basic development environment with the following packages on a CentOS Enterprise Linux or Red Hat Enterprise Linux version 7:

Tuesday, June 24, 2014

Linux Redirect Error Output To File

I am a new Ubuntu Linux and bash shell user. I also know how to redirect output from display/screen to a file using the following syntax:
cmd > file
ls > file
However, some time errors are displayed on screen. How do I store and redirect output from the computer screen to a file on a Linux or Unix-like systems?

Monday, June 9, 2014

FreeBSD 10: Apply Binary Updates To Keep Base System Up To Date

I know keeping a FreeBSD server up to date is a very important. How can I apply binary system patches and updates to a new installation of FreeBSD 10 server?

You need to use the freebsd-update tool. It is used to fetch, install, and rollback binary updates to the FreeBSD base system.

Sunday, June 8, 2014

CentOS and RHEL 7: Install Linux, Apache, MariaDB, PHP (LAMP) Stack

I am new Red Hat Enterprise Linux version 7 user/sysadmin/developer. This version made the big number change for RHEL 7/CentOS 7. How can I install LAMP (Linux, Apache, MariaDB, PHP) stack on a RHEL version 7 or CentOS Linux version 7 using CLI or over ssh based session?

Saturday, June 7, 2014

Fedora Linux 19/20 Install Adobe Flash Player

I want to use Pandora online radio on a Fedora Linux desktop. How can I install Adobe Flash Player Plugin version 11.2 with yum command on a Fedora Linux 64 bit desktop or 32 bit version 20 laptop system?


Adobe provided yum repository that contains RPM packages of Adobe Linux Software. You use yum command to install either 32 or 64 bit flash player on a Fedora Linux operating system. Please note that Adobe Flash Player is proprietary and closed source software.

Friday, June 6, 2014

Linux: Bash Delete All Files In Directory Except Few

I'm a new Linux system user. I need to cleanup in a download directory i.e. delete all files from ~/Downloads/ folders except the following types:
*.iso - All iso images files.
*.zip - All zip files.
How do I delete all file except some in bash shell on a Linux, OS X or Unix-like systems?

Bash shell supports rich file pattern matching such as follows:

Thursday, June 5, 2014

Fedora Linux 20: Install Broadcom-wl STA BCM43228 Wireless Driver

I'm using Dell / Lenovo laptop with Broadcom's IEEE 802.11a/b/g/n based wireless card. How can I install Broadcom-wl STA BCM4322 Wireless driver on a Fedora Linux version 20?

Broadcom's IEEE 802.11a/b/g/n driver can be installed on any Linux disruption including Fedora Linux version 20. The driver (broadcom-wl and kmod-wl) works with the following Wireless chipsets only:

Wednesday, June 4, 2014

CentOS / RHEL / Fedora Linux: Use Yum Command With A Proxy Server

My CentOS Linux based laptop can only be accessed through our corporate proxy servers. How do I access and use yum command with a Web proxy server on a CentOS / RHEL / Fedora / Red Hat / Scientific Linux?

Yum repositories can be accessed through standard proxy servers such as Squid proxy server. You need to provide use the following details of the proxy server in /etc/yum.conf file:

Tuesday, June 3, 2014

OS X: Create and use Live USB Fedora Linux Media

My new Dell Laptop has no DVD or CD drive. I'm trying to create a bootable Fedora Linux 20 USB using UNetbootin utility as described here. But, UNetbootin failed to create bootable USB image on OS X. How do I create Fedora Linux 20 USB Media in Apple OS X using command line options?

You need to use the following two commands on Apple OS X to directory write an ISO image to USB flash drive:

Tuesday, May 6, 2014

Linux / Unix – crontab: no crontab for user using an empty one error and solution

I am trying to set cronjob on a Unix systems by running the crontab -ecommand. But, I'm getting the following error:
crontab: no crontab for veryv - using an empty one
crontab: "/usr/bin/vi" exited with status 1
How do I fix this issue on a Linux or Unix-like systems?

Monday, May 5, 2014

HowTo: Compile And Run a C/C++ Code In Linux

I am a new Linux user and student who used to write C or C++ programs on MS-Windows. Now, I am using Ubuntu Linux. How can I compile a C or C++ program on Linux operating systems using bash Terminal application?

To compile a C or C++ program on any Linux distro such as Ubuntu, Red Hat, Fedora, Debian and other Linux distro you need to install:

Sunday, May 4, 2014

Linux And Unix Command To View File

I am a new Linux bash shell command line user. How can I view a text file using command line on a Linux or Unix-like operating systems? How can I view (open) binary files such as PDF or images on a Linux or Unix like system from command line?

You can use any one of the following command to view a text file or any other files such as PDF, doc, image, video, music/mp3 and more.

Saturday, May 3, 2014

Friday, May 2, 2014

Linux / Unix: Find And List All Hidden Files Recursively

I am a new Unix system shell user. I need to find and list all hidden files including directories on a Linux or Unix-like system. How can I recursively list all hidden files and directories? How do I save result in a text file?

You need to use the find command to list all hidden files recursively on a Linux or Unix like systems.


Thursday, May 1, 2014

OS X Terminal: -bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory Fix

I'm a new Apple OS X Mabbook user. I am getting an error which read as follows when I connect to any remote Linux/Unix/BSD server or machine through OS X ssh Terminal app:
ssh user@server1.cyberciti.biz
Last login: Wed Mar 26 08:45:36 2014 from 1.2.3.4
-bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
How do I fix this error?

Saturday, April 26, 2014

Mac OS X: Force Quit An Unresponsive Full Screen Application Shortcut Key

Sometime my VLC application gets crashed on a Mac OS X system. The screen goes blank and VLC stays hang running on my desktop or MacBook. How can I solve this issue and quit an unresponsive VLC application on a Mac OS X without a hard reboot?

OS X has a feature called Force Quit to quit both responsive and an unresponsive application on a Mac OS X system. The Force Quit displays list of apps on screen and can be activated using keyboard shortcuts.

Friday, April 25, 2014

Fix: /bin/dbus-launch terminated abnormally without any error message and solution

I am a new Linux server user. I need to tunnel X over ssh. I type the following command on a CentOS/RHEL based remote host to get display on a local desktop:
ssh -X user@server1.cyberciti.biz
xeyes &
firefox &
But, I am getting an error that read as follows:
**error**: Failed to contact configuration server; some possible causes are that you need to enable TCP/IP networking for ORBit, or you have stale NFS locks due to a system crash. See http://projects.gnome.org/gconf/ for information. (Details - 1: Failed to get connection to session: /bin/dbus-launch terminated abnormally without any error message)
How do I fix this error on a newly formatted/installed RHEL or CentOS Linux 6.x server?

HowTo: Setup SSH Keys on a Linux / Unix System

I recently read that SSH keys provide a secure way of logging into a Linux and Unix-based server. How do I set up SSH keys on a Linux or Unix based systems? In SSH for Linux/Unix, how do I set up public key authentication?

I am assuming that you are using Linux or Unix-like server and client with the following software:
  • OpenSSH SSHD server
  • OpenSSH ssh client and friends on Linux (Ubuntu, Debian, {Free,Open,Net}BSD, RHEL, CentOS, OSX and co).

Wednesday, April 2, 2014

X11 forwarding request failed on channel 0 Error and Solution

am a new Linux server user. I need to tunnel X over ssh. I type the following command from OS X Unix terminal to login into far_away_machine (a centos server):
ssh -X -o options -A -p 22 user@centos-far-away-server
But, I am getting the following error on screen:
X11 forwarding request failed on channel 0
Last login: Sun Mar 23 15:58:51 2014 from 1.2.3.4

Tuesday, April 1, 2014

HowTo: Uninstall MySQL Server in Ubuntu Linux

I 'm a new Ubuntu Linux user and my cloud hosting company installed MySQL server by default. I need to remove it and delete it from my server as I have no use of MySQL server. How can I uninstall MySQL on a Ubuntu based systems?

Typically following Mysql packages are installed on the Debian or Ubuntu Linux systems:

Sunday, March 30, 2014

Linux/Unix: Find Command Ignore Case Insensitive Search

I am a new Linux and Unix-command line user. I am using find command to search file called "fooBar.conf.sample" in my home directory. I do not know the case, it could be uppercase, lowercase, or a mix of both. How can search a file and ignore case on a Linux or Unix-like system?

The find command recursively descends the directory tree for each path provided, evaluating an expression. It is mainly used to search files and directories on Linux and Unix-like systems. The syntax is as follows to search files according to given criteria. You can search for files by name, owner, group, type, permissions, date, and other criteria:

Saturday, March 15, 2014

Linux / Unix: chroot Command Examples

Iam a new Linux and Unix user. How do I change the root directory of a command? How do I change the root directory of a process such as web-server using a chroot command to isolate file system? How do I use a chroot to recover password or fix the damaged Linux/Unix based environment?

Each process/command on Linux and Unix-like system has current working directory called root directory of a process/command. You can change the root directory of a command using chrootcommand, which ends up changing the root directory for both current running process and its children.

Minify and Compress CSS & Javascript Files At a Linux/Unix Shell Prompt

How do I minify and compress CSS & JS files on Linux or Unix-like system using shell prompt on my server? How can I minify JavaScripts and stylesheets at shell promot so they can download faster over the Internet without using any online tools?

You need to use "YUI Compressor" tool. It is widely used for minifying JavaScripts and stylesheets. From the project page:

Thursday, March 13, 2014

CentOS Install Lighttpd Web-server With yum Command

I know how to install nginx on a CentOS Linux using yum command. Is there is a guide to install Lighttpd web-server on a CentOS Linux or RHEL server with yum command? How can I install and configure php and mysql on a CentOS with Lighttpd web-server?

Lighttpd is a fast and secure web-server which has been optimized for high-performance environments. The server has a very low memory footprint compared to other webservers and takes care of cpu-load. It includes the following advanced features:

CentOS: rpmdb: PANIC: fatal region error detected; run recovery error and solution

I am using a CentOS Linux v6.5 on my home server and I am getting the following error when I execute yum command:
rpmdb: PANIC: fatal region error detected; run recovery
error: db3 error(-30974) from dbenv->open: DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db3 - (-30974)
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.main:
Error: rpmdb open failed
How do I fix this problem on a CentOS / RHEL based system?

Tuesday, March 11, 2014

HowTo: Update gcutil / gcloud Components On a Linux / Unix / OS X

How can I update for Google Cloud SDK components on a Linux or OS X unix based systems?

The easiest and recommended way is to use gcloud command to update various Google cloud SDK libs, commands and other components. Open the Terminal and type the following command when you see the following message on screen:

Monday, March 10, 2014

curl Command Resume Broken Download

Iknow wget can resume a failed download. I am on a Mac OS X and do now want to install wget command. How can I resume a failed download using curl command on Linux or Unix-like systems?

You can continue getting a partially downloaded file using curl command. You need to pass the -Cor --continue-at <offset> option resume a previous file transfer at the given offset.

FreeBSD Show Disk Quota Limits Command

I'm a new FreeBSD unix user and backup file on a FreeBSD based unix server. How can I check quota limits and disk usage using shell prompt on a FreeBSD based system?

You need to use the quota command line utility to see your disk usage and limits. By default only the user quotas are printed. Disk block usage and limits are shown in 1024-byte blocks.

Thursday, February 20, 2014

Ubuntu Copy File Command

I 'm a new Ubuntu Linux user. This seems like a newbie question, but I can not seem to find examples to copy files on Ubuntu. How do I copy file to another directory on Ubuntu Linux using command line terminal application? How can I copy files via terminal on Ubuntu Linux desktop?

You need to use cp command to copy file to another directory or external usb disk. The command line syntax is as follows to copy files via terminal:

Linux: Log Suspicious Martian Packets / Un-routable Source Addresses

I run a web-server and I would like to log packets with un-routable source addresses on Linux operating system. How can I log spoofed packets on Debian / Ubuntu / CentOS / RHEL / Linux based server? How can I log a Martian packet (packet from Mars) on Linux operating systems?

Increase NFS Client Mount Point Security For a Web-Server noexec, nosuid, nodev Options

I am using NFS server version 4.x on a CentOS/RHEL based system. I'm mounting my shared /var/www/ directory on five Apache based nodes using the following syntax:
mount -t nfs4 -o rw,intr,hard,proto=tcp rocknas02:/httproot/www /var/www/
I noticed that due to bug in my app user can sometime upload executable or other device files to get out of chrooted Apache server. How can I prevent such security issues on a CentOS or RHEL based NFS client and sever setup?

Monday, February 10, 2014

HowTo: Prevent Yum From Upgrading The Kernel On a CentOS / Red Hat Enterprise Linux

I am a new RHEL / Centos Linux server admin. I would like yum to update all packages except the Linux Kernel. How can I prevent yum command from updating kernel on a CentOS/RHEL/Fedora Linux based systems?

You can prevent yum command from updating the Kernel permanently by following the simple steps.

Saturday, February 8, 2014

Unix / Linux: Check New Files In File System /var/www/uploads/

Recently, I switched from MS-Windows based web-server to CentOS Linux based Apache web-server. All user uploaded files are stored in /var/www/uploads/ directory. Is there command that can give me a list of files that have been added to the filesystem at /var/www/uploads/ in last 7 days on Linux/Unix-like oses?

Linux / Unix: Check Last Time User Logged In On The System

am a new Unix system admin. How do I find ouw who has recently use the Linux or Unix-like server? Which terminals they used, and when they logged in and out of the my server?

You need to use last command. This command displays last logins of users and ttys.

Friday, January 3, 2014

CentOS / RHEL: Yum Lock Package Version At a Particular Version

I am a new CentOS / RHEL 6.x server user and DevOP. I need to lock a package called nginx on a server being updated via yum command. How do I lock package version at a particular version on CentOS / Red Hat Enterprise Linux (RHEL) 6.x or Fedora Linux?

Thursday, January 2, 2014

Wednesday, January 1, 2014

Nginx: Redirect Backend Traffic Based Upon Client IP Address

I have four Apache backend servers in front of nginx reverse proxy server. How do I make sure nginx reverse proxy load balancer always send specific client IP address (say IP 1.2.3.4) request to http://apachereadwrite/ backend and rest to http://apachereadonly/ backend?

Nginx web server does support if conditionalconfiguration. You can redirect and/or select configuration depending on client ip address. In this case you need to use the variable called $remote_addr which can be used to retrieve information about the users ip address. This is useful if you want to give file upload capabilities to your own office IP address and read-only capabilities to the rest of the world based upon client IP address or vpn address: