Wednesday, June 9, 2010

For HPC

To view current job status
qstat

To view different queue status in HPC
qstat -g c

To delete a job
qdel jobID

To delete all jobs of a user
qdel -u USERNAME

Sunday, June 6, 2010

linux command

to count file number in a directory
ls -l your/directory/ | wc -l

to count number in a directory
wc -l your_file.txt


directory size in MB
du -sh your/directory/


file size in MB
ls -l | awk '{printf "%s %i %s %s %.3fMB %s %i %s %s\n", $1,$2,$3,$4,$5/1024000,$6,$7,$8,$9}'

Cut (split) a single file in multiple files
perl -n -e '/^pattern/ and open FH, ">output_".$n++; print FH;' input_file
pattern is the text on the basis of which files will be spliced.
other possible methods are -
awk '/^pattern/{close("file"f);f++}{print $0 > "file"f}' input.txt
csplit -k input.txt '/^pattern/' '{99}'


Display file lines
head -15 file_name
It will show first 15 lines of file. By default 'head' will show the first 10 lines

tail -15 file_name
It will show last 15 lines of file. By default 'tail' will show the last 10 lines