≡ Menu

Programming Tutorials and HowTos

Programming related tutorials, topics, howtos, tips, and hacks under Linux, OS X, *BSD and Unix like operating systems with special focus on sys admin/devops tasks ( rss feed ).

PHP Print array

Q. How do I print array with PHP?
[click to continue…]

Hello World In Python Tutorial

How do I write my first program in python? How do I print "hello world" message in Python?
[click to continue…]

x86_64 Linux Error: gnu/stub-32.h Missing Error and Solution

I'm getting the following error while compiling application under CentOS / RHEL / Fedora Linux 64 bit edition:

/usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h:

No such file or directory

How do I fix this error and compile my applications using gcc under RHEL / Fedora / CentOS Linux 64bit system?
[click to continue…]

FreeBSD Install BASH Shell

I'd like to Bash shell under FreeBSD for bash programming. How do I install bash shell under FreeBSD UNIX operating system?
[click to continue…]

Bash Shell Check Whether a Directory is Empty or Not

How do I check whether a directory is empty or not under Linux / UNIX using a shell script? I would like to take some action if directory is empty on a Linux or Unix like system. How can I check from bash/ksh shell script if a directory contains files? How do I check whether a directory is empty or not?
[click to continue…]

How to compile program under Linux / UNIX / FreeBSD

Q. I've downloaded tar ball software but I don't know how to compile the same? Can you provide the instructions for compiling a program?

A. Many new users find it difficult to compiling programs in Linux. Usually following steps are involved:

a] Download tar ball using wget

b] Untar tar ball using tar command

c] Compile program using make or configure command

d] Install software

Task: compiling program

Step # 1: Download program tar ball:
$ wget http://url-com/prog.tar.gz
Step # 2: Untar tar ball :
$ tar -zxvf prog.tar.gz
$ cd prog

Step # 3: Untar tar ball:
Configure program:
$ ./configure
Compile program:
$ make
Install program (must be run as the root, login using su or use sudo):
$ sudo make install
$ su -
$ make install

How you can run a c program in Linux?

Q. I've a c program and I'd like to run in Linux.

A. C program need to compile and run in Linux using cc or gcc command. When you invoke GCC (GNU C Compiler), it normally does preprocessing, compilation, assembly and linking for you. For example to compile hello.c program , type the following command:
cc -o hello hello.c
gcc -o hello hello.c

It will compile and produced an exectuable file called hello. To run program type:

UNIX Shell Scripting Tutorial

What is UNIX shell scripting? Can you provide UNIX shell scripting tutorial?
[click to continue…]

HowTo Apply a Patch File To My Linux / UNIX Source Code

I am a new Linux and Unix system user. I also know that I can patch binary package using up2date or yum command in Linux. I was wondering is if there's a way to apply a patch file to downloaded source code on a Linux / UNIX like operating system source tree?
[click to continue…]

PHP: Determine or Retrieve Visitor’s IP Address Using PHP Script

How do I determine or retrieve visitor's IP address using PHP server side programming under Unix/Windows operating systems?
[click to continue…]