LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-30-2008, 05:47 PM   #1
hbar
Member
 
Registered: Dec 2007
Location: Canada
Distribution: Debian
Posts: 50

Rep: Reputation: 15
Most useless command ever


Try entering this in a shell:
Code:
yes
(use ctrl + C to stop)
What on earth is the point of this program??
 
Old 05-30-2008, 05:56 PM   #2
grizly
Member
 
Registered: Nov 2006
Location: Melbourne Australia
Distribution: Centos, RHEL, Debian, Ubuntu, Mint
Posts: 128

Rep: Reputation: 16
Quote:
yes | rm -rf ~/
will answer yes to "do you want to delete ###" if your rm command is an alias to rm -i etc..

you can use it to answer "yes" automatically, and it saves keystrokes in that before, you had to type:
Quote:
echo yes | rm -rf ~/
So, not so useless!

PS: Above commands will empty home directory of currently logged in user.
 
Old 05-30-2008, 07:15 PM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Is this a contest.......

Try this one:
echo "" | sed "" | more

At least the "yes" command actually DOES something!
 
Old 05-30-2008, 07:55 PM   #4
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 4,070

Rep: Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897
I can certainly see testing situations in which this would be exactly what I want, replacing the old Bic Biro top trick (in getting a continuous stream of data down a serial link, you could use this, and that's exactly what you'd want to do when getting two computers to talk to one another while sorting out start bits, stop bits, parity...).

While its also true that I haven't felt the need to do that for years and I've never actually used this command, I'm glad to now know that it exists. Just hope that I remember when I do need it.
 
Old 05-30-2008, 08:02 PM   #5
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Here is a common usage of the yes command that I use routinely:
mv <dir>/file* <dest_dir>/ -i < <(yes n)
cp <dir>/file* <dest_dir>/ -i < <(yes n)

This will prevent overwriting files in the destination without having to manually enter "n".
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Useless divorce3 Fedora 4 07-10-2005 03:40 AM
probably useless Deno521 Linux - General 7 09-28-2004 07:20 PM
HELP: eth timed out message makes command line useless lsgko Linux - Newbie 2 12-03-2003 10:18 AM
grab - Simply a useless bash script to take a screen shot; Required command: import micxz Programming 2 10-08-2003 07:59 PM
Please help me I am useless! linux_newguy Linux - Newbie 7 02-26-2002 08:09 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration