Linuxjedi

From CleanPosts

(Difference between revisions)
Jump to: navigation, search
 
(24 intermediate revisions not shown)
Line 1: Line 1:
-
==Linux Jedi Mind Tricks==
+
== Linux Jedi Mind Tricks ==
[[Image:Jedi_linux.jpg|thumb|512px]]
[[Image:Jedi_linux.jpg|thumb|512px]]
-
* '''Make an image of a CD on your hard drive:'''
+
=== Tally up a column of figures ===
 +
 
 +
#! /bin/sh
 +
case "$1" in
 +
[1-9]*) colnum="$1"; shift;;
 +
*) echo "Usage: `basename $0` colnum [files]" 1>&2; exit 1;;
 +
esac
 +
awk '{sum += $col}
 +
END {print sum}' col=$colnum OFMT='%.2f' ${1+"$@"}
 +
 
 +
=== Convert a photo into an ASCII art representation directly into the terminal and save it to photo.ascii at the same time ===
 +
 
 +
jp2a Photo.jpg | tee photo.ascii
 +
 
 +
=== Change double-spaces in a text file to single spaces ===
 +
 
 +
cat redpine.txt | sed 's/ \+/ /g' > redpine2.txt
 +
 
 +
=== Delete empty files in and under the current directory ===
 +
 
 +
find . -empty -exec rm -f {} \;
 +
 
 +
=== Run the last command again as root ===
 +
 
 +
sudo !!
 +
 
 +
=== Make the text in a file all uppercase ===
 +
 
 +
cat testa.txt | tr '[a-z]' '[A-Z]' > testb.txt
 +
 
 +
=== Replace spaces in the filename of all the files in a directory with hyphens ===
 +
 
 +
find . -name "* *mp3" -exec rename 's/\ /-/g' {} \;
 +
 
 +
Michael-Neil-&-Graham-Getty---Retrochet-II---01---Cascade-Effect-Part-1.mp3
 +
 
 +
=== Convert all your files saved as "*.jpg-large" back to "*.jpg" ===
 +
 
 +
(so Twitter thinks they are images again)
 +
 
 +
find . -depth -name "*.jpg-large" -exec sh -c 'f="{}"; mv -- "$f" "${f%.jpg-large}.jpg"' \;
 +
 
 +
=== Find ten biggest hogs of disk space under a directory ===
 +
 
 +
