UNIX One-Liners (No, Not Jokes)

Discuss the security implications of the various flavors of linux and unix

UNIX One-Liners (No, Not Jokes)

Post by Goatboy on Mon Mar 21, 2011 3:38 pm
([msg=55318]see UNIX One-Liners (No, Not Jokes)[/msg])

I was hanging out in IRC one day when Kage expressed his love of UNIX one-liners. That is to say, in layman's terms, a bunch of UNIX commands piped into each other to create a very powerful result. You'll usually see a bunch of awk, sed, cut, sort, and grep in these one-liners. Today, I found this article explaining how someone effectively defended against a very determined attacker launching a DDoS, all with a single Bash script:

http://www.linuxjournal.com/content/bac ... mplex-ddos

Just goes to show how powerful a bunch of simple commands can be. Got a favorite? Post it here.
Assume that everything I say is or could be a lie.
1UHQ15HqBRZFykqx7mKHpYroxanLjJcUk
User avatar
Goatboy
Expert
Expert
 
Posts: 2784
Joined: Mon Jul 07, 2008 9:35 pm
Blog: View Blog (0)


Re: UNIX One-Liners (No, Not Jokes)

Post by fashizzlepop on Mon Mar 21, 2011 6:14 pm
([msg=55323]see Re: UNIX One-Liners (No, Not Jokes)[/msg])

Code: Select all
perl -e ''
The glass is neither half-full nor half-empty; it's merely twice as big as it needs to be.
User avatar
fashizzlepop
Developer
Developer
 
Posts: 2303
Joined: Sat May 24, 2008 1:20 pm
Blog: View Blog (0)


Re: UNIX One-Liners (No, Not Jokes)

Post by insomaniacal on Tue Mar 22, 2011 3:20 pm
([msg=55382]see Re: UNIX One-Liners (No, Not Jokes)[/msg])

This isn't anything special, just a use of the every-powerful find command.

Code: Select all
find ./Prosto*/*.avi -exec mv ./{} ./burn \;


Essentially, it'll look through your local directory for folders starting with "Prosto", then find the avi's inside them, and move them a folder called ./burn. My father downloads lots of Polish sitcoms, so instead of click-dragging to burn them, this command becomes extremely useful.

BASH certainly can be very powerful. I think this seasons (or was it last seasons?) issue of 2600 had an article that had some pretty cryptic looking examples, that actually did some pretty neat things.
It's not who votes that counts, it's who counts the votes
insomaniacal.blog.com
User avatar
insomaniacal
Addict
Addict
 
Posts: 1210
Joined: Sun May 24, 2009 10:21 am
Blog: View Blog (0)


Re: UNIX One-Liners (No, Not Jokes)

Post by Goatboy on Tue Mar 22, 2011 3:30 pm
([msg=55385]see Re: UNIX One-Liners (No, Not Jokes)[/msg])

insomaniacal wrote:BASH certainly can be very powerful. I think this seasons (or was it last seasons?) issue of 2600 had an article that had some pretty cryptic looking examples, that actually did some pretty neat things.

That's the latest as of this post. The guy had a very limited account (/usr was not mounted) and he was able to work just fine with some Bash magic. I think the article is called "Bash, bash, bash!" near the front, iirc.
Assume that everything I say is or could be a lie.
1UHQ15HqBRZFykqx7mKHpYroxanLjJcUk
User avatar
Goatboy
Expert
Expert
 
Posts: 2784
Joined: Mon Jul 07, 2008 9:35 pm
Blog: View Blog (0)


Re: UNIX One-Liners (No, Not Jokes)

Post by insomaniacal on Tue Mar 22, 2011 4:02 pm
([msg=55386]see Re: UNIX One-Liners (No, Not Jokes)[/msg])

Goatboy wrote:That's the latest as of this post. The guy had a very limited account (/usr was not mounted) and he was able to work just fine with some Bash magic. I think the article is called "Bash, bash, bash!" near the front, iirc.

Yea, that's the one. I usually read them at a Barnes and Noble and so didn't have a copy on hand.
It's not who votes that counts, it's who counts the votes
insomaniacal.blog.com
User avatar
insomaniacal
Addict
Addict
 
Posts: 1210
Joined: Sun May 24, 2009 10:21 am
Blog: View Blog (0)



Return to *nix

Who is online

Users browsing this forum: No registered users and 0 guests