find docs/run/network/run-a-node -type f -name "*.md" -exec echo "==== {} ====" \; -exec cat {} \;
find docs/use/ecosystems -type f -name "*.md" | sort | while read -r f; do
echo "==== $f ===="
cat "$f"
done | pbcopy
export PS1='\[\e[36m\]\u\[\e[m\]@\[\e[1;32m\]\H:\[\e[1;33m\]\w\[\e[m\]\n\[\e[1;31m\]\t \[\e[m\]\[\e[35m\][\!:0!]&[\j]\[\e[1;36m\]$\[\e[m\]'
Using pipe within find command
find ~/Downloads/*.* -type f -exec sh -c 'file "$1" |grep ": data"' pipo {} \;
Using a pipe within a find command
find *.JPG -type f -exec sh -c 'file "$1" | grep -v JPEG' pipo {} \;
find *.jpg -type f -exec sh -c 'file "$1" | grep -v JPEG' pipo {} \;
find . \( -name \*foo\* -o -name \*bar\* \)
How to count the number of non-empty (lines not containing spaces only) non-commented lines (starting with hash sign #) on scripts and ruby
grep -v '^[[:space:]]*#' fileName.rb | grep -v '^[[:space:]]*$' | wc -l
How to repeat a command & how to display process tree in real time for a given user on Linux a la 'ProcessExplorer'
while x=0; do clear; ps faux [pid] | grep svcjvmrx; sleep 2; done
cat /proc/[pid]/environ | tr '\0' '\n'
How to display a break down of meaningfull (greater than 100M) disk space utilisation for a directory
du -h ./ | grep -E "(([[:digit:]]{3}M{1})|(G{1}))[[:space:]]"
grep -rni --color=always error /tmp/data/logs/*
history -d [line_number]
echo $PATH |tr ':' '\n' |xargs ls -ld
sed 's/\r$//' dos.txt > unix.txt
sed 's/$/\r/' unix.txt > dos.txt
#!/bin/sh
while x=0; do
clear; find . -name "*.log" | xargs ls -al;
md5sum ~/work/target/grid-webapp.war
md5sum ~/deploy/webapps/data-grid-webapp.war
echo grid log
tail --bytes=5120 ~/logs/grid.log
sleep 2
done
ssh -L 0.0.0.0:1234:192.168.192.136:1234 192.168.192.136
cat afile.txt | grep -v "^$"
for i in {20..39}; do host=machine$i; echo $host; ssh $host ruby -v ; done
ps faux | grep -E '(user1|user2)' | grep -v grep | grep 'tangosol' | sed 's#[^ ]*[ ]*\([^ ]*\).*member=\([^ ]*\).*#\1 \2#'
file name: test.awk
{
printf($2 " ");
for(i=1; i<NF; ++i) {
if($i ~ /.*member=.*/) {
split($i, tab, "=");
print tab[2];
}
}
}
call:
while x=0; do clear; ps faux | grep -E '(user1|user2)' | grep -v grep | grep 'tangosol' | awk -f test.awk; sleep 2; done
or simplified
ps faux | grep -E '(user1|user2)' | grep -v grep | grep 'tangosol' | awk -f test.awk
while x=0; do clear; ps faux | grep -E '(user1|user2)'; sleep 2; done
find . -name "*.jar" | xargs grep -n "engine.properties"
grep --include=\README.{md,txt} -rnw ./ -e 'pattern'
du -h | sort -n
ls -lSh
Example: To find all files modified on the 7th of June, 2006:
find . -type f -newermt 2007-06-07 ! -newermt 2007-06-08
To find all files accessed on the 29th of september, 2008:
find . -type f -newerat 2008-09-29 ! -newerat 2008-09-30
Or, files which had their permission changed on the same day:
find . -type f -newerct 2008-09-29 ! -newerct 2008-09-30
If you don't change permissions on the file, 'c' would normally correspond to the creation date, thoug
od -tx1 -tc name-of-the-file.txt
!/bin/sh
ssh -o PreferredAuthentications=publickey brjones@server.com << EOT
cd ~/folder
echo "hello" > hello.txt
...
EOT#!/bin/bash
LIB_DIR=./lib
LOCAL_PREFIX=""
PATTERN=$LIB_DIR/*.jar
for i in $PATTERN; do
if [ "$i" != "$PATTERN" ]; then
JAR=$LOCAL_PREFIX$i
WIN_JAR=$(echo $LOCAL_PREFIX$i | sed 's#./lib/#.\\lib\\#')
UNIX_CLASSPATH=$UNIX_CLASSPATH,$JAR
WIN_CLASSPATH=$WIN_CLASSPATH,$WIN_JAR
fi
done
UNIX_CLASSPATH=`echo $UNIX_CLASSPATH | cut -c2-`
##echo "UNIX_CLASSPATH: " $UNIX_CLASSPATH
WIN_CLASSPATH=`echo $WIN_CLASSPATH | cut -c2-`
##echo "WIN_CLASSPATH: " $WIN_CLASSPATH
## How to download a redirected file and turn off sslVerify
curl -L -O <URL> -k
alias x='cd ~/datashare/dev/resourceguru; tmux -u -2 a -d -t x || tmux -u -2 new -s x'
alias y='cd ~/datashare/dev; tmux -u -2 a -d -t y || tmux -u -2 new -s y'