Contents
ebal@ebal:~\€ echo $BASH_VERSION 3.2.25(1)-release
ebal@ebal:~\€ echo $RANDOM 29183 ebal@ebal:~\€ echo $RANDOM 1628 ebal@ebal:~\€ echo $RANDOM 408 ebal@ebal:~\€ echo $RANDOM 14008 ebal@ebal:~\€ echo $RANDOM 16924
> date -d '1970-01-01 1170384301 sec' Fri Feb 2 02:45:01 EET 2007
export HISTTIMEFORMAT='%d/%m/%Y %H:%M '
ls | while read line;do tar jxvf $line ; done
for i in * ; do tar jxvf $i ; done for i in `ls -1`; do echo $i; cat $i; done
$ ps -ef | grep ht[t]pd
$ wc -l file 19308615 file $ grep -B 1 '0$' file ... ... ... $ grep -A 1 '0$' file ... ... ...
find . -follow
find /www -type f -name "*.php" -exec sed -r -i 's/ebal/Evaggelos Balaskas/' {} \;
find /www -type f -name "*.php" -exec sed -r -i 's/(ebal|ebalaskas)/Evaggelos Balaskas/' {} \;
find / -type f ! -path '*snap*'
find / -type f ! -path '*snap*' ! -path '*tmp*' ! -path '/proc'-size +1G
find . -name .snapshot -prune -o -name exports -print
nohup abcd &
clear; sort -k 3 -t ":" /etc/shadow | awk -F ":" '{ if ( ( $2 != "!!" && $2 != "*" ) && ( $5 != "99999" ) && ( $6 != "" ) ) { "date --date \"1970-1-1 "($3+$5)" days\" "| getline expire; print $1 " " expire } }' | awk '{print $1 " expires on " $4"/"$3"/"$7}'
set -o noclobber dmesg > dmesg.log dmesg > dmesg.log bash: dmesg.log: cannot overwrite existing file
dmesg >| dmesg.log
set +o noclobber dmesg > dmesg.log dmesg > dmesg.log
alias s="cd .." alias mv="mv -iv" alias md="mkdir -iv" alias cp="cp -iv" alias rm="rm -iv"
Handle | Name | Description |
0 | stdin | Standard input |
1 | stdout | Standard output |
2 | stderr | Standard error |
&> | stdout & stderr | |
2>&1 | stderr to stdout |
/usr/bin/rsync -vrpogtzPh --stats --delete -e ssh server:/some/dir . /usr/bin/rsync -vazP --log-file /var/log/rsync.log --stats --delete -e ssh server:/some/dir .
dmesg | tee dmesg.log dmesg | sponge dmesg.log dmesg > dmesg.log grep -v dmesg.log | sponge dmesg.log
alias sip='sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4'
ls -1 | xargs -t -I{} ls -l {}
zenity --info --text="IP: `curl -s whatismyip.org`"
Destination box: nc -l -p 2342 | tar -C /target/dir -xzf - Source box: tar -cz /source/dir | nc Target_Box 2342
ifconfig -a | grep -E -o 'inet addr:([0-9]{1,3}\.){3}[0-9]{1,3}' | awk -F: '{print $2}'
awk '{print " '\'' "}'
/usr/bin/notify-send -u critical "<b>Please Hibernate ASAP</b>" "Your battery level is 10% and your computer is out of AC. Plz put your computer to charge" -i battery-caution
<space><tab><newline>
#!/bin/sh clear function ff() { string=$1 for i in $string; do echo $i done } ff "begin this string begin this string has no end has no end" IFS=. echo "===" ff "begin.this.string.begin.this.string.has.no.end.has.no.end"
#!/bin/sh clear string="begin.this.string.begin.this.string.has.no.end.has.no.end" word="*begin" word2="end*" # Print string echo 0: ${string} # Print length echo 0: ${#string} # Remove first match echo 1: ${string#${word}} # Remove till last match echo 2: ${string##${word}} # Remove last match echo 3: ${string%${word2}} echo 4: ${string% %${word2}}
0: begin.this.string.begin.this.string.has.no.end.has.no.end 0: 57 1: .this.string.begin.this.string.has.no.end.has.no.end 2: .this.string.has.no.end.has.no.end 3: begin.this.string.begin.this.string.has.no.end.has.no. 4: begin.this.string.begin.this.string.has.no.
$ word="lowercase" $ echo "${word^^}" LOWERCASE
$ word="UPPERCASE" $ echo "${word,,}" uppercase
diff -u <(sort /etc/group) <(sort /etc/group.pacnew)
for j in `seq 0 255`; do for i in `seq 0 255` ; do seq -f "10.$j.$i.%g" 0 255 ; done ; done
\x27 or \47
\x22 or \42
[link2] http://tldp.org/LDP/abs/html/