Archive for the ‘bash’ Category
a bash script launched remotely via ssh does not load the environment, if this is an issue it is necessary to specify –login when calling bash: ssh user@remoteserver.com ‘bash –login life_om/cronodproc’ | mail your@email.com -s cronodproc
Filed under: bash, linux | Leave a Comment
folders are not counted find . -type f | wc -l
Filed under: bash, linux | Leave a Comment
Tags: linux
using gnu find
list all the directories excluding “.”: find . -maxdepth 1 -type d -not -name “.*” find some string in all files matching a pattern in the subfolders (with grep -r you cannot specify the type of file) find . -name ‘*.py’ -exec grep -i pdb ‘{}’ \;
Filed under: bash, linux | Leave a Comment
beginners bash guide
great guide with many examples: http://tille.xalasys.com/training/bash/
Filed under: bash, linux | Leave a Comment
tar quickref
compress: tar cvzf foo.tgz *.cc *.h check inside: tar tzf foo.tgz | grep file.txt extract: tar xvzf foo.tgz extract 1 file only: tar xvzf foo.tgz path/to/file.txt
Filed under: bash, linux | Leave a Comment
command line processing
Very useful summary of many linux command line processing tools (great perl onliners) http://grad.physics.sunysb.edu/~leckey/personal/forget/
Filed under: bash, linux | Leave a Comment
awk made easy
awk ‘/REGEX/ {print NR “\t” $9 “\t” $4″_”$5 ;}’ file.txt supports extended REGEX like perl ( e.g. [:blank:] Space or tab characters ) NR is line number NF Number of fields $n is the column to be printed, $0 is the whole row if it only necessary to print columns of a file it is [...]
Filed under: bash, linux | Leave a Comment