RSS feed [root] /script /unix /weblog




login:

password:

title search:




 


Sat Sep 28 10:13:26 GMT 2024

script



(google search) (amazon search)
second
download zip of files only

Sun Jul 30 14:04:42 GMT 2023 From /weblog/unix/script

find


An question about how to remove unused package from MacOSX turn out to be an example of "find" command:

http://forums.osxfaq.com/viewtopic.php?p=57887#57887
http://www.osxfaq.com/tips/unix-tricks/week98/tuesday.ws
http://javarevisited.blogspot.com[..]find-command-in-unix-examples-basic.html

File Search tips in Linux - http://discuss.joelonsoftware.com[..]iscussTopicParent=18272&ixDiscussGroup=3

Another search tip, example of find base on time and size, and how to compare with other files - http://viralpatel.net[..]e-useful-unix-file-finding-commands.html

Like search by name, depth, size - http://www.thegeekstuff.com[..]5-practical-linux-find-command-examples/

use 'find' to delete branch of file: http://keithdevens.com/weblog/archive/2005/Jul/05/find.rm

By time - http://www.thegeekstuff.com[..]unix-linux-find-command-examples-part-2/

Use of empty - http://www.thegeekstuff.com[..]010/03/find-empty-directories-and-files/

Find Anything You Need with fzf - https://medium.com[..]the-linux-fuzzy-finder-tool-f48dfd0092b4

(google search) (amazon search)


Thu Mar 03 23:10:30 GMT 2022 From /weblog/unix/script

display


Make your Bash scripts more interactive and futuristic with these tips. - https://levelup.gitconnected.com[..]only-a-few-programmers-know-4abb58ddadad

(google search) (amazon search)


Wed Nov 03 12:09:14 GMT 2021 From /weblog/unix/script

automation


What is Ansible? A Tool to Automate Parts of Your Job - https://www.freecodecamp.org/news/what-is-ansible

(google search) (amazon search)


Sun Aug 06 09:21:16 GMT 2017 From /weblog/unix/script

text


10 awk tips - http://www.catonmat.net/blog/ten-awk-tips-tricks-and-pitfalls/

8 Powerful Awk Built-in Variables – FS, OFS, RS, ORS, NR, NF, FILENAME, FNR - http://www.thegeekstuff.com[..]iables-fs-ofs-rs-ors-nr-nf-filename-fnr/

Tutorial of text editing commands - http://www.ibm.com[..]works/aix/library/au-unixtext/index.html

wc and nl tutorial - http://www.thegeekstuff.com/2013/02/wc-nl-examples/ https://enkipro.com/insight/558ac712249a234c00842b68

tips for uniq, like show only items have duplications - http://www.thegeekstuff.com/2013/05/uniq-command-examples/

Tips of "cat", include display by column and by delimiter - http://www.thegeekstuff.com/2013/06/cut-command-examples/

Using lynx to convert HTML to text - https://enkipro.com/insight/558aaea45800843200bca364

(google search) (amazon search)


Sun Aug 06 09:20:16 GMT 2017 From /weblog/unix/script

file


Various ways to working with file - http://www.catonmat.net/blog/bash-one-liners-explained-part-one/

Use truncate to pad the file size up - http://www.lainoox.com/truncate-shrink-extend-files/

Making a file unalterable with chattr - https://enkipro.com/insight/558ac712249a234c00842b68

(google search) (amazon search)


Wed Jun 14 10:34:19 GMT 2017 From /weblog/unix/script

development


A bash debugger - http://bashdb.sourceforge.net/

Really really good tips - http://fahdshariff.blogspot.com.au[..]3/10/shell-scripting-best-practices.html

Style guide - http://www.kfirlavi.com[..]og/2012/11/14/defensive-bash-programming

Script checker - https://www.shellcheck.net/

How to write a shell - https://indradhanush.github.io/blog/writing-a-unix-shell-part-1 https://indradhanush.github.io/blog/writing-a-unix-shell-part-2

(google search) (amazon search)


Fri Apr 01 03:29:26 GMT 2016 From /weblog/unix/script

bash


How to use eval, hash, readonly, shift, getopts, set, unset, let and shopt - http://www.thegeekstuff.com/2010/08/bash-shell-builtin-commands

Sample bash completion

SSH_COMPLETE=( $(cut -f1 -d' ' ~/.ssh/known_hosts |\
tr ',' '\n' |\
sort -u |\
grep -e '[:alpha:]') )
complete -o default -W "${SSH_COMPLETE[*]}" ssh

http://kasparov.skife.org/blog/stuff/starting-a-meme.html

Check history statistic - brianm@binky:~$ history | awk {'print $2'} | sort | uniq -c | sort -k1 -rn | head
164 svn
52 cd
42 ssh
32 sudo
22 git
16 ls
16 for
14 echo
13 man
10 curl
brianm@binky:~$

http://bluebones.net/2008/04/history-meme/

easy way to do "[-h|--help][-n|--name ]" - http://binkley.blogspot.com/2016/03/bash-long-options.html

(google search) (amazon search)



Wed Feb 03 13:55:53 GMT 2016 From /weblog/unix/script

locate


http://www.thegeekstuff.com/2012/03/locate-command-examples/

(google search) (amazon search)



Fri Mar 01 01:25:37 GMT 2013 From /weblog/unix/script

pdf


