Skip to content

Tag: unix

How the parent is restored after vfork()

As vfork creates the child process in the same address space as that of the parent, and when execv() is called on the child then how is the parent process restored, as exec loads the file and runs it in the same address space of the parent and hence the child? Answer When execv follows a true vfork, it does

Demon function on RHEL 7

I have script in RHEL 6 which is using default function such as /etc/rc.d/init.d/functions can we use same functions on RHEL 7 to start the daemon process? . Also let me know, if there is any difference for /etc/rc.d/ between RHEL 6 and RHEL 7? Answer This file is provided by the initscripts package, which is…

advanced printf explanation in bash

I just found this programming segment in my son’s Bash file. I am quite a newbie and unable to understand the printf syntax. Can someone explain me the COMMENTED printf in the segment below?? Answer It’s is nothing but a busy/wait spinner and the lines commented do nothing but set a blue foregroun…

Create directories and download files by reading input from a file

Hi! I have this piece of code that reads field by field from the file specified. What I am trying to do here is I am creating a directory that is specified in second field and then I am downloading file specified in first field and then after having that file downloaded I am that file in the directory specifi…

Understanding Unix Owner and chmod 777

I understand, Unix has 3 levels of ownership: Owner, Group, and Others. The owner is the one who creates the file and later on this Ownership can be moved using ‘chown’. However, I am confused with chmod 777 to ‘others’ or ‘groups’. Executing the previous command on a file …

Bash poweroff script hangs system

My intention is to cycle through my list of ips and poweroff if my ping succeeds first. However the systems seems to hang. After running this script I can’t ping the systems anymore and they aren’t powered off. If I run ssh 192.168.1.ip “sudo poweroff” through terminal I dont encounter…