Tag Archives: bash

Add time stamp to commands in linux history

Some times we need to know at what time someone executed a command. We can add the time stamp to the commands displayed in the history. echo ‘export HISTTIMEFORMAT=”%d/%m/%y %T “‘ >> ~/.bash_profile ; source ~/.bash_profile Then type history command and … Continue reading

Posted in HOWTO, TIPS & T RICS, Uncategorized | Tagged , , | Leave a comment

String manipulation tricks in bash

In some cases we have to modify the strings in a bash variable. Lets say : There are many files inside $(pwd)  with name as  a_ver10, b_ver10, c_ver10. We have to modify them back to a,b,c respectively. This below bash … Continue reading

Posted in HOWTO, SCRIPTING, TIPS & T RICS, TUTORIALS, Uncategorized | Tagged , | Leave a comment

Creating simple progress bar in shell / Python

Progressbar indicates if certain tasks are getting executed and when they completed. In bash oneliner: printf “Starting [“;for num in $(seq 50);do printf “#”;sleep 0.5;done;printf “] Successfull” In Python: sys.stdout.write(“Starting Operation[“) for d in range(60): sys.stdout.write(‘#’) sys.stdout.flush() time.sleep(0.50) sys.stdout.write(“]Stoping Operation”) … Continue reading

Posted in HOWTO, Programming, SCRIPTING, TIPS & T RICS, TUTORIALS, Uncategorized | Tagged , , | Leave a comment