Home » Linux Basics

Linux Basics

Linux Centos 6 Change Server Hostname

I am a new CentOS Linux server user. How do I change hostname on CentOS Linux? How can I change server hostname on CentOS Linux  6? You need to use the following commands to set or view current hostname, domain name and/or FQDN (Fully Qualified Domain Name): dnsdomainname command : Display the system’s DNS domain name. hostname command : Show or …

Read More »

Linux / UNIX: Create Large 1GB Binary Image File With dd Command

How do I create 1 GB or 10 GB image file instantly with dd command under UNIX / Linux / BSD operating systems using a shell prompt? You can use dd command to create image files for network or file system testing. First, make sure you’ve sufficient disk space to create a image file using dd:   $ df -H …

Read More »

CentOS: yum Command Reinstall Package

How do I re-install a package using the yum command under CentOS Linux server? You can use the yum command with the reinstall option. This will reinstall the identical versioned package as currently installed. The syntax is as follows:   yum reinstall packageName yum reinstall packageName1 packageName2 In this example reinstall a package called keepalived, type: # yum reinstall keepalived Sample outputs: Loaded plugins: product-id, rhnplugin, subscription-manager Updating certificate-based …

Read More »

Nginx Redirect URL With HTTP/1.1 301 Moved Permanently Header

How do I redirect old ugly urls such as http://example.com/store/view.jsp?product=foo with clean url – http://example.com/store/view/product/foo using nginx reverse proxy? You need to use HttpRewriteModule under nginx web server. This module makes it possible to change URI using regular expressions (PCRE), and to redirect and select configuration depending on variables. The syntax is as follows to chage URI in accordance with …

Read More »

Install EPEL Repo on a CentOS and RHEL 7

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 or RHEL 7 system to use Fedora EPEL repos and third party packages. Please note that these packages are not officially supported …

Read More »

Linux: Finding and locating files with find command part # 2

In the first part we talked about find command basic usage. Now let us see how to use find command (a) To gain lots of useful information about users and their files (b) Monitor and enhance the security of system using find command Finding all set user id files setuid (“suid”) and setgid are access right flags that can be assigned to …

Read More »

How to Change & Set the Default crontab Editor

  Most hardcore command line users and unix geeks love vi, but I prefer nano. If you want to change your default crontab editor to nano, here’s how to do this:   For a one time edit, launch the terminal and type: EDITOR=nano crontab -e If you want to set nano as your default editor in general, you use this command: export EDITOR=/usr/bin/nano …

Read More »