A UNIX Command $true $echo $? 0 $false $echo $? 1 $ $ ./true –version >&- ./true: write error: Bad file number $ ./true –version > /dev/full ./true: write error: No space left on device UNIX Explanation true – do nothing, successfully exit with a status code indicating success. false – do nothing, unsuccessfully exit …
Category Archives: Uncategorized
setterm
commandline session $setterm -underline $ls $ls -l total 0 $ls -a . .. $setterm -underline off $ls $ls -l total 0 $ls -a . .. $ http://pluto.infoclub.in/wp-content/uploads/2013/06/setterm.c
dig DNS lookup utility
commandline session $dig ; <> DiG 9.8.4-rpz2+rl005.12-P1 <> ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 44167 ;; flags: qr rd ra; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;. IN NS ;; ANSWER SECTION: . 17373 IN NS a.root-servers.net. . 17373 IN NS b.root-servers.net. …
true from coreutils
commandline session $true $echo $? 0 $true hello $echo $? 0 $ http://pluto.infoclub.in/wp-content/uploads/2013/06/true.c
mv command GNU bash
commandline session $> 1 $echo hello > 1 $cat 1 hello $ls 1 $mv 1 2 $ls 2 $cat 2 hello $ http://pluto.infoclub.in/wp-content/uploads/2013/06/mv.c code section while ((c = getopt_long (argc, argv, “bfint:uvS:T”, long_options, NULL)) != -1) { switch (c) { case ‘b’: make_backups = true; if (optarg) version_control_string = optarg; break; case ‘f’: x.interactive = …
cp command GNU bash
commandline session $> 1 $echo hello > 2 $cat 1 $ $cat 2 hello $cp -b 2 cp: missing destination file operand after ‘2’ Try ‘cp –help’ for more information. $cp -b 2 2b $ls 1 2 2b $cat 2b hello $cp -x 2b 2c $ls 1 2 2b 2c $cat 2c hello $cp -x …
objdump tinkering
commandline session root>objdump -f nouveau.ko nouveau.ko: file format elf64-x86-64 architecture: i386:x86-64, flags 0x00000011: HAS_RELOC, HAS_SYMS start address 0x0000000000000000 root>objdump -a nouveau.ko nouveau.ko: file format elf64-x86-64 nouveau.ko root>objdump -p nouveau.ko nouveau.ko: file format elf64-x86-64 root>objdump -g nouveau.ko nouveau.ko: file format elf64-x86-64 root> http://www.beautifulwork.org/wp-content/uploads/2013/05/objdump.c
Testing For File Charactereristics
commandline session $cat test.sh #!/usr/bin/env bash # cookbook filename: checkfile # DIRPLACE=/tmp INFILE=/home/jeffrin/amazing.data OUTFILE=/home/jeffrin/more.results if [ -d “$DIRPLACE” ] then cd $DIRPLACE if [ -e “$INFILE” ] then if [ -w “$OUTFILE” ] then doscience > “$OUTFILE” else echo “can not write to $OUTFILE” fi else echo “can not read from $INFILE” fi else echo …
here-document . Bash
commandline session $cat hdoc.sh #!/bin/bash cat $1 <<EOF EOF $sh hdoc.sh bash.txt hack hacker $ $cat bash.txt hack hacker $vim hdoc.sh $ $cat hdoc.sh #!/bin/bash grep $1 <<EOF name jeffrin age 36 sex male EOF $sh hdoc.sh 3 age 36 $
nohup . no hangup
commandline session $cat loop.c main() { for (;;); } $./a.out ^C $nohup ./a.out nohup: ignoring input and appending output to `nohup.out’ ^C $cat nohup.out $ls nohup.out nohup.out $