Best Web Hosting


COUPON CODE:  techpulpdeal



and get $9.94 off on all hosting plans

Search


There are hundreds of cool tips and tricks. Just search the site below.


Browse articles of 2010 | 2009 | 2008



How to lock and unlock an user account in Linux

August 25, 2010 By: Mark Category: Administration

Any user account can be locked or unlocked only by Administrator (i.e root user). This is done using passwd command as explained below. When an user account is locked, Linux sets a irrecoverable password for that account so that login always fails. However Linux still stores the original password of the account before locking so that unlocking such account retains its original password.

To lock a user account (liz) from logging in:

[root@techpulp ~]# passwd -l liz
Locking password for user liz.
passwd: Success
[root@techpulp ~]#

To unlock a user account (liz):

[root@techpulp ~]# passwd -u liz
Unlocking password for user liz.
passwd: Success
[root@techpulp ~]#

You can read this article for confirming password status of an user account.

How to get standard 80×25 console instead of SVGA console in Fedora Linux

August 24, 2010 By: Neo Category: Fedora

If you want to get good old 80×25 console in text mode of Fedora, you need to pass “nomodeset” option to the kernel.

Open the file /etc/grub.conf or /boot/grub/grub.conf file and “nomodeset” option to the “kernel” line of the active boot entry.

kernel /vmlinuz-2.6.28.24 ro root=/dev/sda2 rhgb quiet nomodeset

How to disable graphical boot in Fedora

August 23, 2010 By: Neo Category: Fedora

To disable graphical boot in Fedora, you need to modify system configuration.

Open the file “/etc/sysconfig/init” and change the line “GRAPHICAL=yes” to “GRAPHICAL=no“. This only disables Fedora from using graphics mode during start up. So Fedora shows the text bar during start up.

However if you want to disable graphical login screen and move to text mode completely, you need to edit the following line in “/etc/inittab” file.

Change

id:5:initdefault:

to

id:3:initdefault:

In the above line, “5″ means graphical mode login and “3″ means text mode login.

How to change home directory of a user in Linux

August 21, 2010 By: Neo Category: Administration, Command Line

Ensure you have shadow-utils package installed.

yum install -y shadow-utils

Use the following command to set new home directory /home/newhome for user “myuser”.

usermod -d /home/newhome myuser

How to change user login name in Linux

August 20, 2010 By: Neo Category: Administration

Ensure you have shadow-utils package installed

yum install -y shadow-utils

Then run the following command to change an existing login name “olduser” to “newuser”.

usermod -n newuser olduser

How to build in silent mode using GNU make

August 19, 2010 By: Neo Category: GNU Make

Use the following command for absolutely silent build

make -s

Use the following command for absolutely silent build except printing directory before and after processing.

make -s -w

How to define local links in a web page

August 18, 2010 By: Liz Category: HTML

The local links in a web page are called anchors.

To define an anchor in a HTML page, create a dummy “a” link as shown below.

<a id="chapter1"></a>

Create a link that user can click on to go to the previously defined anchor.

<a href="#chapter1">Chapter1</a>

Simple usage of sed command

August 17, 2010 By: Neo Category: Command Line, Unix

The following examples show you how sed command can be used as a powerful alternative to general commands like head, tail etc.

Let us consider the below input file for all the examples explained here.

[neo@techpulp ~]# cat input.txt
Line1
Line2
Line3
Line4
Line5
Line6
Line7
Line8
Line9
Line10
Line11
Line12
Line13
Line14
Line15
Line16
Line17
Line18
Line19
Line20
[neo@techpulp ~]#

Print all lines

[neo@techpulp ~]# sed -e ''  input.txt
Line1
Line2
Line3
Line4
Line5
Line6
Line7
Line8
Line9
Line10
Line11
Line12
Line13
Line14
Line15
Line16
Line17
Line18
Line19
Line20
[neo@techpulp ~]#

Do not print first 10 lines of input. Here “d” stands for deletion.

[neo@techpulp ~]# sed -e '1,10d' input.txt
Line11
Line12
Line13
Line14
Line15
Line16
Line17
Line18
Line19
Line20
[neo@techpulp ~]#

Print first ten lines of input

[neo@techpulp ~]# sed -e '1,10!d' input.txt
Line1
Line2
Line3
Line4
Line5
Line6
Line7
Line8
Line9
Line10
[neo@techpulp ~]#

Display only first five lines

Here “p” stand for print and “-n” options negates default behaviour of printing.

