The other major time saver I use are sed and awk. I used each for a specific purpose. Sed works great for substitution, and awk I use to grab columns of data. Here's a sample of how I'd use both together. This will list the home directories of the users on a machine. It's simple, but there's a ton you can do with this technique.
who | awk '{print $1}' | sort | uniq | sed 's@^@/home/@g'
Actually, you don't need awk, sed, sort or uniq to do that. You can use perl for everything:
Same thing, but without using
awk, sed, sort or uniq at all.
Here's other stuff I have grouped by sections in my.cshrc
If you are programming in a csh-like shell and you are not reading comp.unix.shell
you might want to take a look at
this post
by
Tom Christiansen
for a nice description of everything you should make sure to be especially careful with.
a nice idea, but just calling apropos or man does not really help, as the idea mentioned in the original article: "help disk space" gives me the df command is not working:
[klink@dandelion]/tmp$./smarthelp.sh disk space
No manual entry for disk space
disk: nothing appropriate
space: nothing appropriate
Are you sure? It works on my system:
pth@cc9:55:~$ help disk space
No manual entry for disk space
df (1) - report filesystem disk space usage
pth@cc9:55:~$
What shell are you using?
This is what I'm testing it on right now,
a fairly old bash on a fairly old Debian GNU/Linux:
pth@cc9:55:~$
$SHELL --version
GNU bash, version 2.05a.0(1)-release (i386-pc-linux-gnu)
Copyright 2001 Free Software Foundation, Inc.
pth@cc9:55:~$
Maybe try changing a=${@:-help};
to a="${@:-help}";?
Or even something like
a="'${@:-help}'";?
This is a quoting problem (it should pass all arguments of smarthelp as a single argument to apropos) so try to experiment
with different interpolation of variables, like $var, "$var", "'$var'", escaping quotes etc. This: a=`echo $!` should work as an ugly work-around.
Wait a minute...
You should get:
No manual entry for disk
No manual entry for space
If there is indeed a problem with quoting in my script, while you got:
No manual entry for disk space
which means that man gets it as a single argument.
Are you sure you haven't written it as:
a=${@:-help}; help "$a" 2>/dev/null || man "$a" || apropos $a
instead of:
a=${@:-help}; help "$a" 2>/dev/null || man "$a" || apropos "$a"
? Are you sure?
Please answer as soon as possible. Thanks.
Very recently, after reading a (Score:5, Insightful) idea on what would "make Linux four times what it is today" I decided to write
a shell script which does exactly that.
Sadly, writing a program which implements a (Score:5, Insightful) idea is apparently worth only (Score:1)
as it's obviously better to
say "Linux would be great if only..."
than just doing it.
Anyway, I have released it under the GNU General Public License. Enjoy!
Unfortunately, the proper answer to that question is "Yes, it most certainly can." That is why before testing or reconfiguring, you should always mount a
scratch monkey.
Hey, this program works EXACTLY as the
(Score:5, Insightful) idea in
nokilli's
post
The 'help' command!
I have just installed it according to the instruction posted
here (please mod it up as well) and now every command below works perfectly!
Yes, I was strictly following the specifications posted by nokilli.
Yes, the last one tells me to use df!!!
Just like the insightful idea of nokilli!
Wow!
I didn't know it was possible.
It was possible. Otherwise I wouldn't have written it, now whould I? But seriously: nothing is impossible in Linux. Nothing. And that is the true power of free software. Always remember that.
I really hope my program will serve you well. All of you.
Thanks a lot, Pan T. Hose!
Please don't thank me.
I only did my duty as
a free software developer
and a Slashdot community member.
# save it as/usr/local/bin/smarthelp # chmod a+rx/usr/local/bin/smarthelp # and insert this line in ~/.bashrc: # # [ $PS1 ] && alias help=smarthelp
# PTH(R) Smart Help(TM) v1.0.1-pre2 # http://slashdot.org/comments.pl?sid=99801&cid=8510 901 # Copyright (C) 2004 Pan T. Hose, PhD. # http://slashdot.org/~Pan+T.+Hose # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
a=${@:-help}; help "$a" 2>/dev/null || man "$a" || apropos "$a"
I'd wager that computer literacy amongst people who've tried Linux would be twice what it is today if when you typed help foobar bash would perform a man foobar if 'foobar' wasn't a builtin command. And it'd probably be double that if you incorporated some kind of search facility too. Type in help disk space and get a hit on the df command, for instance.
I think that is a very good idea
and for that reason
after reading your comment I
decided to write such a program
according to your specification.
Just remember who has just made Linux
four times what it was today:
me,
Pan T. Hose, PhD.
That having been said, I'll post that program in another comment, because I have to post it as "Code" instead of "HTML."
Please mod it up
(the actual code, as well as
the instructions below)
as Score:5, Insightful, so everyone could read it and install, because I think every Slashdotter deserves to have her Linux four times better than it has ever been.
You have to save
my program
as/usr/local/bin/smarthelp, then run:
chmod a+rx/usr/local/bin/smarthelp
as root
and insert this line in your ~/.bashrc file:
[ $PS1 ] && alias help=smarthelp
Remember to give me credit
and to not violate the GNU
General Public License
it is hereby released under.
The code follows:
If you dont support MS, then fine. Don't buy their product. But using their product (pirated or otherwise rented where legal), you're just indirectly supporting them by telling your friends and relations that it's OK to send you MS -formated documents (Word, XCell etc). You're not accomplishing much, in a show of disapproving their products or business model, by using their products.
As the old saying goes: stealing crack doesn't make you any less addicted.
Dear Slashdot...
My student is unbelievably smart, however has very limited social skills, is unable to cooperate with peers, doesn't understand why they make fun of his uncombed hair, etc.
Hmmmm... A sociopathic genius, you say...
Might I suggest showing him Slashdot?
He seems to be
absolutely perfect by our standards.
He will fit perfectly.
Who knows, he might even become an editor
some day...
"For those of you that are lucky enough to have snagged a copy, remember
this, Build 4053 is still a baby, not even in Beta stage yet, so
we will not go in depth into subjects such as the theme, sidebar, etc."
"The layout is clean and clutter free.
Minimal icons are presented on the desktop,
which is one of my pet peeves;
I go to great lengths to maintain an icon-less desktop.
The sidebar is definitely going to have its share of protestors,
me being one of them. To me, no matter what is docked on the sidebar
in the final release, it is a huge waste of space and system resources
that a vast majority of users will just turn off.
There will be more applets applied to it in the end, search bars,
link bars, etc, so as the sidebar comes of age, we will examine it once again."
"At this point in time, build 4053 is basically Windows XP
with a different theme,
even though some new technologies are being created
and there are dribs and drabs of them in this build."
"The layout and orientation of the windows has been
vastly improved. All links and graphical elements have been fine tuned
and are now neat and organized. All in all, the current theme applied
to Build 4053 (Slate) is very clean and well organized. Hopefully,
Microsoft will learn from the vast amount of people that apply a patched
dll in order to obtain and apply themes other than those provided by Microsoft,
and add on an the ability to apply various themes from the thousands available.
But we will talk more on the theme with Microsoft's User Experience (Aero)
and the new Drawing Model (Avalon) in a little while."
"Certainly there is a long way to go with the new Aero Experience,
but there are bits and pieces here and there. Aero is not only the
look and feel of Windows, but also the experience that a user has with Windows.
How a user interacts and feels about using the Windows environment seems
to be a major focal point for Microsoft."
"Avalon will allow for scaling icons, which at the moment utilizes
bitmaps at a small pixel rate. This will be changed in builds to come.
At the current pixel range, icons that are scaled larger appear more and
more pixilated due to their initial size limit. The final drawing model
will most probably utilize vector image files or larger bitmaps up to
128 x 128 to allow for clean icon scaling or a combination of both."
"Not much is different from Windows XP in build 4053;
most features are exactly the same.
But don't be disappointed, there is still a long way to go with
Longhorn and vast improvements are sure to be made."
[emphasis added]
Andy: It never ends. He posted nude pictures of one of the females after he found out she was playing a love triangle between her and another kiddie, jupes.
Roblimo: How wise do you think law enforcement is to any of this?
Andy: The general answer I've gotten is, "We don't have the time or resources to have our agents monitor IRC." They know, but they've adamantly got their fingers in their ears whistling loudly.
This is an outrage!
We are talking about script kiddie porn here, for God's sake!
I am very disappointed by
the law enforcement here!
Very disappointed!
"but for some reason Slashdotcode don't let me use"
"Din't you know that Funny moderation doesn't increase your "Karma"?"
For someone who is a member of Mensa, you would think that you would at least take the time to check your post for grammatical errors...
Please...
I am sick of everyone feeling somehow obligated to point out every single orthographical
(sic, not grammatical) errour
of mine
just because I happen to have
Philosophiae Doctor degree,
intelligence quotient
well above the "genius" level or Mensa membership for that matter.
Now please tell me, how do you think it is all related to my orthographical,
lexical, syntactical---or linguistical as a whole---skills
or the lack thereof?
Let me tell you how: it is in no way related, not at all. Have you ever taken a Mensa test for God's sake?! Do you know how does it look like, for the love of God?! This is just unbelievable!
What is wrong with you people?!
Do you feel smarter because you have found some stupid typos in my post?
Do you feel better?
Do you think you have succeeded in disproving my point? Please tell me, why are you doing it? I would really like to know.
This is not meant to be a personal attack on you
Good to know...
It was not meant
but it was an argumentum ad hominem, the most stupid and insulting logical fallacy since
Sophistical Refutations
by Aristoteles!
but rather a fun battle of words, mainly for my entertainment and that of others.
I hope you are having a great time!
You made an excellent point in your inital post, and I can't help but see that you hold a very strong stance on the issue of "+5 Funny" moderation.
As a matter of fact, yes, I do.
What is your point?
VULNERABILITY
ASSESSMENT:
The risk is MEDIUM. A local unprivileged user may be able to gain unauthorized root privileges.
Yeah, right, medium. It is just a root exploit after all...
Medium my arse!
The fact is that
the exploit has been circulating
for quite some time now on irc and freenet.
And are we supposed to believe that it was just an accident that a god damn root exploit has been
included in the freaking passwd?
Have you seen the source code of this thing?!
An anonymous friend of mine has told me that there are quite a few strange lines of code not only in Linux.
But guess what? It's quite hard to get Solaris source code
to audit and patch it yourself,
unless you have some ties to the underground.
Medium... Yeah, right...
Ironically, the entire rant aobut unproffessional conduct come from a guy with the name "Pan T. Hose." So original...
Well, Mr. Maztuhblastah
(if that is your real name),
there is indeed no "e" in "Hose" but "LATIN CAPITAL LETTER E WITH ACUTE" (0xE9) but for some reason Slashdotcode don't let me use ISO-8859-1 characters, let alone Unicode. However funny that might be, I fail to find any irony here to be honest.
Mod me up to +5 Funny if you want to prove him wrong...
Ha! Nice try!
Din't you know that Funny moderation
doesn't increase your "Karma"?
--
Pan T. Hose, PhD
Skyscraper Construction
Consulting Services
Tokyo, Japan.
There must be something seriously wrong
on
The Disposable Computer
·
· Score: 5, Interesting
with Slashdot
when 95% of Score:5 comments
to such an interesting article are "Funny."
That having been said,
I believe that
our community as a whole
(id est Slashdot at large)
seems to completely lack any
professionalism regarding
cryptography by
writing on the front page that
"the paperboard computer can collect, process, and exchange several pages of encrypted data, the company says."
which is supposedly
'Pretty impressive, given that they say it has a mere 32K of memory.'
Surprise: To "collect, process, and exchange several pages of encrypted data"
you don't need million times more memory than said data! Film at 11!
What will be "impressive" next? The fact that strong crypto can use only few cycles per byte on general purpose processor? Wow! How impressive! Really? I don't need 4GHz Pentium 5 with 4GB of RAM to "collect, process, and exchange several pages of encrypted data"?
Give me a break! This article is great news and really worth reading, but for much more important reasons than those that kids today think that you need ten hundred megabytes of ram to encrypt and store ten kilobytes of plain text. I, for one, feel insulted by such article summaries, because everyone who knows that I am a Slashdot user might think that I must be completely incompetent looking at the front page.
I might only suggest for everyone who wishes to post stories about cryptography to read at least Applied Cryptography by Bruce Schneier first. This is the absolute minimum if you don't want to make an idiot out of yourself.
Why cannot we talk about the serious implications of using RFID technology to build this machine instead of posting completely unintelligent jokes in the lines of "Imagine a beowulf cluster of those! It might have 640kB of RAM! Who needs more?" This is stupid at best and insulting at worst. I urge you to start posting insightful, informative or at least interesting posts before it is too late and this discussion is already archived.
What I am personally most concerned about is how disposable are the active and passive (semi-)conductor elements which are printed on this boards. Does anyone have any experience in disposing them? It is not very clear in the article.
"The students at Copenhagen's new IT University will soon be guided by invisible, but talkative digital agents
[...]
Ignored ghosts can die out completely.
[...] - several papers have been published already."
Actually, you don't need awk, sed, sort or uniq to do that. You can use perl for everything:
Same thing, but without using awk, sed, sort or uniq at all.
If you are programming in a csh-like shell and you are not reading comp.unix.shell you might want to take a look at this post by Tom Christiansen for a nice description of everything you should make sure to be especially careful with.
Are you sure? It works on my system:
pth@cc9:55:~$ help disk space
No manual entry for disk space
df (1) - report filesystem disk space usage
pth@cc9:55:~$
What shell are you using? This is what I'm testing it on right now, a fairly old bash on a fairly old Debian GNU/Linux:
pth@cc9:55:~$ $SHELL --version
GNU bash, version 2.05a.0(1)-release (i386-pc-linux-gnu)
Copyright 2001 Free Software Foundation, Inc.
pth@cc9:55:~$
Maybe try changing a=${@:-help}; to a="${@:-help}";? Or even something like a="'${@:-help}'";? This is a quoting problem (it should pass all arguments of smarthelp as a single argument to apropos) so try to experiment with different interpolation of variables, like $var, "$var", "'$var'", escaping quotes etc. This: a=`echo $!` should work as an ugly work-around.
Wait a minute... You should get:
No manual entry for disk
No manual entry for space
If there is indeed a problem with quoting in my script, while you got:
No manual entry for disk space
which means that man gets it as a single argument. Are you sure you haven't written it as:
a=${@:-help}; help "$a" 2>/dev/null || man "$a" || apropos $a
instead of:
a=${@:-help}; help "$a" 2>/dev/null || man "$a" || apropos "$a"
? Are you sure? Please answer as soon as possible. Thanks.
Very recently, after reading a (Score:5, Insightful) idea on what would "make Linux four times what it is today" I decided to write a shell script which does exactly that. Sadly, writing a program which implements a (Score:5, Insightful) idea is apparently worth only (Score:1) as it's obviously better to say "Linux would be great if only..." than just doing it. Anyway, I have released it under the GNU General Public License. Enjoy!
Are you saying that we could use that space for software RAID1 solution?
Isn't that ironic that we can't finger Microsoft, while said Microsoft has been raping us for years?
Poor Buck...
Unfortunately, the proper answer to that question is "Yes, it most certainly can." That is why before testing or reconfiguring, you should always mount a scratch monkey.
I am pleased to announce that my current prompt:
PS1='`[ $? == 0 ] && echo -e "\033[01;32m" || echo -e "\033[01;31m"`\u@\h:\w\$ \033[00m'
just became:
PS1='`[ $? == 0 ] && echo -e "\033[01;32m:)" || echo -e "\033[01;31m:("` \u@\h:\w\$ \033[00m'
Thank you.
Yes, I was strictly following the specifications posted by nokilli.
It was possible. Otherwise I wouldn't have written it, now whould I? But seriously: nothing is impossible in Linux. Nothing. And that is the true power of free software. Always remember that. I really hope my program will serve you well. All of you.
Please don't thank me. I only did my duty as a free software developer and a Slashdot community member.
Thank you. You are very kind.
#!/bin/bash
/usr/local/bin/smarthelp /usr/local/bin/smarthelp
0 901
# save it as
# chmod a+rx
# and insert this line in ~/.bashrc:
#
# [ $PS1 ] && alias help=smarthelp
# PTH(R) Smart Help(TM) v1.0.1-pre2
# http://slashdot.org/comments.pl?sid=99801&cid=851
# Copyright (C) 2004 Pan T. Hose, PhD.
# http://slashdot.org/~Pan+T.+Hose
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
a=${@:-help}; help "$a" 2>/dev/null || man "$a" || apropos "$a"
I think that is a very good idea and for that reason after reading your comment I decided to write such a program according to your specification.
Just remember who has just made Linux four times what it was today: me, Pan T. Hose, PhD.
That having been said, I'll post that program in another comment, because I have to post it as "Code" instead of "HTML." Please mod it up (the actual code, as well as the instructions below) as Score:5, Insightful, so everyone could read it and install, because I think every Slashdotter deserves to have her Linux four times better than it has ever been.
You have to save my program as /usr/local/bin/smarthelp, then run:
chmod a+rx /usr/local/bin/smarthelp
as root and insert this line in your ~/.bashrc file:
[ $PS1 ] && alias help=smarthelp
Remember to give me credit and to not violate the GNU General Public License it is hereby released under. The code follows:
As the old saying goes: stealing crack doesn't make you any less addicted.
The Command Line -- Best Newbie Interface?
Windows -- Is It Worth $45?
Gifted Youths -- Building Social Skills?
Perl 6 -- Does It Have Simple Syntax?
Slashdotters -- Do They Ever Get Laid?
Earth -- Is It Flat?
Stay tuned for more! Only on Ask Slashdot.
Hmmmm... A sociopathic genius, you say... Might I suggest showing him Slashdot? He seems to be absolutely perfect by our standards. He will fit perfectly. Who knows, he might even become an editor some day...
coffee, especially espresso, is good for you
Oh God, I knew it! Pan T. Hose: 1. Psychiatrists: 0!
Here are the most interesting quotes:
All in all, a great article.
This is an outrage! We are talking about script kiddie porn here, for God's sake! I am very disappointed by the law enforcement here! Very disappointed!
Please... I am sick of everyone feeling somehow obligated to point out every single orthographical (sic, not grammatical) errour of mine just because I happen to have Philosophiae Doctor degree, intelligence quotient well above the "genius" level or Mensa membership for that matter. Now please tell me, how do you think it is all related to my orthographical, lexical, syntactical---or linguistical as a whole---skills or the lack thereof? Let me tell you how: it is in no way related, not at all. Have you ever taken a Mensa test for God's sake?! Do you know how does it look like, for the love of God?! This is just unbelievable! What is wrong with you people?! Do you feel smarter because you have found some stupid typos in my post? Do you feel better? Do you think you have succeeded in disproving my point? Please tell me, why are you doing it? I would really like to know.
Good to know... It was not meant but it was an argumentum ad hominem, the most stupid and insulting logical fallacy since Sophistical Refutations by Aristoteles!
I hope you are having a great time!
As a matter of fact, yes, I do. What is your point?
Oh my God! What a paranoid freak that Darl McBride is! Oh, wait, he's not...
VULNERABILITY ASSESSMENT: The risk is MEDIUM. A local unprivileged user may be able to gain unauthorized root privileges.
Yeah, right, medium. It is just a root exploit after all... Medium my arse! The fact is that the exploit has been circulating for quite some time now on irc and freenet. And are we supposed to believe that it was just an accident that a god damn root exploit has been included in the freaking passwd? Have you seen the source code of this thing?! An anonymous friend of mine has told me that there are quite a few strange lines of code not only in Linux. But guess what? It's quite hard to get Solaris source code to audit and patch it yourself, unless you have some ties to the underground. Medium... Yeah, right...
Well, Mr. Maztuhblastah (if that is your real name), there is indeed no "e" in "Hose" but "LATIN CAPITAL LETTER E WITH ACUTE" (0xE9) but for some reason Slashdotcode don't let me use ISO-8859-1 characters, let alone Unicode. However funny that might be, I fail to find any irony here to be honest.
Ha! Nice try! Din't you know that Funny moderation doesn't increase your "Karma"?
Godzilla To Retire
Thank God!!!!1!
--
Pan T. Hose, PhD
Skyscraper Construction Consulting Services
Tokyo, Japan.
with Slashdot when 95% of Score:5 comments to such an interesting article are "Funny." That having been said, I believe that our community as a whole (id est Slashdot at large) seems to completely lack any professionalism regarding cryptography by writing on the front page that "the paperboard computer can collect, process, and exchange several pages of encrypted data, the company says." which is supposedly 'Pretty impressive, given that they say it has a mere 32K of memory.' Surprise: To "collect, process, and exchange several pages of encrypted data" you don't need million times more memory than said data! Film at 11! What will be "impressive" next? The fact that strong crypto can use only few cycles per byte on general purpose processor? Wow! How impressive! Really? I don't need 4GHz Pentium 5 with 4GB of RAM to "collect, process, and exchange several pages of encrypted data"?
Give me a break! This article is great news and really worth reading, but for much more important reasons than those that kids today think that you need ten hundred megabytes of ram to encrypt and store ten kilobytes of plain text. I, for one, feel insulted by such article summaries, because everyone who knows that I am a Slashdot user might think that I must be completely incompetent looking at the front page.
I might only suggest for everyone who wishes to post stories about cryptography to read at least Applied Cryptography by Bruce Schneier first. This is the absolute minimum if you don't want to make an idiot out of yourself. Why cannot we talk about the serious implications of using RFID technology to build this machine instead of posting completely unintelligent jokes in the lines of "Imagine a beowulf cluster of those! It might have 640kB of RAM! Who needs more?" This is stupid at best and insulting at worst. I urge you to start posting insightful, informative or at least interesting posts before it is too late and this discussion is already archived.
What I am personally most concerned about is how disposable are the active and passive (semi-)conductor elements which are printed on this boards. Does anyone have any experience in disposing them? It is not very clear in the article.
"The students at Copenhagen's new IT University will soon be guided by invisible, but talkative digital agents [...] Ignored ghosts can die out completely. [...] - several papers have been published already."
Yes, I think I've read one of those papers.
This lawsuit is only a PR stunt in order to distract attention from today's SCOX 1Q statement. So let me post a short summary:
The SCOX 1Q seems to be highly correlated with SCOX IQ --- i.e. it totally scox.