Archive for January, 2009
How to change host name from command line in Fedora Core Linux
Jan 16th
One can use “hostname” command to find out the host name of a Linux system.
[neo@techpulp ~]# hostname neo.techpulp.com [neo@techpulp ~]#
The same command can be used to set a new host name as well but it requires super user privileges.
[root@techpulp ~]# hostname pc1.techpulp.com [root@techpulp ~]# hostname pc1.techpulp.com [root@techpulp ~]#
There is an another way to change the host name using PROC file system. The Linux kernel supports proc interface for host name using “/proc/sys/kernel/hostname” file. You can directly write new host name in that file as shown below:
[root@techpulp ~]# echo pc2.techpulp.com > /proc/sys/kernel/hostname [root@techpulp ~]# hostname pc2.techpulp.com [root@techpulp ~]#
However any changes made More >
What to do if my X server stops responding
Jan 14th
Sometimes moue/keyboard in X server stops responding due to bugs in the software. There is a better way to recover if you are planning to hard reboot the system.
You can press Ctrl+Alt+Backspace which will kill the current X session and takes you to the initial login screen.
Another way is to move to text login screen using Ctrl+Alt+F2 and then kill the X session after logging in. Later move back to the graphical screen which will be typically present at Ctrl+Alt+F7 or Ctrl+Alt+F1 on Fedora Linux systems.
killall -KILL X
How to disable Firewall in Fedora or Debian Linux systems
Jan 14th
If you have come across a problem of not able to access a service like httpd even if the server is running, most probably the Firewall is blocking the port. The quick way of checking it is to disable Firewall and try again. However this method of disabling firewall may not be recommended on production servers.
The following command tells you if firewall (iptables) is active on the Fedora Linux system.
[root@techpulp ~]# /sbin/service iptables status Table: filter Chain INPUT (policy ACCEPT) num target prot opt source destination 1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED 2 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 More >
WebDAV – Resolve – (405 Method Not Allowed) in response to PROPFIND request for ‘/svn’
Jan 14th
While configuring WebDAV with Apache for accessing SVN repository using web service, if there is a small misconfiguration related to “Location” directive you will see the following error:
svn: Server sent unexpected return value (405 Method Not Allowed) in response to PROPFIND request for '/svn'
Most probably you would have configured a trailing “/” character along with the location as shown below which requires correction.
<Location /svn/> DAV svn SVNPath /project/svn </Location>
You should remove trailing “/” from the path “/svn/” given in the “Location” directive and the modified one looks like this.
<Location /svn> DAV svn SVNPath /project/svn </Location>
If you haven’t made the above More >
How to generate random password using Bash shell scripting
Jan 14th
All Linux systems have a special device “/dev/urandom” which can throw random bytes while reading. But this device gives binary data which may contain non-printable characters. However as we need human-readable characters for a password, we can pick all alpha-numeric characters out the random binary data read from the special device.
The following script reads a binary stream from /dev/urandom and picks up first 8 alpha-numeric characters and form a 8-chracter long random password. If you want to change the length of the password, change “-c8” option given to “head” to anything you want. For example “-c16” will give you 16-character More >
How to safely reboot a frozen Linux system
Jan 14th
If your Linux system is frozen completely and there is absolutely no response and you are planning to unplug the power cable for hard reboot, there is a way to graciously reboot the system without unplugging the cable.
First of all ensure that your system is actually frozen:
Try Ctrl+Alt+Backspace combination if you are using graphical mode. If it doesn’t work, then try “Ctrl+Alt+F1“, “Ctrl+Alt+F2” etc to see if you can get to a shell in text mode.
If the Linux system doesn’t respond to any of the above attempts, you can do the following to graciously reboot the system.
- Press Alt+SysReq
- Press the following sequence More >
FTP – How to upload/download or delete directories recursively
Jan 14th
The standard FTP program doesn’t support recursive operations on directories. The ncftp command supports recursive operations. This is very useful if your web hosting supports only FTP transfer.
First of all, check if ncftp command is already present in your Linux system.
[neo@techpulp ~]# ncftp bash: ncftp: command not found [neo@techpulp ~]#
If it is not present, then install appropriate package using “yum“.
[root@techpulp ~]# yum -y install ncftp
The following shows how to use ncftp to use a specific login instead of anonymous login.
[neo@techpulp ~]# ncftp -u neo liz.techpulp.com NcFTP 3.2.2 (Aug 18, 2008) by Mike Gleason (http://www.NcFTP.com/contact/). Connecting to 127.0.0.1... (vsFTPd 2.0.7) Logging in... Password More >
How to control system services in Fedora Linux
Jan 14th
Fedora Linux systems come with a command called “service” which can be used to control the system-wide services while the system is running. Typically each system service provides at least four operations: start, stop, restart, status. Using the “service” command, you can start, stop or restart a system service as shown below. The following example shows how to start and web server (httpd service).
[root@techpulp ~]# /sbin/service httpd start
Starting httpd: [ OK ]
[root@techpulp ~]#
Similarly you can stop a service (httpd in this case) as shown below.
[root@techpulp ~]# /sbin/service httpd stop
Stopping httpd: [ OK ]
[root@techpulp ~]#
To know if More >


Recent Comments