[neo@techpulp ~]# sed -n -e '1,5p' input.txt
Line1
Line2
Line3
Line4
Line5
[neo@techpulp ~]#

Display lines 1 to 5 and 10 to 12

[neo@techpulp ~]# sed -n -e '1,5p' -e '10,12p' input.txt
Line1
Line2
Line3
Line4
Line5
Line10
Line11
Line12
[neo@techpulp ~]#

Do the same with the expressions delimited by new lines

[neo@techpulp ~]# sed -n -e '1,5p
> 10,12p' input.txt
Line1
Line2
Line3
Line4
Line5
Line10
Line11
Line12
[neo@techpulp ~]#

Do not display 1 to 5 and 10 to 12

[neo@techpulp ~]# sed -e '1,5d' -e '10,12d' input.txt
Line6
Line7
Line8
Line9
Line13
Line14
Line15
Line16
Line17
Line18
Line19
Line20
[neo@techpulp ~]#

Delete all lines after 11

[neo@techpulp ~]# sed -e '11,$d' input.txt
Line1
Line2
Line3
Line4
Line5
Line6
Line7
Line8
Line9
Line10
[neo@techpulp ~]#

Print lines after 11

[neo@techpulp ~]# sed -n -e '11,$p' input.txt
Line11
Line12
Line13
Line14
Line15
Line16
Line17
Line18
Line19
Line20
[neo@techpulp ~]#

You can use !p or !d to negate the sed expression.

How to resolve xinetd startup errors in Linux

April 13, 2010 By: Neo Category: Administration

The best way to solve any service start up errors in Linux is to run them manually with debug mode on. The difficulty comes from finding exact command line arguments to be passed (as if it were started by Linux start up scripts) and also disabling default daemon mode for the server command. You can easily find the options to enable debug mode for the server by quickly looking at man page.

For example, you can use following command to run xinetd service in the foreground with debug on.

[root@techpulp ~]# /usr/sbin/xinetd -d -dontfork
10/4/13@00:34:14: DEBUG: 3657 {handle_includedir} Reading included configuration file: /etc/xinetd.d/chargen-dgram [file=/etc/xinetd.conf] [line=49]
10/4/13@00:34:14: DEBUG: 3657 {handle_includedir} Reading included configuration file: /etc/xinetd.d/chargen-stream [file=/etc/xinetd.d/chargen-stream] [line=67]
10/4/13@00:34:14: DEBUG: 3657 {handle_includedir} Reading included configuration file: /etc/xinetd.d/cvs [file=/etc/xinetd.d/cvs] [line=67]
10/4/13@00:34:14: DEBUG: 3657 {handle_includedir} Reading included configuration file: /etc/xinetd.d/daytime-dgram [file=/etc/xinetd.d/daytime-dgram] [line=19]
10/4/13@00:34:14: DEBUG: 3657 {handle_includedir} Reading included configuration file: /etc/xinetd.d/daytime-stream [file=/etc/xinetd.d/daytime-stream] [line=67]
10/4/13@00:34:14: DEBUG: 3657 {handle_includedir} Reading included configuration file: /etc/xinetd.d/discard-dgram [file=/etc/xinetd.d/discard-dgram] [line=67]
10/4/13@00:34:14: DEBUG: 3657 {handle_includedir} Reading included configuration file: /etc/xinetd.d/discard-stream [file=/etc/xinetd.d/discard-stream] [line=67]
10/4/13@00:34:14: DEBUG: 3657 {handle_includedir} Reading included configuration file: /etc/xinetd.d/echo-dgram [file=/etc/xinetd.d/echo-dgram] [line=67]
10/4/13@00:34:14: DEBUG: 3657 {handle_includedir} Reading included configuration file: /etc/xinetd.d/echo-stream [file=/etc/xinetd.d/echo-stream] [line=67]
10/4/13@00:34:14: DEBUG: 3657 {handle_includedir} Reading included configuration file: /etc/xinetd.d/rsync [file=/etc/xinetd.d/rsync] [line=67]
10/4/13@00:34:14: DEBUG: 3657 {handle_includedir} Reading included configuration file: /etc/xinetd.d/tcpmux-server [file=/etc/xinetd.d/tcpmux-server] [line=14]
10/4/13@00:34:14: DEBUG: 3657 {handle_includedir} Reading included configuration file: /etc/xinetd.d/tftp [file=/etc/xinetd.d/tftp] [line=68]
10/4/13@00:34:14: DEBUG: 3657 {handle_includedir} Reading included configuration file: /etc/xinetd.d/time-dgram [file=/etc/xinetd.d/time-dgram] [line=19]
10/4/13@00:34:14: DEBUG: 3657 {handle_includedir} Reading included configuration file: /etc/xinetd.d/time-stream [file=/etc/xinetd.d/time-stream] [line=67]
10/4/13@00:34:14: DEBUG: 3657 {handle_includedir} Reading included configuration file: /etc/xinetd.d/vmware-authd [file=/etc/xinetd.d/vmware-authd] [line=67]
10/4/13@00:34:14: DEBUG: 3657 {remove_disabled_services} removing chargen
10/4/13@00:34:14: DEBUG: 3657 {remove_disabled_services} removing chargen
10/4/13@00:34:14: DEBUG: 3657 {remove_disabled_services} removing cvspserver
10/4/13@00:34:14: DEBUG: 3657 {remove_disabled_services} removing daytime
10/4/13@00:34:14: DEBUG: 3657 {remove_disabled_services} removing daytime
10/4/13@00:34:14: DEBUG: 3657 {remove_disabled_services} removing discard
10/4/13@00:34:14: DEBUG: 3657 {remove_disabled_services} removing discard
10/4/13@00:34:14: DEBUG: 3657 {remove_disabled_services} removing echo
10/4/13@00:34:14: DEBUG: 3657 {remove_disabled_services} removing echo
10/4/13@00:34:14: DEBUG: 3657 {remove_disabled_services} removing rsync
10/4/13@00:34:14: DEBUG: 3657 {remove_disabled_services} removing tcpmux
10/4/13@00:34:14: DEBUG: 3657 {remove_disabled_services} removing tftp
10/4/13@00:34:14: DEBUG: 3657 {remove_disabled_services} removing time
10/4/13@00:34:14: DEBUG: 3657 {remove_disabled_services} removing time
Service defaults
Instances = 50
Groups = yes
umask = 2
CPS = max conn:50 wait:10
PER_SOURCE = 10
Bind = All addresses.
Only from: All sites
No access: No blocked sites
Logging to syslog. Facility = daemon, level = info
Log_on_success flags = HOST DURATION EXIT PID
Log_on_failure flags = HOST

