compressing and uncompressing a file with the help of xargs

$ls stderr.txt stderr.txt $ls stderr.txt | xargs ls stderr.txt $ls stderr.txt | xargs cat /home/jeffrin/quark/kernel/run_kernel.sh: line 10: ./main.native: No such file or directory $ls stderr.txt | xargs gzip $ls stderr.txt ls: cannot access ‘stderr.txt’: No such file or directory $ls stderr.txt.gz | xargs gunzip $ls stderr.txt stderr.txt $

Finding the number of processor units

ABOUT nproc print the number of processing units available TYPICAL COMMANDLINE SESSION [bash] $nproc 2 $nproc –ignore=1 1 $grep -c ^processor /proc/cpuinfo 2 $cat /proc/cpuinfo | awk ‘/^processor/{print $3=$3+1}’ | tail -1 2 $cat /proc/cpuinfo | awk ‘/^processor/{print $3}’ 0 1 $lscpu | grep CPU CPU op-mode(s): 32-bit, 64-bit CPU(s): 2 On-line CPU(s) list: 0,1 …

anonymous pages and memory from /proc/meminfo

$cat /proc/meminfo MemTotal: 3495924 kB MemFree: 1465276 kB MemAvailable: 2353604 kB Buffers: 126008 kB Cached: 962924 kB SwapCached: 0 kB Active: 1330576 kB Inactive: 452848 kB Active(anon): 695532 kB Inactive(anon): 29420 kB Active(file): 635044 kB Inactive(file): 423428 kB Unevictable: 0 kB Mlocked: 0 kB SwapTotal: 7259132 kB SwapFree: 7259132 kB Dirty: 232 kB Writeback: 0 …

sample session with “shopt -s cdspell” with Bash

$shopt -s checkwinsize on cmdhist on complete_fullquote on expand_aliases on extglob on extquote on force_fignore on histappend on interactive_comments on progcomp on promptvars on sourcepath on $shopt -s cdspell $shopt -s cdspell on checkwinsize on cmdhist on complete_fullquote on expand_aliases on extglob on extquote on force_fignore on histappend on interactive_comments on progcomp on promptvars on …

appending file using “paste” command hack

$cat a.txt hello $cat b.txt killo $ls 1 a.txt b.txt l.txt trueangle u.txt $cat u.txt UPPERCASE $cat l.txt uppercase $cat a.txt >> b.txt >> l.txt >> u.txt $cat u.txt UPPERCASE hello $cat a.txt hello $cat 1 a.txt b.txt l.txt trueangle/ u.txt $cat l.txt uppercase $cat a.txt hello $cat a.txt >> b.txt $cat b.txt killo hello …

sample hack session with sort command

$sort -t: -k3 –debug /etc/passwd sort: using ‘en_US.UTF-8’ sorting rules root:x:0:0:root:/root:/bin/bash ________________________ _______________________________ jeffrin:x:1000:1000:Jeffrin Jose T,,,:/home/jeffrin:/bin/bash ___________________________________________________ _____________________________________________________________ uuidd:x:100:101::/run/uuidd:/bin/false ______________________________ ______________________________________ uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin ____________________________________________ ___________________________________________________ Debian-exim:x:101:103::/var/spool/exim4:/bin/false ____________________________________ __________________________________________________ statd:x:102:65534::/var/lib/nfs:/bin/false __________________________________ __________________________________________ sshd:x:103:65534::/var/run/sshd:/usr/sbin/nologin __________________________________________ _________________________________________________ messagebus:x:104:106::/var/run/dbus:/bin/false _________________________________ ______________________________________________ colord:x:105:109:colord colour management daemon,,,:/var/lib/colord:/bin/false _____________________________________________________________________ ______________________________________________________________________________ usbmux:x:106:46:usbmux daemon,,,:/home/usbmux:/bin/false _______________________________________________ ________________________________________________________ avahi:x:107:113:Avahi mDNS daemon,,,:/var/run/avahi-daemon:/bin/false _____________________________________________________________ _____________________________________________________________________ pulse:x:108:114:PulseAudio daemon,,,:/var/run/pulse:/bin/false ______________________________________________________ ______________________________________________________________ …

encryption related algorithms that are built into a typical Linux Kernel

ABOUT Cryptography Cryptography or cryptology (from Ancient Greek: κρυπτός, translit. kryptós “hidden, secret”; and γράφειν graphein, “to write”, or -λογία -logia, “study”, respectively[1]) is the practice and study of techniques for secure communication in the presence of third parties called adversaries.[2] More generally, cryptography is about constructing and analyzing protocols that prevent third parties or …

sample session related to “command expansion” in Bash shell

$a=`time` real 0m0.000s user 0m0.000s sys 0m0.000s $a bash: a: command not found $a=`ls` $a bash: a: command not found $echo a a $echo $a a.txt b.txt trueangle $echo `a` bash: a: command not found $a=`ls` $b=time $echo $b time $b=`time` real 0m0.000s user 0m0.000s sys 0m0.000s $echo $b $b=`time` real 0m0.000s user 0m0.000s sys …