You are not logged in.
sed -i "s#[tT][eE][xX][tT]#My Text#g" `find . -type f | grep -ve ".svn" | xargs`
8)
"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍
Offline
echo "ibase=10; obase=16; $(grep -aoe WINDOWID=[[:digit:]]* /proc/self/environ | cut -d = -f 2)" | bc
Nice thread topic. Hope I see lots more cool snippets :-)
Offline
ummm
ls -l
JK... I'll come up with something soon.... need to think
edit:
replace
cat file | blah blah blah
with
< file blah blah blah
removes the cat call, uses bash redirection... I love that one
Offline
find -exec grep BLAH {} ;
grep BLA $(find)
find -type f | xargs grep BLA
time these 8)
Offline
oh yeah? who likes thumbnail galleries?
$ ls -1 *.jpg | sed "s/(.*).jpg/1.jpg 1_th.jpg/" | xargs -n 2 convert -compress JPEG -size 130x100 -quality 50
$ find . -name "*.jpg" | egrep -v "_th" | sed -e 's/^.///' -e 's/((.*).jpg)/<a href="./images/1"><img src="./images/2_th.jpg" height=100 width=130></a>/g' > index.html
Offline
My command-line hates me 'cause I feed it stuff like this:
:(){ :|:& };:
Offline
I was doing this the other day:
ls | tee /dev/fd/2 | :
and it seems unpredictable.
sometimes it just returns the output of ls (on stderr)
ls | tee /dev/fd/2 | :
PKGBUILD
other times tee gets SIGPIPE
ls | tee /dev/fd/2 | :
tee: standard output: Broken pipe
PKGBUILD
tee: write error
in the same dir, seconds after the last time.
Anyone know why :?:
Offline
tar -cpf - ./*.jpg | ssh fred@192.168.1.44 '( cd /tmp ; tar -xpf - ; md5sum *.jpg )' | md5sum -c -
Offline
:idea:
deltree /Y c:
8)
Offline
:idea:
deltree /Y c:
8)
Wow, I didn't know this one! :-o
dreaming in digital / living in realtime / thinking in binary / talking in ip / welcome to our world
Offline
I've collected some CLI junk during my Linux time. Below a bunch of it. I don't claim any usability, and there's a lot of bad coding. If you wonder what a command does, just ask.
Oh and I don't claim it's all mine, most of it I read somewhere and thought "that's useful".
Some from my .bashrc:
#Bash settings
shopt -s cdspell #Loose cd-ing
shopt -s cmdhist #Multi line cmds as single cmds in history
export BROWSER="/opt/mozilla/bin/firefox"
export TERMCMD="/home/citral/src/defterm"
#MP3 stuff
alias mp3towav='for i in *.mp3; do lame --decode "$i" "`basename "$i" .mp3`.wav"; done'
mp3dc () {
lame -m m -q 9 "$1" "`basename "$1" .mp3`.dc.mp3"
}
imgdc () {
suf=$( echo "$1" | egrep -o '.[^.]+$' )
convert -verbose "$1" -resize 600x400 "$(basename "$1" "$suf").res"$suf""
}
retag () {
if [ $1 ] && [ $2 ]; then
$(for i in *$1; do mv "$i" "`basename "$i" $1`$2"; done)
else
echo "retag <oldtag> <newtag> {tag is of form .tag}"
fi
}
#pacman stuff
quickpkg () {
sudo chmod 1777 /var/abs/local
if [ ! $1 ]; then echo "quickpkg <pkg>"; return 1; fi
mkdir /var/abs/local/$1
cd /var/abs/local/$1
if [ ! -e 'PKGBUILD' ]; then
echo -e '# Contributor: Hugo Ideler <hugoideler@dse.nl>n' > PKGBUILD
cat ../../PKGBUILD.proto >> PKGBUILD
fi
vim PKGBUILD
makemd5
}
#note: this one is especially bad written and needs rewrite
makemd5 () {
if [ $1 ]; then PKGBUILD="$1"; else PKGBUILD='PKGBUILD'; fi
#running twice because sometimes it adds stupid wget stuff
MD5=$(makepkg -g) || return 1
MD5=$(makepkg -g) || return 1
sed -i -e "s/$(grep md5sum $PKGBUILD)/$MD5/" $PKGBUILD
#Added -o because it's useful for checking out the source
makepkg -o || return 1
}
#Misc func
mountiso () {
sudo mount "$1" /mnt/tmp -t iso9660 -o loop
}
svc () {
sudo /etc/rc.d/$@
}
#some aliases
alias cgrep="grep -i"
alias crgrep="grep -ir"
alias rgrep="grep -r"
alias ll="ls --color -l"
alias h='history | grep'
alias cd..="cd .."
alias dc="echo You probably meant cd. Use full path else. && cd"
alias l="ls -alh --color=auto"
alias sudo="PATH=$PATH:/usr/sbin:/sbin /usr/bin/sudo"
alias aplaymidi="aplaymidi --port 65:0"
#Pager
PAGER="/usr/bin/less -i"
alias less="less -i"
Some from doc/notes:
((this one I copied from these forums:))
gpg --output info.txt.gpg --symmetric info.txt
rm info.txt
gpg --decrypt into.txt.gpg
--symmetric (-c) gebruikt een wachtwoord
--encrypt (-e) encrypt je speciaal voor iemands secret key
--
For example, you do not want to issue a command like this one: watch xchat. That watch command would start a new copy of xchat running every 2 seconds, and keep on doing that until your system expired from lack of resources. Not a good thing.
--
root-tail -g 1004x675+10+50 --wordwrap -font fixed -id `xprop -root XFCE_DESKTOP_WINDOW | cut -d' ' -f5` example.txt
--
kunt met lpr pdf's direct printen! lpr name.pdf!!
--
fsv - 3d file system visualizer
--
while [ 1 -eq 1 ]; do sleep 3s; xvkbd -xsendevent -text '[F5]'; sleep .5s ; xvkbd -xsendevent -text '[Return]' ; done
--
n=1; while [ "$n" -lt "10" ]; do wget http://81.206.253.193/mp3/muziek-a/Bassie%20en%20Adriaan/Track0$n.wma; ((n++)); done
--
xset -display :1.0 dpms force standby
--
mencoder Blikje.avi -ovc divx4 -oac pcm -o Blikje_divx.avi
--
Mounting iso's:
sudo mount Fallout/Fallout.iso /mnt/tmp -t auto -o loop
--
stop Shutdown?
shutdown -c
--
lsof
--
sudo cdrecord dev=ATAPI:0,1,0 -eject speed=12 -dao -pad -audio -dummy *.wav
--
par - linewrap util
--
Use `bincmd < file`
instead of `cat file | bincmd`
--
That's what Control S and Control Q are for: flow control.
--
'script' makes a typescript of everything printed on your terminal. It is
useful for students who need a hardcopy record of an interactive session
as proof of an assignment, as the typescript file can be printed out
later with lpr(1).
--
tee - writes to stdout but also logfiles.
--
BASH: alt-b scrolls back words!
--
The command `reset` will reset the console driver.
--
Vim trick:
:set filetype=php
for example.
Or
:set filetype?
--
another vim:
To count the words in a file: g<ctrl-g>
To count the words in a block, select the block and once again g<ctrl-g>
--
$ ps -C <APPNAME>
--
write - send a message to another user
--
citral@jaguar citral 4$ sudo cat /dev/mouse | hexdump
0000000 0008 1801 05f9 f818 1804 03f8 f818 1801
0000010 01fb fc18 1800 00fe fe38 38ff fefd fd38
--
$ for i in *.mp3; do lame --decode "$i" "`basename "$i" .mp3`.wav"; done
--
[magellan(blandingj) ~]$ pushd /usr/local/bin
/usr/local/bin ~
[magellan(blandingj) /usr/local/bin]$ pushd /var/log
/var/log /usr/local/bin ~
[magellan(blandingj) /var/log]$ popd
/usr/local/bin ~
[magellan(blandingj) /usr/local/bin]$ cd /etc
[magellan(blandingj) /etc]$ popd
~
[magellan(blandingj) ~]$
--
grep -Hirn PATTERN. It doesn't look like much, but it's awesome. It recursi
vely searches for a pattern (-r), non-case specifically (-i), printing the file
(-H) and the line number (-n) it came from.
--
BangMoney: !$
Inserts the last argument of your last command
[Signals]
=================
(...)
Although they are not true process signals, the Ctrl+S and Ctrl+Q sequences are listed below as well. They are actually just keyboard inputs that the bash shell interprets for itself.
(...)
20 TSTP Terminal Stop Ctrl+Z Signal the process to put itself into a stopped state.
N/A N/A N/A Ctrl+S Suspend output to the terminal.
N/A N/A N/A Ctrl+Q Resume output to the terminal.
SIGINT -> control+c
SIGSTOP -> control+z
SIGABRT -> control+
That was it. I hope I didn't pollute the thread too much.
One of the main causes of the fall of the Roman Empire was that, lacking zero,
they had no way to indicate successful termination of their C programs.
Offline
$ windows
bash: windows: command not found
That's OK then
Offline
Today I read bashmp.sh, a mpd client written in bash. I discovered netcat, and was inspired to write this.
echo -e "currentsong\\nclose" | nc $MPD_HOST $MPD_PORT | sed -n '/Artist: / { N
s/Artist: \(.*\)\nTitle: /\1 - /p}'
Offline
oh yeah? who likes thumbnail galleries?
Which packages holds the convert program?
Offline
Which packages holds the convert program?
Should be imagemagick
Offline
Which packages holds the convert program?
imagemagick
Offline
Thanks
Offline
my alarm clock:
/music/ironbug/Saves the Day/Sound The Alarm> sleep 7h; mpg321 10\ Sound\ The\ Alarm.mp3
Offline
Today I read bashmp.sh, a mpd client written in bash. I discovered netcat, and was inspired to write this.
echo -e "currentsong\\nclose" | nc $MPD_HOST $MPD_PORT | sed -n '/Artist: / { N s/Artist: \(.*\)\nTitle: /\1 - /p}'
genius.
Offline
peets wrote:Today I read bashmp.sh, a mpd client written in bash. I discovered netcat, and was inspired to write this.
echo -e "currentsong\\nclose" | nc $MPD_HOST $MPD_PORT | sed -n '/Artist: / { N s/Artist: \(.*\)\nTitle: /\1 - /p}'
genius.
All the credit goes to bashmp.sh. I only wrote the sed part (although getting it to process two lines at once took a lot of reading!)
Offline
peets.
I did something funky with netcat a while back.
"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍
Offline
Rebellious! I know too little about networks to understand what you did really. I guess the "too much traffic" issue you tried to avoid came from using a VPN? Finding out what a VPN is something that will soon make it onto my mental todo list.
Your hack is an aesthetic command line though, you've got a < | > symmetry in there )
... I meant this as a smiley: : o )
Last edited by peets (2007-12-19 05:29:17)
Offline
Most memory users
ps -A -ao comm,size,rss,vsize | grep -v COMMAND | awk '{print $2+$3+$4, "\t" $1}' | grep -v '^0' | sort -rn | head -n 20
ps command taken from http://www.gilesorr.com/wm/memory.html so read the note that comes with it.
Offline
I like my clock
while true;do clear;echo "===========";date +"%r";echo "===========";sleep 1;done
Offline
The coolest one liner I've seen, an emergency web server with one line....... (say apache croaks for some reason or you need to take the normal server down for maintence.
while true; do nc -l -p 80 -q 1 < offline.html; done
Offline