Linux Classes
Share This With a Friend  
LINUX CLASSES - LINUX COMMANDS

What Does The Echo Command Do?

Is There an echo in Here?

The echo command displays a message on the screen and is primarily useful for programmers writing shell scripts (see "Linux Programming"). But anyone can use echo to show the value of environment variables. The echo command displays a message on the screen and is primarily useful for programmers writing shell scripts (see "Linux Programming"). But anyone can use echo to show the value of environment variables. Here are some examples:

echo $PATH
/usr/bin:/usr/local/bin
echo My name is $USER - Home directory=$HOME.
My name is hermie - Home directory=/home/hermie.

The echo command is very similar to the DOS command of the same name, except that the DOS echo command cannot display environment variables--it just displays a message.

Previous Lesson: Date and Time
Next Lesson: Spell Checking

[ RETURN TO INDEX ]


   

Comments - most recent first
(Please feel free to answer questions posted by others!)

mohit saini     (25 Feb 2013, 18:00)
i want to use my computer(linux) , by programe made by me, in a file , and then i want to run that code, then i want that computer work according that code , so what should i do ?, i want to learn that,
have u any tutorial about it ??? plzzz send me on my email
[email protected]
Darwin     (20 Dec 2012, 06:01)
Bash shell
echo * <-- list files and dir names (unformatted)
echo /* <-- idem root directory
echo */ <-- idem only subdir names
echo ../* <-- idem parent directory
----
x=*
echo $x <-- list file an dir names
echo "$x" <-- prints *
---
x='/* this is a comment */'
what happen when:
echo $x
I get erratic output
Sometimes is:
/* this is a comment */
But anothers is:
[list of root directory file names] this is a comment [list of subdirs]
And a problem when:
sed -n /$x/p file
zeanab     (05 Nov 2012, 21:35)
Hi,I have a problem, really I want to write implementation of 'echo' command with c?
please help me,Thankes
azureght     (26 Oct 2012, 11:35)
hi, i had the urge to point out the obvious, since no one did:
The first paragraph (/linux-echo-command.html) contained redundant information in form of ...repetitions!
Kiara1984     (06 Sep 2012, 17:28)
Hahah, My laptop crashed when I was browsing lowfatlinux.com last time I was here. And for the past 2 months I have been looking for this wephorum, so thankful I located it once again! :D
ranganath     (22 Jan 2012, 12:31)
can i kmow what work the command echo -n can do???
bahare     (04 Jan 2012, 03:03)
If u press a keyboard, 1 code is created by system & it can realize which key is pressed. In reality one person presses 1 key another place & I can realize its key with finding the code by remote terminal.
Can u help me????
Regards
nasreen     (04 Dec 2011, 03:04)
If you want to add a line to txt file you can use echo
echo 1111111111>>d/myfiles/mytextfile/data.txt
I utilized ..it worked
iphone 5     (10 Sep 2011, 10:14)
Hi there, I believe your website may very well be possessing browser compatibility concerns. When I appear at your site in Safari, it seems great but when opening in Net Explorer, it's some overlapping. I just needed to provide you with a swift heads up! Other then that, wonderful weblog!
DCB     (08 Sep 2011, 09:30)
Your first 2 sentences are duplicated on this page.
Majed     (10 Aug 2011, 07:26)
i thought you typed the first sentence by mistake
praful     (01 Jun 2011, 04:36)
how many charactor i can write
rahul kaninde     (31 Jan 2011, 05:49)
yes how simple.......echo
rahul k     (24 Jan 2011, 07:29)
i like the web site
Murat     (27 Dec 2010, 10:59)
This is very graet article about vi editor.thanks so much.
systemnotes     (01 Dec 2010, 20:42)
The DOS echo does display environment variables if you use %VAR_NAME%, as in: %PATH%. In unix/linux use the $, as in $PATH.

C:\>echo windir = %windir%
windir = C:\WINDOWS

C:\>
Bob Rankin     (07 Oct 2010, 09:59)
Yes, that was pretty funny. I don't even remember doing it! Yes, that was pretty funny. I don't even remember doing it!
Echo     (06 Oct 2010, 11:44)
I thought that was pretty hilarious how you echoed that first sentence on the subject of the echo command.
Gopi     (04 Jul 2010, 23:21)
details about asp.net with sql database and its screen shots
neethu     (03 Mar 2010, 23:29)
how to blink a text using echo.I tried
echo -e "\033[5m hii"
bt didnt worked

I welcome your comments. However... I am puzzled by many people who say "Please send me the Linux tutorial." This website *is* your Linux Tutorial! Read everything here, learn all you can, ask questions if you like. But don't ask me to send what you already have. :-)

NO SPAM! If you post garbage, it will be deleted, and you will be banned.
*Name:
Email:
Notify me about new comments on this page
Hide my email
*Text:
 
 


Ask Bob Rankin - Free Tech Support


Copyright © by - Privacy Policy
All rights reserved - Redistribution is allowed only with permission.