Convert PDF to set of image as slide show - http://ejohn.org/blog/easy-pdf-sharing/

pdftk, extra pages from one pdf to another pdf - http://linuxcommando.blogspot.com.au[..]2/splitting-up-is-easy-for-pdf-file.html

(google search) (amazon search)


Sat Dec 22 16:56:52 GMT 2012 From /weblog/unix/script

string


http://www.thegeekstuff.com/2010/07/bash-string-manipulation

http://www.thegeekstuff.com/2010/11/strings-command-examples/

http://www.thegeekstuff.com[..]/01/regular-expressions-in-grep-command/

tr, useful string tranformation tool - http://www.thegeekstuff.com/2012/12/linux-tr-command/

(google search) (amazon search)


Tue Jan 24 16:42:37 GMT 2012 From /weblog/unix/script

xdotool


Simulate user input - http://pratyeka.org/fake-x-input/

(google search) (amazon search)


Sat Sep 03 03:37:14 GMT 2011 From /weblog/unix/script

sort


Sort by column - http://javarevisited.blogspot.com[..]/unix-sort-command-example-tutorial.html

(google search) (amazon search)


Wed Aug 24 18:16:44 GMT 2011 From /weblog/unix/script

webserver


Create webserver with nc using bash

http://www.linuxscrew.com[..]07/09/06/web-server-on-bash-in-one-line/
http://paulbuchheit.blogspot.com/2007/04/webserver-in-bash.html

(google search) (amazon search)


Mon Jul 11 17:11:20 GMT 2011 From /weblog/unix/script

loop


http://www.thegeekstuff.com/2011/07/bash-for-loop-examples/

(google search) (amazon search)


Thu Jul 07 15:54:28 GMT 2011 From /weblog/unix/script

useful example of shell script


xmlwf, need to know if a XML document is well formed? (A configuration file maybe..)
mkfifo is the coolest one. Sure you know how to create a pipeline piping the output of grep to less or maybe even perl.
nl, add number for every line of a file

http://bashcurescancer.com[..]/10-linux-commands-youve-never-used.html

http://www.thegeekstuff.com/2010/11/50-linux-commands/

======================================create real player song list
#!/bin/sh
win_path=C:/tools
linux_path=/mnt/disk/winapp
for file in `find $1 -type f`;
do
if(`/bin/cat $file | grep $win_path`); then echo $file;fi;
done;
/usr/bin/find $MUSIC_SRC -type f -exec /bin/echo file://{} \; > $TMPDIR/tmp.rm
while read i ; do /bin/echo "$RANDOM $i" ; done < $TMPDIR/tmp.rm | /bin/sort -n | /bin/sed 's/^[0-9]* //' > $TMPDIR/tmp1.rm
/bin/cat $TMPDIR/tmp1.rm |/bin/sed -e 's/file:\/\///' >$HOME/mplayer.list
/bin/cat $TMPDIR/tmp1.rm |/bin/grep -vi wma >$HOME/real.rm
/bin/cat $TMPDIR/tmp1.rm |/bin/sed -e 's/file:\/\/\/var\/www\/html/http:\/\/www.carfield.com.hk/'>/var/www/html/.secure/media/music/live.rm

======================================remove log
for file in `find -type f|grep website.|grep -v lck`;do rm -f $file;done
======================================for loop
for((a = 1; a <10; a++)); do wget -b "http://www.thai.net/ferrari545/bbs_series/ku_bbs_000$a.jpg";done
======================================resize photo
for i in *.jpg; do convert -geometry 1024x768 $i newdir/$i ; done
======================================basic calculation
i=1;find|grep -v zng|grep -v avi|while read file;do mv "$file" $i.jpg;i=$((i+1));done
======================================# Make 3 a copy of 1 (stdout)
exec 3>&1
result="$(command to generate stream \
| tee /dev/fd/3 \
| command to process stream)"
# Now work with $result
# The original stream also went to the console

http://binkley.blogspot.com[..]5/getting-more-from-streams-in-bash.html


(google search) (amazon search)


Wed Feb 11 10:55:55 GMT 2009 From /weblog/unix/script

test


hint of using test - http://www.ibm.com/developerworks/linux/library/l-bash-test.html http://binkley.blogspot.com/2009/02/speeding-up-cygwin-login.html


(google search) (amazon search)


Thu May 08 06:00:20 GMT 2008 From /weblog/unix/script

date


A working date calculation script

http://www.unix.com[..]s/4870-days-elapsed-between-2-dates.html

(google search) (amazon search)


Fri Jun 16 13:37:41 GMT 2006 From /weblog/unix/script

check exit status



Need to check #? and PIPESTATUS

http://www.mattryall.net/article.cgi?id=247

(google search) (amazon search)


Sun May 28 10:31:46 GMT 2006 From /weblog/unix/script

Batch rename


Script of batch rename at unix system

http://mattfleming.com/node/110
http://stuart.woodward.jp/?p=279

(google search) (amazon search)


Tue Nov 08 06:33:09 GMT 2005 From /weblog/unix/script

Unix KornShell Quick Reference


http://www.maththinking.com/boat/kornShell.html

(google search) (amazon search)


Tue Oct 04 03:58:05 GMT 2005 From /weblog/unix/script

safer rm


A number of tips to make rm command safer

http://www.macosxhints.com[..]le.php?story=20050928082624470&lsrc=osxh

(google search) (amazon search)