Category shell
Generate Random ASCII Art in shell
How to generate random ascii art in shell: wget -qO – | sed -n ‘/<pre>/,/<\/pre>/p’ | sed -n ‘/<table*/,/<\/table>/p’ | sed ‘1d’ | sed ‘$d’ You may consider daily cron to put the output in the motd file: /etc/motd…
Convert Files from Linux/Unix Format to Windows and Vice Versa
With AWK: awk ‘{ sub(“\r$”, “”); print }’ windows.txt > unix.txt awk ‘sub(“$”, “\r”)’ unix.txt > windows.txt With TR tr -d ‘\15\32’ < winfile.txt > unixfile.txt :1,$s/^M//g
Bash: wget recursively download website
Recursively download website wget -r –no-parent –reject “index.html*”
Find all Hard links to file
find / -xdev -samefile file1 Second Method $ ls -li file1 2655341 -rw-r–r– 3 peter peter 0 2008-09-02 19:09 file1 find /home -xdev -inum 2655341
Shell Script: Solaris Script Tool wgrep
#!/usr/bin/perl # wgrep.pl – windowed grep utility
Script: Solaris Script Tool PCP
0: Which process has port 22 open? #!/usr/bin/ksh # # PCP (PID con Port) # v1.10 08/10/2010 Sam Nelson sam @ unix.ms # # If you have a Solaris 8, 9 or 10 box and you can’t # install lsof,…
Perl Script: Perl Print Yesterday Time
perl -e ‘use POSIX qw(strftime); print strftime “%a %b %e %H:%M:%S %Y”,localtime(time()- 3600*24*2);’
SHELL: MT Raw Magnetic Tape
$ for drive in 0 1 2 3 4 5 6 7 > do > mt -f /dev/rmt/$drive status > done
Shell: Command: fping group of ip addresses
fping -a -q -g 192.168.0.0/24