You are here

Mini tips how to

  • Recursive touch 
    Touch a bunch of directories recursively. All the directories and their contents (To re-stamp time on all files)

                $ find DIR | xargs touch

  • Redirecting Standard Error 
    Redirecting errors when compiling,the number 2 represents the standard error output stream,
    1 represent standard output.

                $ make  > output.txt 2>&1

  • Command Substitution 
    To use command substitution, enclose any command that generates output to standard output 
    inside parentheses and precede the opening parenthesis with a dollar sign, $(command). 
    It is handy for using the output of one command as an argument to another command.

                $ rpm -ql $(rpm -qa | grep httpd)

  • Using for Loops from the Command Line
    For small loops it can be a great time saver. Example: A simple loop to make a 
    backup copy of all the files in a directory:

              $ for file in * ; do cp $file $file.bak; done