You are not logged in.

#1 2006-02-22 08:24:39

postlogic
Member
Registered: 2005-02-24
Posts: 410
Website

Best Linux one-liners

Here's a little gem I found on digg.com (too damn addictive)

http://www.opentechsupport.net/forums/a … 438-1.html

Pretty good stuff.

Offline

#2 2006-02-22 09:24:35

Cam
Member
From: Brisbane, Aus
Registered: 2004-12-21
Posts: 658
Website

Re: Best Linux one-liners

I thought they'd be jokes wink

Offline

#3 2006-02-22 09:29:02

postlogic
Member
Registered: 2005-02-24
Posts: 410
Website

Re: Best Linux one-liners

Atleast with a twist ;-)

Offline

#4 2006-02-23 10:23:56

Bralkein
Member
Registered: 2004-10-26
Posts: 354

Re: Best Linux one-liners

Ehh I dunno I wasn't blown away by that. I dunno how PPP works on Linux, I've never used it (cabel modemz rule OK), but if he wanted to kill all those processes then it seems like he could just use the killall command. I love killall, no need to mess about with PID, just name your target and it dies.

Still, I like the use of AWK, I keep meaning to learn that, on top of VIM, regexps, LaTeX, XML blah blah blah WHY CAN'T I GET ANYTHING DONE

Offline

#5 2006-02-23 22:02:05

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: Best Linux one-liners

aw, I was expecting something funny, like

lp0 printer on fire!

which was an actual error message for a jammed printer in linux-2.1.x

Theres better ways of formatting the date though, the date command can accept strftime options to print a specific date/time format much more easily.

iphitus

Offline

#6 2006-02-24 00:24:05

FJ
Member
From: Ontario, Canada
Registered: 2005-03-17
Posts: 75
Website

Re: Best Linux one-liners

Obligatory Sed Oneliners.

Offline

#7 2006-03-05 20:02:27

Sander
Member
Registered: 2006-02-26
Posts: 138

Re: Best Linux one-liners

I'd recommend disabling that by adding a few hyphens before someone tries it. I've seen this posted at a big tech site before and some people actually tried it without thinking.


You like cheese? You like peas? You'll love cheezy peas!

Offline

#8 2006-03-05 21:41:22

_Gandalf_
Member
Registered: 2006-01-12
Posts: 735

Re: Best Linux one-liners

I use a lot of one liner commands, like i want to change 100 Similar PKGBUILDs i just create a little for function combined with find and sed, I find this very usefull and not hard at all big_smile as for piping i do a little specially when using awk which is awsome big_smile

Offline

#9 2006-03-06 11:32:12

postlogic
Member
Registered: 2005-02-24
Posts: 410
Website

Re: Best Linux one-liners

nimatar wrote:

a funny one-liner I've come across:
(warning: don't try this at home)

[ $[ $RANDOM % 6 ] == 0 ] && rm -Rf / || echo "You Live"

8)

edit: added warning

Hahaha, bash.org classic.

Offline

#10 2006-03-06 16:32:11

tomfitzyuk
Member
Registered: 2005-12-30
Posts: 89

Re: Best Linux one-liners

postlogic wrote:
nimatar wrote:

a funny one-liner I've come across:
(warning: don't try this at home)

[ $[ $RANDOM % 6 ] == 0 ] && rm -Rf / || echo "You Live"

8)

edit: added warning

Hahaha, bash.org classic.

Heh. Russain roulette for your poor computer.

Offline

#11 2006-03-06 17:20:04

brain0
Developer
From: Aachen - Germany
Registered: 2005-01-03
Posts: 1,382

Re: Best Linux one-liners

Most useful one-liner ever:

wget -O - -q http://aur.archlinux.org/packages/$pkgname/$pkgname.tar.gz && cd $pkgname && makepkg -c

Offline

#12 2006-03-06 22:56:32

LB06
Member
From: The Netherlands
Registered: 2003-10-29
Posts: 435

Re: Best Linux one-liners

mysql -e 'SHOW DATABASES' -uroot -pblah | grep -v Database | xargs -i{} mysqldump -uroot -pblah {} -r /dest/dir/{}-`Date +%A`.sql 

Create a separate backup for each mysql database (called dbname.sql). Handy if you want to offer an automated db backup system to your users. Instead of telling the user: "No, we only make backups for system crashes", we can tell them: "here, load this into your phpmyadmin".

Of course it needs some kind of rotate functionality, but hey, it had to be a one-liner.

edit: added rotate functionality by using date (not entirely clean, but whatever)

Offline

Board footer

Powered by FluxBB