Archive for January, 2009
What is DMZ network and why is it needed
Jan 29th
In networking terminology, the DMZ network is defined as a network which is less restricted as opposed to corporate network (LAN) which can never be accessible to outside world directly. It is always recommended that all public servers like web server, ftp server etc be places in a physically separate network from corporate network. This is to eliminate possibility of compromising a corporate system if any of the public servers is compromised.
The Network Firewall plays a key role in controlling the in-bound connections. In this case, any connection coming from Internet is denied if it attempt to reach LAN/corporate network. More >
How to verify the integrity of a large downloaded file
Jan 29th
There are some algorithms like MD5 and SHA1 which generate unique digest for any given input. Basic idea is to find the MD5 or SHA1 digest of the file which is going to be downloaded and cross check the same after calculating digest after downloading the file locally. There are command line utilities “md5sum” and “sha1sum” to compute digest using MD5 and SHA1 algorithms respectively.
Typically the servers place a special file “MD5SUM” or “md5sum.txt” or “SHA1SUM” (file name may vary) in the same directory from where you are trying to download the large file. This “MD5SUM” contains digests of all More >
How to monitor all processes in a Linux/UNIX system
Jan 29th
The Linux system provides a command called “top” which provides dynamic real-time view of running processes, memory status, cpu usage and other system information. This command is very easy to use and it updates the display automatically and user just needs to keep the command open. Then user needs to press the key “q” to close the display.
Here is the output of “top” command look like.
Tasks: 179 total, 1 running, 178 sleeping, 0 stopped, 0 zombie Cpu(s): 7.2%us, 2.6%sy, 0.0%ni, 88.5%id, 1.5%wa, 0.1%hi, 0.0%si, 0.0%st Mem: 2007980k total, 1046836k used, 961144k free, 55852k buffers Swap: 803208k total, 0k used, 803208k More >
How to see last login records of a user in Linux
Jan 29th
The Linux system stores login attempts of all users in a file called “wtmp“. Typically this file will be located in “/var/log” directory. The Linux command line utility “last” can be used to list the currently logged in users as well as their previous logins. The plain usage of the command without any arguments displays information about all users of the system.
[nick@techpulp ~]# last nick pts/4 :0 Thu Jan 29 21:59 still logged in neo pts/3 :0 Thu Jan 29 21:59 still logged in reboot system boot 2.6.10.5-1.fc2 Thu Jan 1 17:39 (01:38) liz pts/3 :0 Thu Jan 1 16:39 More >
How to list hidden files in Linux/UNIX
Jan 27th
Any hidden file or directory in UNIX/Linux systems start with period (.) character. The standard usage of “ls” skips the hidden files and directories from display. However if you would like to view hidden ones as well, the “ls” command supports “-a” option for it.
[neo@techpulp ~]# ls -a . changes.txt .fonts.conf .ICEauthority Music .. .bash_history Documents ginger.js .local .bash_profile Download .gpg-agent-info .macromedia Public .bashrc .esd_auth .gstreamer-0.10 Misc .pulse [neo@techpulp ~]#
In the above output, all files starting with period (.) characters are hidden files expect “.” and “..” entries. They are special files and represent current directory and parent directory respectively. You More >
How to check if a Bash variable is set or not
Jan 23rd
There is no direct method in bash to determine if a variable is set or not. But we can use “parameter expansion” feature provided by bash. The following example script determines if bash variables MYVAR and MYVAR1 are set or not.
#!/bin/bash
MYVAR=hello
if [ -n "${MYVAR+x}" ]; then
echo MYVAR is set
else
echo MYVAR is not set
fi
if [ -n "${MYVAR1+x}" ]; then
echo MYVAR1 is set
else
echo MYVAR1 is not set
fi
Here is the output of above script where MYVAR is set but MYVAR1 is not set.
[neo@techpulp ~]# sh vset.sh MYVAR is set MYVAR1 is not More >
How to determine type of a file in Linux
Jan 23rd
The command “file” tells you the file type and format. It maintains loads of magics in its database to identify the type of a file. If it can’t determine the file type, it will display whether it is an ASCII file or a binary file.
Here are few examples:
[neo@techpulp ~]# file /bin/bash /bin/bash: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped [neo@techpulp ~]# [neo@techpulp ~]# file Videos/Animals/leopard.flash Videos/Animals/leopard.flash: Macromedia Flash Video [neo@techpulp ~]# [neo@techpulp ~]# file MyDocs.zip MyDocs.zip: Zip archive data, at least v1.0 to extract [neo@techpulp ~]# file mantis-1.1.6-1.fc10.noarch.rpm mantis-1.1.6-1.fc10.noarch.rpm: RPM v3 bin mantis-1.1.6-1.fc10 More >
How to find how much disk space a directory is consuming in Linux
Jan 23rd
The Linux command line utility “du” (disk usage) tells you how much space a file or a directory is taking on the disk. Just run the command against a file or a directory. If a directory is specified it determines disk space used by all files and sub directories recursively. By default it displays number in KB (kilo bytes) and the option “-h” makes it show the sizes in human-readable format.
[neo@techpulp ~]# du -h Videos/ 59M Videos/Animals 4.0K Videos/Funny 59M Videos/ [neo@techpulp ~]#
You might be wondering what is the use of “du” command against a single file as “ls -l” on More >
How to disable Ads using HOSTS file in Microsoft Windows/Linux/UNIX
Jan 21st
One way of avoiding online advertisements is to redirect all requests to Ad sites to locahost so that bandwidth is well utilized. It also results in faster browsing as it eliminates Domain Name Service (DNS) requests. For this you need to define custom entries for Ad servers in system HOSTS file to redirect them to localhost (127.0.0.1). The browser first looks at the system HOSTS file for known hosts and if it doesn’t fin it there it will contact the DNS server to resolve IP address of the host name.
The Location of HOSTS file in various operating systems:
Windows 95/98/Me:
The HOSTS More >


Recent Comments