du -s /usr/share/* | sort -nr | head
 +
 
 +
=== Prime factors of first 100 integers ===
 +
 
 +
echo {1..100} | factor
 +
 
 +
=== Make an image of a CD on your hard drive ===
 +
 
'''''dd''' if=/dev/sr0 of=image.iso''
'''''dd''' if=/dev/sr0 of=image.iso''
-
----
+
=== '''Mount that image on your system to use it''' ===
-
* '''Mount that image on your system to use it:'''
+
 
 +
(The mount point must already exist)
 +
 
'''''mount''' -o loop image.iso /mnt/temp''
'''''mount''' -o loop image.iso /mnt/temp''
-
----
+
=== '''
-
* '''Make a new .iso image in /mnt/burn from the contents in /mnt/hold:'''
+
=== '''Get a weather forecast for your city''' ===
-
'''''mkisofs''' -o /mnt/burn/image.iso /mnt/hold''
+
 
-
----
+
'''''curl''' wttr.in/seattle''
-
*'''Burn that image to another CD:'''
+
 
 +
=== '''Find files by name''' ===
 +
 
 +
find . -name *wav -print
 +
 
 +
=== '''Get information about all files of a certain type''' ===
 +
 
 +
find . -name *com -exec file {} \;
 +
 
 +
=== '''Print number of processes running as each user''' ===
 +
 
 +
$ ps -ef | awk '{print $1}' | sort | uniq -c
 +
 
 +
=== '''List the misspelled words in a file''' ===
 +
 
 +
enchant -l matthew
 +
 
 +
=== '''Return the name of the most-recently modified file in a directory''' ===
 +
 
 +
$ ls -t | head -1
 +
 
 +
20190506_061751k2.jpg
 +
 
 +
=== '''Strip blank lines from a text file''' ===
 +
 
 +
awk 'NF > 0' yeshua > yeshua2
 +
 
 +
=== '''Make all filenames in a directory lowercase''' ===
 +
 
 +
#!/bin/bash
 +
for x in `ls`
 +
do
 +
if [ ! -f $x ]; then
 +
continue
 +
fi
 +
lc=`echo $x | tr '[A-Z]' '[a-z]'`
 +
if [ $lc != $x ]; then
 +
mv -i $x $lc
 +
fi
 +
done
 +
 
 +
paste into file called lowerit chmod u+x lowerit ./lowerit
 +
 
 +
=== '''Combine two files, line by line, comma delimited''' ===
 +
 
 +
$ paste -d, names.txt distances.txt
 +
 
 +
=== '''Concatenate a group of files into a single new file''' ===
 +
 
 +
for file in *; do cat $file >> linuxgal.txt; done
 +
 
 +
=== '''Find man page for a command''' ===
 +
 
 +
whereis -m genisoimage
 +
 
 +
genisoimage: /usr/share/man/man1/genisoimage.1.gz
 +
 
 +
 
 +
=== '''Build a list of unique words in a file''' ===
 +
 
 +
tr ' ' \\n  < notes20191108.txt | sort | uniq
 +
 
 +
=== '''Build an iso from a file ===
 +
 
 +
genisoimage -r -joliet-long -o -win98tib.iso /home/teresita/Desktop/iso/win98[7]20150529.tib
 +
 
 +
 
 +
=== '''Burn an iso to a CD-ROM''' ===
 +
 
 +
 
 +
=== '''Make a new .iso image in /mnt/burn from the contents in /mnt/hold''' ===
 +
 
 +
mkisofs''' -o /mnt/burn/image.iso /mnt/hold
 +
 
 +
=== '''Burn that image to another CD''' ===
 +
 
'''''cdrecord''' dev=/dev/sr0 /mnt/burn/image.iso''
'''''cdrecord''' dev=/dev/sr0 /mnt/burn/image.iso''
-
----
+
 
-
*'''Convert RPM package to DEB package:'''
+
=== '''Convert RPM package to DEB package''' ===
 +
 
'''''alien''' file.rpm''
'''''alien''' file.rpm''
-
----
+
 
-
*'''Copy a file'''
+
=== '''Copy a file''' ===
'''cp''' INFILE OUTFILE''
'''cp''' INFILE OUTFILE''
-
----
+
 
-
*'''Add a CD-ROM to your list of repositories.'''
+
=== '''Add a CD-ROM to your list of repositories.''' ===
'''''apt-cdrom''' -m add''
'''''apt-cdrom''' -m add''
-
----
+
 
-
*'''List only non-blank lines in a file:'''
+
=== '''List only non-blank lines in a file''' ===
'''''awk''' 'NF >0' file.txt''
'''''awk''' 'NF >0' file.txt''
-
----
+
 
-
*'''Create a custom command to list files:'''
+
=== '''Create a custom command to list files''' ===
'''''alias''' l = 'ls -l --color=auto' ''
'''''alias''' l = 'ls -l --color=auto' ''
-
----
+
 
-
*'''Add line numbers to a file:'''
+
=== '''Add line numbers to a file''' ===
'''''cat''' -n file.txt''
'''''cat''' -n file.txt''
-
----
+
 
-
*'''Find text in a file:'''
+
=== '''Find text in a file''' ===
'''''awk''' 'chevy' cars.txt''
'''''awk''' 'chevy' cars.txt''
-
----
+
 
-
*'''Backup Master Boot Record:'''
+
=== '''Backup Master Boot Record''' ===
'''''dd''' if=/dev/sda of=MBR.img bs=446 count=1''
'''''dd''' if=/dev/sda of=MBR.img bs=446 count=1''
-
----
+
 
-
*'''Make a file lowercase:'''
+
=== '''Make a file lowercase''' ===
'''''cat''' FILE1.TXT | tr '[A-Z]' '[a-z]' > FILE2.TXT''
'''''cat''' FILE1.TXT | tr '[A-Z]' '[a-z]' > FILE2.TXT''
-
----
+
 
-
*'''Change the owner of a directory and all its contents:'''
+
=== '''Change the owner of a directory and all its contents''' ===
'''''chown''' -R teresita DIRECTORY''
'''''chown''' -R teresita DIRECTORY''
-
----
+
 
-
*'''Grab a copy of a website:'''
+
=== '''Grab a copy of a website''' ===
'''wget''' ''-w9 -r --random-wait -l3 -np -E URL''
'''wget''' ''-w9 -r --random-wait -l3 -np -E URL''
-
----
+
 
-
*'''Display time since boot:'''
+
=== '''Display time since boot''' ===
'''uptime'''
'''uptime'''
-
----
+
 
-
*'''Get the sizes of all subdirectories under a directory'''
+
=== '''Get the sizes of all subdirectories under a directory''' ===
'''''du''' -sh MYDIR''
'''''du''' -sh MYDIR''
-
----
+
 
-
*'''Display unique lines in a sorted file:'''
+
=== '''Display unique lines in a sorted file''' ===
'''uniq''' ''<FILE1 >FILE2
'''uniq''' ''<FILE1 >FILE2
-
----
+
 
-
*'''Use CUPS printer management system:'''
+
=== '''Use CUPS printer management system''' ===
localhost:631 (in a browser address bar)
localhost:631 (in a browser address bar)
-
----
+
 
-
*'''MP3 to WAV conversion:'''
+
=== '''MP3 to WAV conversion''' ===
'''madplay''' ''--output=wave:OCEANLAB.WAV OCEANLAB.MP3''
'''madplay''' ''--output=wave:OCEANLAB.WAV OCEANLAB.MP3''
-
----
+
 
-
*'''Convert to OGG:'''
+
=== '''Convert to OGG''' ===
'''oggenc *'''
'''oggenc *'''
-
----
+
 
-
*'''Create a link:'''
+
=== '''Create a link''' ===
'''ln''' ''-s /initrd/mnt/dev_ro2 HOME''
'''ln''' ''-s /initrd/mnt/dev_ro2 HOME''
-
----
+
 
-
*'''Extract tarball:'''
+
=== '''Extract tarball''' ===
'''''tar''' -xvf /dev/hda/FILE''
'''''tar''' -xvf /dev/hda/FILE''
-
----
+
 
-
*'''Make archive:'''
+
=== '''Make archive''' ===
'''''tar''' -c DIRECTORY | bzip2 > DIR.TAR.BZ2''
'''''tar''' -c DIRECTORY | bzip2 > DIR.TAR.BZ2''
-
----
+
 
-
*'''Make a file executable for all users:'''
+
=== '''Make a file executable for all users''' ===
'''''chmod''' u+x FILE''
'''''chmod''' u+x FILE''
-
----
+
 
-
*'''Turn a directory into a SquashFS file:'''
+
=== '''Turn a directory into a SquashFS file''' ===
'''''mksquashfs''' /tmp/merge PUP_412.SFS''
'''''mksquashfs''' /tmp/merge PUP_412.SFS''
-
----
+
 
-
*'''Mount your SquashFS file:'''
+
=== '''Mount your SquashFS file''' ===
'''''mount''' -o loop -t squashfs PUP_412.SFS /mnt/pup''
'''''mount''' -o loop -t squashfs PUP_412.SFS /mnt/pup''
-
----
+
 
-
*'''Upload a file to your webspace:'''
+
=== '''Upload a file to your webspace''' ===
'''''wput''' MYFILE ftp://username:password@web.host.com''
'''''wput''' MYFILE ftp://username:password@web.host.com''
-
----
+
 
-
*'''Convert a MIDI file to a .WAV file:'''
+
=== '''Convert a MIDI file to a .WAV file''' ===
'''''timidity''' -Ow -oRUBY.WAV RUBY.MID''  
'''''timidity''' -Ow -oRUBY.WAV RUBY.MID''  
-
----
+
 
-
*'''Replace spaces in a filename with hyphens:'''  
+
=== '''Replace spaces in a filename with hyphens''' ===
'''''find''' . -name "* *mp3" -exec rename 's/\ /-/g' {} \;''
'''''find''' . -name "* *mp3" -exec rename 's/\ /-/g' {} \;''
-
----
+
 
-
*'''Print the current month in Julian dates:'''  
+
=== '''Print the current month in Julian dates''' ===
-
'''''cal''' -j''
+
 
-
----
+
cal -j
-
*'''Make a new file of the individual words in another file:'''
+
 
-
'''''tr'' ' ' '\012' <INFILE >OUTFILE''
+
=== '''Make a new file of the individual words in another file''' ===
 +
 
 +
tr ' ' '\012' <INFILE >OUTFILE''
or
or
-
for WORD in `cat FILE`
+
for WORD in `cat FILE`
 +
do
 +
echo $WORD
 +
done
 +
=== '''Strip carriage returns from a DOS file''' ===
-
do
+
tr -d '\015' <INFILE >OUTFILE''
-
echo $WORD
+
=== '''Downshift all file names''' ===
-
done
+
#!/bin/bash
-
----
+
for x in `ls`
-
*'''Strip carriage returns from a DOS file:'''
+
do
-
''''tr''' -d '\015' <INFILE >OUTFILE''
+
if [ ! -f $x ]; then
-
----
+
continue
-
*'''Downshift all file names:'''
+
fi
 +
lc=`echo $x  | tr '[A-Z]' '[a-z]'`
 +
if [ $lc != $x ]; then
 +
mv -i $x $lc
 +
fi
 +
done
 +
=== '''Rename in bulk''' ===
-
#!/bin/bash
 
-
for x in `ls`
 
-
do
 
-
if [ ! -f $x ]; then
 
-
continue
 
-
fi
 
-
lc=`echo $x  | tr '[A-Z]' '[a-z]'`
 
-
if [ $lc != $x ]; then
 
-
mv -i $x $lc
 
-
fi
 
-
done
 
-
----
 
-
*'''Rename in bulk:'''
 
OLD=xxx
OLD=xxx
Line 141: Line 269:
done
done
-
----
+
 
-
*'''Install from tarball'''
+
=== '''Install from tarball''' ===
-
'''''tar''' -zxvf ARCHIVE.TAR.GZ''
+
 
 +
tar -zxvf ARCHIVE.TAR.GZ''
./configure
./configure
-
----
+
 
-
*'''Format floppy disk:'''
+
=== '''Format floppy disk''' ===
-
'''''fdformat''' /dev/sde'''
+
 
-
----
+
fdformat''' /dev/sde
-
*'''List directories:'''
+
 
-
'''''find''' . -type d -print''
+
=== '''List directories''' ===
-
----
+
 
-
* '''Convert avi to mpeg:'''
+
find''' . -type d -print
-
'''''mencoder''' MOVIE.AVI -of mpeg -mpegopts format=mpeg1:tsaf:muxrate=2000 -o MOVIE.MPG -oac lavc -lavcopts acodec=mp2:abitrate=224 -ovc lavc -lavcopts vcodec=mpeg1video:vbitrate=1152:keyint=15:mbd=2:aspect=4/3''
+
 
-
----
+
=== '''
-
* '''Factorial function implemented by recursion.'''
+
'''Convert avi to mpeg''' ===
 +
 
 +
mencoder''' MOVIE.AVI -of mpeg -mpegopts format=mpeg1:tsaf:muxrate=2000 -o MOVIE.MPG -oac lavc -lavcopts acodec=mp2:abitrate=224 -ovc lavc -lavcopts vcodec=mpeg1video:vbitrate=1152:keyint=15:mbd=2:aspect=4/3
 +
 
 +
=== '''Factorial function implemented by recursion.''' ===
define fact(n)  
define fact(n)  
Line 167: Line 300:
}
}
-
----
+
=== '''Perform a ROT 13 conversion''' ===
-
* '''Perform a ROT 13 conversion:'''
+
  #!/bin/sh
  #!/bin/sh
  echo "$1" | tr '[A-Za-z]' '[N-ZA-Mn-za-m]'
  echo "$1" | tr '[A-Za-z]' '[N-ZA-Mn-za-m]'
-
----
 
-
* '''Download streaming videos and convert them to MP3s'''
 
-
sudo curl https://yt-dl.org/downloads/2014.05.05/youtube-dl -o /usr/local/bin/youtube-dl
+
=== '''Download streaming videos and convert them to MP3s''' ===
 +
 
 +
sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl
sudo chmod a+x /usr/local/bin/youtube-dl
sudo chmod a+x /usr/local/bin/youtube-dl
-
youtube-dl --title --extract-audio --audio-format mp3 [LINK]
+
youtube-dl --title --extract-audio --audio-format mp3 https://www.youtube.com/watch?v=L3FmBjX-p0I
 +
 
 +
=== Convert decimal to 16 bit binary and trim leading zeros ===
 +
 
 +
#! /bin/bash
 +
D2B=({0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1})
 +
echo $((10#${D2B[$1]}))
 +
 
 +
=== Send a man page to the terminal minus the embedded backspace characters ===
 +
 
 +
man genisoimage | col -b | less
 +
 
 +
=== Print the first sixteen binary numbers using awk to align the data ===
-
ffmpeg -i yourvideo.mp4 -f mp3 -ab 192000 -vn yourvideo.mp3
+
echo "obase=2;i=0;while(i<=15) {i;i+=1}" | bc | awk '{printf "%4s\n", $0}'

Latest revision as of 18:51, 7 February 2020

Contents

Linux Jedi Mind Tricks

Tally up a column of figures

#! /bin/sh
case "$1" in 
[1-9]*) colnum="$1"; shift;; 
*) echo "Usage: `basename $0` colnum [files]" 1>&2; exit 1;; 
esac 
awk '{sum += $col} 
END {print sum}' col=$colnum OFMT='%.2f' ${1+"$@"}

Convert a photo into an ASCII art representation directly into the terminal and save it to photo.ascii at the same time

jp2a Photo.jpg | tee photo.ascii

Change double-spaces in a text file to single spaces

cat redpine.txt | sed 's/ \+/ /g' > redpine2.txt

Delete empty files in and under the current directory

find . -empty -exec rm -f {} \;

Run the last command again as root

sudo !!

Make the text in a file all uppercase

cat testa.txt | tr '[a-z]' '[A-Z]' > testb.txt

Replace spaces in the filename of all the files in a directory with hyphens

find . -name "* *mp3" -exec rename 's/\ /-/g' {} \;

Michael-Neil-&-Graham-Getty---Retrochet-II---01---Cascade-Effect-Part-1.mp3

Convert all your files saved as "*.jpg-large" back to "*.jpg"

(so Twitter thinks they are images again)

find . -depth -name "*.jpg-large" -exec sh -c 'f="{}"; mv -- "$f" "${f%.jpg-large}.jpg"' \;

Find ten biggest hogs of disk space under a directory

du -s /usr/share/* | sort -nr | head

Prime factors of first 100 integers

echo {1..100} | factor

Make an image of a CD on your hard drive

dd if=/dev/sr0 of=image.iso

Mount that image on your system to use it

(The mount point must already exist)

mount -o loop image.iso /mnt/temp ===

Get a weather forecast for your city

curl wttr.in/seattle

Find files by name

find . -name *wav -print

Get information about all files of a certain type

find . -name *com -exec file {} \;

Print number of processes running as each user

$ ps -ef | awk '{print $1}' | sort | uniq -c

List the misspelled words in a file

enchant -l matthew

Return the name of the most-recently modified file in a directory

$ ls -t | head -1

20190506_061751k2.jpg

Strip blank lines from a text file

awk 'NF > 0' yeshua > yeshua2

Make all filenames in a directory lowercase

#!/bin/bash 
for x in `ls` 
do 
if [ ! -f $x ]; then 
continue 
fi 
lc=`echo $x | tr '[A-Z]' '[a-z]'` 
if [ $lc != $x ]; then 
mv -i $x $lc 
fi 
done 

paste into file called lowerit chmod u+x lowerit ./lowerit

Combine two files, line by line, comma delimited

$ paste -d, names.txt distances.txt

Concatenate a group of files into a single new file

for file in *; do cat $file >> linuxgal.txt; done

Find man page for a command

whereis -m genisoimage

genisoimage: /usr/share/man/man1/genisoimage.1.gz


Build a list of unique words in a file

tr ' ' \\n < notes20191108.txt | sort | uniq

Build an iso from a file

genisoimage -r -joliet-long -o -win98tib.iso /home/teresita/Desktop/iso/win98[7]20150529.tib


Burn an iso to a CD-ROM

Make a new .iso image in /mnt/burn from the contents in /mnt/hold

mkisofs -o /mnt/burn/image.iso /mnt/hold

Burn that image to another CD

cdrecord dev=/dev/sr0 /mnt/burn/image.iso

Convert RPM package to DEB package

alien file.rpm

Copy a file

cp INFILE OUTFILE

Add a CD-ROM to your list of repositories.

apt-cdrom -m add

List only non-blank lines in a file

awk 'NF >0' file.txt

Create a custom command to list files

alias l = 'ls -l --color=auto'

Add line numbers to a file

cat -n file.txt

Find text in a file

awk 'chevy' cars.txt

Backup Master Boot Record

dd if=/dev/sda of=MBR.img bs=446 count=1

Make a file lowercase

cat FILE1.TXT | tr '[A-Z]' '[a-z]' > FILE2.TXT

Change the owner of a directory and all its contents

chown -R teresita DIRECTORY

Grab a copy of a website

wget -w9 -r --random-wait -l3 -np -E URL

Display time since boot

uptime

Get the sizes of all subdirectories under a directory

du -sh MYDIR

Display unique lines in a sorted file

uniq <FILE1 >FILE2

Use CUPS printer management system

localhost:631 (in a browser address bar)

MP3 to WAV conversion

madplay --output=wave:OCEANLAB.WAV OCEANLAB.MP3

Convert to OGG

oggenc *

Create a link

ln -s /initrd/mnt/dev_ro2 HOME

Extract tarball

tar -xvf /dev/hda/FILE

Make archive

tar -c DIRECTORY | bzip2 > DIR.TAR.BZ2

Make a file executable for all users

chmod u+x FILE

Turn a directory into a SquashFS file

mksquashfs /tmp/merge PUP_412.SFS

Mount your SquashFS file

mount -o loop -t squashfs PUP_412.SFS /mnt/pup

Upload a file to your webspace

wput MYFILE ftp://username:password@web.host.com

Convert a MIDI file to a .WAV file

timidity -Ow -oRUBY.WAV RUBY.MID

Replace spaces in a filename with hyphens

find . -name "* *mp3" -exec rename 's/\ /-/g' {} \;

Print the current month in Julian dates

cal -j

Make a new file of the individual words in another file

tr ' ' '\012' <INFILE >OUTFILE

or

for WORD in `cat FILE`
do
echo $WORD
done

Strip carriage returns from a DOS file

tr -d '\015' <INFILE >OUTFILE

Downshift all file names

#!/bin/bash
for x in `ls`
do
if [ ! -f $x ]; then
continue
fi
lc=`echo $x  | tr '[A-Z]' '[a-z]'`
if [ $lc != $x ]; then
mv -i $x $lc
fi
done

Rename in bulk

OLD=xxx

NEW=yyy

for F in $OLD*

do

SUFFIX=`expr $F : '$OLD\(.*\)'`

mv $OLD$SUFFIX $NEW$SUFFIX

done

Install from tarball

tar -zxvf ARCHIVE.TAR.GZ

./configure

Format floppy disk

fdformat /dev/sde

List directories

find . -type d -print

=== Convert avi to mpeg ===

mencoder MOVIE.AVI -of mpeg -mpegopts format=mpeg1:tsaf:muxrate=2000 -o MOVIE.MPG -oac lavc -lavcopts acodec=mp2:abitrate=224 -ovc lavc -lavcopts vcodec=mpeg1video:vbitrate=1152:keyint=15:mbd=2:aspect=4/3

Factorial function implemented by recursion.

define fact(n)

{

if (n <= 1) return (n);

return (n * fact(n-1));

}

Perform a ROT 13 conversion

#!/bin/sh
echo "$1" | tr '[A-Za-z]' '[N-ZA-Mn-za-m]'

Download streaming videos and convert them to MP3s

sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl

sudo chmod a+x /usr/local/bin/youtube-dl

youtube-dl --title --extract-audio --audio-format mp3 https://www.youtube.com/watch?v=L3FmBjX-p0I

Convert decimal to 16 bit binary and trim leading zeros

#! /bin/bash
D2B=({0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1})
echo $((10#${D2B[$1]}))

Send a man page to the terminal minus the embedded backspace characters

man genisoimage | col -b | less

Print the first sixteen binary numbers using awk to align the data

echo "obase=2;i=0;while(i<=15) {i;i+=1}" | bc | awk '{printf "%4s\n", $0}'

Personal tools
Strangers In Paradise