RSS flow:

Some Bash tips (command line)

Use brackets

    Brackets allow to repeat a text.
    For example:
      echo {voit,piq,ray}ure
    will write voiture piqure rayure.


    This can be very handy for the command line

      cp httpd.conf{,.bak}
    will dopy the httpd.conf file in httpd.conf.bak or
      diff /etc/httpd/conf/httpd.conf{.bak,}
    will do a "diff" command between httpd.conf.bak and httpd.conf files.

Date and Time in a variable

    To put it in a variable date, and time is simple:
      TheDate=`date +"%Y/%m/%d %H:%M:%S"`
    Variable $TheDate will contains date and time.


Go Back