nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

UNIX / Linux echo command examples

This is a discussion on UNIX / Linux echo command examples within the Getting started tutorials forums, part of the Linux Getting Started category; Here are some examples you may find interesting: Display message welcome on screen Code: echo 'Welcome' Write message File deleted ...


Go Back   nixCraft Linux Forum > Linux Getting Started > Getting started tutorials

Register FAQ Members List Calendar Forgotten your password? Mark Forums Read
  #1 (permalink)  
Old 03-14-2007, 02:15 AM
raj raj is offline
Contributors
User
 
Join Date: Jun 2005
Location: Hyderabad
Posts: 151
Rep Power: 4
raj is on a distinguished road
Default UNIX / Linux echo command examples

Here are some examples you may find interesting:

Display message welcome on screen
Code:
echo 'Welcome'
Write message File deleted to a file called /tmp/log.txt
Code:
echo 'File has been deleted' > /tmp/log.txt
Append message File deleted to a file called /tmp/log.txt
Code:
echo 'File has been deleted' >> /tmp/log.txt
Append message and command output on screen
Code:
echo "Today's date is $(date)"
Append message and command output to a file
Code:
echo "Today's date is $(date)" > /tmp/date.txt
More help - just type command
Code:
man echo
__________________
Raj
Linux rulz.
I have never turned back in my life ; I shall not do so today.. haha
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 03-16-2007, 12:51 AM
Senior Member
User
 
Join Date: Dec 2006
Location: /B!n@ry
My distro: openSuSE 10.2
Posts: 127
Rep Power: 0
B!n@ry
Send a message via MSN to B!n@ry
Default

Good work Raj
Keep GOING
__________________
LivE Free 0r DiE
L!nux rul3z aLL
Reply With Quote
  #3 (permalink)  
Old 12-07-2007, 12:20 PM
Junior Member
User
 
Join Date: Dec 2007
My distro: Debian
Posts: 12
Rep Power: 0
virendra is on a distinguished road
Default

echo is a very powerful tool


#env
this command will show
HOSTNAME=viren.com
TERM=xterm
SHELL=/bin/bash
HISTSIZE=1000
KDE_NO_IPV6=1
SSH_CLIENT=10.16.5.139 1885 22
SSH_TTY=/dev/pts/0
USER=root
LS_COLORS=no=00:fi=00:di=00;34:ln=00;36i=40;33:s o=00;35:bd=40;33;01:cd=40;33;01r=01;05;37;41:mi= 01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com =00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00 ;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;3 1:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz =00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00; 31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;3 5:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:
KDEDIR=/usr
MAIL=/var/spool/mail/root
PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
INPUTRC=/etc/inputrc
PWD=/root
LANG=en_US.UTF-8
KDE_IS_PRELINKED=1
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
SHLVL=1
HOME=/root
LOGNAME=root
SSH_CONNECTION=172.16.5.139 1885 172.16.5.235 22
LESSOPEN=|/usr/bin/lesspipe.sh %s
G_BROKEN_FILENAMES=1
_=/bin/env



and then understand what echo can do

like

#echo $PATH
#echo $HOSTNAME
#echo $HISTSIZE
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

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 On
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
unix find out ram usage command charvi Solaris/OpenSolaris 4 04-10-2008 03:22 AM
Unix route command view jerry Solaris/OpenSolaris 3 02-21-2008 02:24 PM
unix ls command raj Getting started tutorials 0 08-20-2007 11:04 PM
UNIX and Linux command for DNS chiku Getting started tutorials 1 04-29-2007 05:36 PM
displaying the executed command then echo the status warren Shell scripting 4 11-29-2006 02:56 AM


All times are GMT +5.5. The time now is 09:23 PM.


Powered by vBulletin® Version 3.7.4 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36