Service configuration: vmware-authd
id = vmware-authd
flags = IPv6
type = UNLISTED
socket_type = stream
Protocol (name,number) = (tcp,6)
port = 904
wait = no
user = 0
Groups = yes
umask = 2
PER_SOURCE = 10
Bind = All addresses.
Server = /usr/sbin/vmware-authd
Server argv = vmware-authd
Only from: All sites
No access: No blocked sites
Logging to syslog. Facility = daemon, level = info
Log_on_success flags = HOST DURATION EXIT PID
Log_on_failure flags = HOST

10/4/13@00:34:14: DEBUG: 3657 {cnf_start_services} Started service: vmware-authd
10/4/13@00:34:14: DEBUG: 3657 {cnf_start_services} mask_max = 6, services_started = 1
10/4/13@00:34:14: NOTICE: 3657 {main} xinetd Version 2.3.14 started with libwrap loadavg labeled-networking options compiled in.
10/4/13@00:34:14: NOTICE: 3657 {main} Started working: 1 available service
10/4/13@00:34:14: DEBUG: 3657 {main_loop} active_services = 1
^C10/4/13@00:34:15: NOTICE: 3657 {general_handler} Unexpected signal 2 (Interrupt)
[root@techpulp ~]#

In the above case, I have pressed Ctrl+C to stop the process. However if you have a problem of starting xinetd service on your system, you should see some relevant error before process exits.

What is the best alternative to WinZip

January 18, 2010 By: Neo Category: Microsoft Windows

If you are tired of commerical software WinZip, The best free software alternative to WinZip is 7-zip.

In fact 7-zip is better than WinZip as it supports more formats like BZIP2, RPM etc along with its own format 7z.

7-zip in Windows

7-zip in Windows

The 7-zip can create archives of following formats.

  • 7z, ZIP, GZIP, BZIP2 and TAR

The 7-zip application can unzip following formats

  • 7z, ZIP, GZIP, BZIP2 and TAR
  • ARJ, CAB, CHM, CPIO, DEB, DMG, HFS, ISO, LZH, LZMA, MSI, NSIS, RAR, RPM, UDF, WIM, XAR and Z.

This is best compatible with UNIX flavours as it supports the archives seen on UNIX systems like GZIP, TAR, BZIP2, Z, CPIO and RPM.

It can unzip RAR format which is seen on most downloading sites.

  • Best Ever Deal on Earth