https://askubuntu.com/questions/153976/how-do-i-get-the-parent-process-id-of-a-given-child-process https://superuser.com/questions/150117/how-to-get-parent-pid-of-a-given-process-in-gnu-linux-from-command-line/544696#544696
Category Archives: Bash
Indicate how each name would be interpreted if used as a command name
$type -a locate locate is /usr/bin/locate $type -a ls ls is aliased to `ls –color=auto’ ls is /bin/ls $type -t ls alias $type -t locate file $type -t /dev/urandom $type -t /dev/sda1 $type -t urandom $type -t sda1 $type -t type builtin $type -t shuf file $type -t bash file $type -t proc $type -t …
Continue reading “Indicate how each name would be interpreted if used as a command name”
sort – sort lines of text files
$cat test.txt sept aug jan dec oct apr feb mar11 mar1 $sort test.txt apr aug dec feb jan mar1 mar11 oct sept $sort -M test.txt jan feb mar1 mar11 apr aug sept oct dec $
fold: Wrap input lines to fit in specified width
$cat test.pl use strict; use File::Rename (); use Pod::Usage; main() unless caller; sub main { my $options = File::Rename::Options::GetOptions or pod2usage; mod_version() if $options->{show_version}; pod2usage( -verbose => 2 ) if $options->{show_manual}; pod2usage( -exitval => 1 ) if $options->{show_help}; @ARGV = map {glob} @ARGV if $^O =~ m{Win}msx; File::Rename::rename(\@ARGV, $options); } sub mod_version { print __FILE__ …
Continue reading “fold: Wrap input lines to fit in specified width”
GNU bash exit codes with special meanings
$printenv > /dev/null $echo $? 0 $printenv /dev/null $echo $? 1 $/dev/null bash: /dev/null: Permission denied $echo $? 126 $nocommand bash: nocommand: command not found… $ $echo $? 127 $ http://www.tldp.org/LDP/abs/html/exitcodes.html
Hacking with runit and sv ( sv – control and manage services monitored by runsv(8) ) commands
ABOUT runit runit is a cross-platform Unix init scheme with service supervision, a replacement for sysvinit, and other init schemes. It runs on GNU/Linux, *BSD, MacOSX, Solaris, and can easily be adapted to other Unix operating systems ABOUT sv The sv program reports the current status and controls the state of services monitored by the …
pr – convert text files for printing
The following shows a command line session with pr command which helps in displaying contents of a file in shell scripts. $cat lkg.txt A for Apple B for Ball C for Cat D for Donkey E for Elephant F for Fox G for Goat H for Horse I for Insect $pr -l 10 lkg.txt A …
What does true and false commands do ?
commandline session $true $true $? $echo $? 0 $false $echo $? 1 $echo $? 0 $echo $? 0 $false ; true $echo $? 0 $true ; false ; echo $? 1 $true ; false ; echo $? 1 $true ; false ; echo $? 1 $true ; false ; echo $? ; echo $? 1 …
script — make typescript of terminal session
STITCHED (C) FROM : Virtual Terminals commandline session $script Script started, file is typescript $ls Algorithms bookmark config-files firewall kernel_start.asm loader scripts animation books debian GD kernel_start.s Mail test art.text bugs-general debian-howtos jeffrin language ovlfose typescript beautifulwork cairo Docs kernel linux README web.application $ls -a . beautifulwork config-files GD kernel_start.s ovlfose web.application .. bookmark debian …
Continue reading “script — make typescript of terminal session”
common network utilities/tools
commandline session $ping www.beautifulwork.org PING beautifulwork.org (46.22.210.18) 56(84) bytes of data. 64 bytes from mars.infoclub.in (46.22.210.18): icmp_req=1 ttl=53 time=310 ms 64 bytes from mars.infoclub.in (46.22.210.18): icmp_req=2 ttl=53 time=210 ms 64 bytes from mars.infoclub.in (46.22.210.18): icmp_req=3 ttl=53 time=210 ms 64 bytes from mars.infoclub.in (46.22.210.18): icmp_req=4 ttl=53 time=210 ms 64 bytes from mars.infoclub.in (46.22.210.18): icmp_req=5 ttl=53 time=211 …