Category: Bash

  • 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

  • Travel through a wonderful command named hexdump PART 1

    ABOUT In computing, a hex dump is a hexadecimal view (on screen or paper) of computer data, from RAM or from a file or storage device. Looking at a hex dump of data is commonly done as a part of debugging, or of reverse engineering. In a hex dump, each byte (8-bits) is represented as […]

  • Basic tinkering with “set” command and “noclobber” related

    commandline session [bash light=”true”] $echo improve > clean.txt $cat clean.txt improve $set -o noclobber $echo new > clean.txt bash: clean.txt: cannot overwrite existing file $echo new >> clean.txt $cat clean.txt improve new $echo again >| clean.txt $cat clean.txt again $set +o noclobber $echo improve > clean.txt $cat clean.txt improve $ [/bash]

  • coproc is a shell keyword related to coprocesses in GNU Bash

    ABOUT coproc Bash 4.0 introduced coprocesses, a feature certainly familiar to ksh users. The coproc keyword starts a command as a background job, setting up pipes connected to both its stdin and stdout so that you can interact with it bidirectionally. Optionally, the co-process can have a name NAME. If NAME is given, the command […]

  • id – print real and effective user and group IDs

    A UNIX Command $id uid=1000(jeffrin) gid=1000(jeffrin) groups=1000(jeffrin),29(audio),1001(wireshark) $id -n id: cannot print only names or real IDs in default format $id -a uid=1000(jeffrin) gid=1000(jeffrin) groups=1000(jeffrin),29(audio),1001(wireshark) $id -g 1000 $id -G 1000 29 1001 $id -Gn jeffrin audio wireshark $id -r id: cannot print only names or real IDs in default format $id -rG 1000 29 […]

  • number of processing units.

    $nproc 1 $nproc –all 1 $ nproc Print the number of processing units available to the current process, which may be less than the number of online processors