Skip to content

SysTutorials

  • Tutorials
  • Linux
  • Linux Manuals
  • Systems
  • Programming
  • Software
  • Subscribe
  • Search
SysTutorials

  • QA

    How to get the running process’ parent process’ ID in Go?

    ByQ A Mar 24, 2018

    How to get the running process’ parent process’ ID in Go? In Go, you may call the os.Getppid() func from the os package to get the parent process’ pid. func Getppid() int Getppid returns the process id of the caller’s parent. One example is as follows. $ gore gore version 0.2.6 :help for help gore>…

    Read More How to get the running process’ parent process’ ID in Go?Continue

  • QA

    How to get the running process’ parent process’ ID in Python?

    ByQ A Mar 24, 2018

    How to get the running process’ parent process’ ID in Python? In Python, you can get the parent process’ pid by calling os.getppid(): import os ppid = os.getppid() One example: The shell’s pid: $ echo $$ 21779 Start a python REPL and get its parent pid (the shell’s): $ python Python 2.7.5 (default, Nov 6…

    Read More How to get the running process’ parent process’ ID in Python?Continue

  • QA

    How to get the running process’ parent process’ ID in Bash?

    ByQ A Mar 24, 2018

    How to get the running process’ parent process’ ID in Bash? In Bash, you can get the parent process’s pid from the variable PPID. Note that in a (…) subshell, the $$ stores the subshell’s parent shell pid actually.

    Read More How to get the running process’ parent process’ ID in Bash?Continue

  • Programming | QA

    Getting Process Own Pid in C and C++

    ByQ A Mar 24, 2018Mar 26, 2023

    How to get the running process’ pid in C / C++? In C and C++, you can call the getpid() library function which is a function from the POSIX library. #include <sys/types.h> #include <unistd.h> pid_t getpid(void); getppid() returns the process ID of the calling process. An example C program to get self process ID getpid.c:…

    Read More Getting Process Own Pid in C and C++Continue

  • QA

    How to get the running process’ pid in Go?

    ByQ A Mar 24, 2018

    How to get the running process’ pid in Go lang? In Go, you may call the os.Getpid() func from the os package to get the parent process’ pid. func Getpid() int Getppid returns the process id of the caller. One example is as follows. $ gore gore version 0.2.6 :help for help gore> :import “fmt”…

    Read More How to get the running process’ pid in Go?Continue

  • Programming | QA

    Getting the running process’ own pid in Python

    ByQ A Mar 24, 2018Sep 18, 2022

    How to get the running process’ pid in Python? In Python, you can get the pid of the current process by import os os.getpid() From the official doc: os.getpid() Return the current process id. One example os using os.getpid() to get process own ID: $ python3 Python 3.8.10 (default, Jun 22 2022, 20:18:18) [GCC 9.4.0]…

    Read More Getting the running process’ own pid in PythonContinue

  • QA

    How to get the running process’ pid in Bash?

    ByQ A Mar 24, 2018

    How to get the running process’ pid in Bash? In Bash, you can get the process ID from the variable $$. Note that in a subshell invoked by ‘(…)‘, $$ is actually the parent process’ pid. In Bash 4, you can also use $BASHPID to get the process pid.

    Read More How to get the running process’ pid in Bash?Continue

  • QA

    How to Debug a Bash script?

    ByEric Ma Mar 24, 2018Apr 12, 2020

    How to debug a Bash script if it has some bugs? Common techniques like printing varibles out for checking apply for bash too. For bash, I also use 2 bash-specific techniques. Use errexit option Run the script with -e option like bash -e your-script.sh or add set -o errexit to the beginning of the script….

    Read More How to Debug a Bash script?Continue

  • Tutorial

    How to get all the keys in an associative array in Bash?

    ByDavid Yang Mar 24, 2018Aug 1, 2020

    How to get all the keys of an associative array in Bash? There are at least 2 ways to get the keys from an associative array of Bash. Let’s start with an example associative array: $ declare -A aa $ aa[“foo”]=bar $ aa[“a b”]=c We can use the @ special index to get all the…

    Read More How to get all the keys in an associative array in Bash?Continue

  • Linux | QA | Tutorial

    How to find the disk where root / is on in Bash on Linux?

    ByEric Ma Mar 24, 2018Aug 2, 2020

    Question: how to find the disk where the Linux’s root(/) is on in Bash? The root may be on a LVM volume or on a raw disk. 2 cases: One example: # df -hT | grep /$ /dev/sda4 ext4 48G 32G 14G 71% / For another example: # df -hT | grep /$ /dev/mapper/fedora-root ext4…

    Read More How to find the disk where root / is on in Bash on Linux?Continue

  • QA

    How to set Zimbra web service’s hostname and port?

    ByEric Ma Mar 24, 2018Mar 24, 2018

    In Zimbra server, how to set Zimbra web service’s hostname and port? Set Zimbra Web service’s host and port (to mail.domain.com:80 as an example) for a mail domain domain.com: zmprov md domain.com zimbraPublicServiceHostname mail.domain.com zmprov md domain.com zimbraPublicServicePort 80 Reference: https://wiki.zimbra.com/wiki/When_using_a_proxy,_the_’change_password’_box_doesn’t_load

    Read More How to set Zimbra web service’s hostname and port?Continue

  • QA | Tutorial

    How to get the one character’s next character in ASCII table in Bash?

    ByDavid Yang Mar 24, 2018Jul 26, 2020

    How to get the one character’s next character in ASCII table in Bash? For example, if I have ‘a’ in variable i, how to get ‘b’? First, we need to get the integer value for the character. char=’b’ charint=$(printf “%d” “‘$char'”) Then, we increase the integer by one let charint=$charint+1 Last, we can get the…

    Read More How to get the one character’s next character in ASCII table in Bash?Continue

  • QA

    How to get the version of Zimbra?

    ByEric Ma Mar 24, 2018Mar 24, 2018

    How to get the version of Zimbra I am using in a Zimbra server? In Zimbra, to get the version of Zimbra you are using, you can call zmcontrol -v: $ zmcontrol -v Release 7.2.6_GA_2926.F13_64_20131203115902 F13_64 FOSS edition.

    Read More How to get the version of Zimbra?Continue

  • Linux

    How to disable DHCP in dnsmasq on Linux?

    ByQ A Mar 24, 2018Nov 24, 2019

    How to disable the DHCP service in dnsmasq on Linux? That is, to leave only dnsmasq’s DNS service. The `/etc/dnsmasq.conf` file may have lines that enable DHCP service of dnsmasq. By default, the DHCP is disabled in dnsmasq (check one example dnsmasq.conf file). To disable DHCP service in dnsmasq, in `/etc/dnsmasq.conf`, remove or disable the…

    Read More How to disable DHCP in dnsmasq on Linux?Continue

  • Tutorial

    How to split a string by string in PHP?

    ByQ A Mar 24, 2018Nov 24, 2019

    How to split a string by string in PHP? For example, “a string separated by space” => [“a”, “string”, “separated”, “by”, “space”] and “a,string,separated,by,comma” => [“a”, “string”, “separated”, “by”, “comma”] The commonly used `explode()` is not enough here because multiple delimiters should be consider as one (such as ” “, 3 spaces together, is consider…

    Read More How to split a string by string in PHP?Continue

  • QA | Tutorial

    How to delete or get the number in the tail from a string in shell script?

    ByDavid Yang Mar 24, 2018Jul 26, 2020

    How to delete or get the number in the tail from a string in shell script (bash script)? Okay to call other tools. For example, from “/dev/sda8”, I want to get “/dev/sda” and “8” separately. This can be achieved by using sed as follows. To get the string after deleting the tailing numbers, we can…

    Read More How to delete or get the number in the tail from a string in shell script?Continue

  • QA

    How to split a string by string in Bash?

    ByEric Ma Mar 24, 2018Mar 24, 2018

    How to split a string by string in Bash? For example, “a string separated by space” => [“a”, “string”, “separated”, “by”, “space”] and “a,string,separated,by,comma” => [“a”, “string”, “separated”, “by”, “comma”] You can convert a string to an array using the grammar like inarr=(${a}) If the delimiter is not space and delimiter is a single character…

    Read More How to split a string by string in Bash?Continue

  • QA

    What’s the standard or common data structure for a list of objects in C?

    ByQ A Mar 24, 2018

    In C, what’s the standard or common data structure for a list of objects? In C, one common way to store a list/collection of objects of the same type is to use one-dimensional arrays. In C, an array is a collection of data objects of the same type. An array is in a contiguous memory…

    Read More What’s the standard or common data structure for a list of objects in C?Continue

  • QA

    What’s the standard or common data structure for a list of objects in C++?

    ByQ A Mar 24, 2018

    In C++, what’s the standard or common data structure for a list of objects? In C++, the common data structure for a sequence (“list”) of objects may be std::vector. A vector is a dynamically resizable array. It is “The most extensively used container in the C++ Standard Library …, offering a combination of dynamic memory…

    Read More What’s the standard or common data structure for a list of objects in C++?Continue

  • QA

    Most important aspects or features of the C++ programming language?

    ByQ A Mar 24, 2018

    Could you list the most important features or aspects for the C++ programming languages that describe its most important features/domains that are different from the others? For C++, as in Going Native 2012 Keynote by Bjarne Stroustrup: light-weight abstraction Key strengths: infrastructure software resource-constrained applications

    Read More Most important aspects or features of the C++ programming language?Continue

Page navigation

Previous PagePrevious 1 … 13 14 15 16 17 … 70 Next PageNext

© 2026 SysTutorials

  • Tutorials
  • Linux
  • Linux Manuals
  • Systems
  • Programming
  • Software
  • Subscribe
  • Search