News

New paper!

Wednesday, August 8, 2018

Linux command cheat sheet


  • Counting the number of files in the current directory: ls -1 | wc -l
  • Dividing a file by column with a specified separator (-d), and returning columns specified (-f): cut -f? -d 'separator' filename (*to choose more than one columns, -f1,2,... works.)
  • Attaching two files side by side: paste file1 file2
  • Check free/available storage space: $ df .
  • Cancel all sbatch jobs in slurm system: $ squeue -u $USER | awk '{print $1}' | tail -n+2 | xargs scancel
  • Cancel all sbatch jobs that are pending (this works for array jobs as well. It won't cancel array jobs that are running already, but will cancel only pending array jobs.): $ scancel --state=PENDING <job_id>