Category bash

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…

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

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,…

Remove all comments and empty lines

Grep will remove all comments and sed will remove all empty lines # grep -v “^#” | sed -e ‘/^$/d’ Same with sed # cat | sed ‘/ *#/d; /^ *$/d’