文章目录
读取当前页面下的文件夹名称并生成list
for i in GSE*; do echo $i >> final.list; done
能够生成一个list,包含以GSE开头的文件夹名称的list。
根据list并行多个文件并提交
批量提交一般应用于大型服务器任务,如果你的服务器是slurm提交,照抄以下代码即可,如果不是slurm提交,可以在生成之后用类似bash 1.sh & bash 2.sh批量运行。
首先你需要有三个文件:
job_temp.sh是你想要并行的脚本,而makejob.sh可以创建并行,final.list作为参数被makejob.sh读取并传入job_temp.sh。
这里我们一起看一看两个代码
job_temp.sh:
#!/bin/bash
cd INPUT
”你的脚本内容“
你只需要把你要执行的脚本放入""位置即可,路径要写对哦。
makejob.sh:
#!/bin/bash
cat final.list | while read input; do sed -e s/INPUT/${input}/g job_temp.sh > job_${input}.sh; sbatch job_${input}.sh; done
这个代码能够将list中每一个input都当作不同的输入,通过sed传递,将job_temp.sh中的每一个INPUT都用input代替,并生成job_${input}.sh,最后用sbatch批量提交。
批量删除每一个文件夹下的文件
同样还是需要一个文件夹的list。
#!/bin/bash
cat final.list | while read input #读取list,传入管道
do
cd ${input}
rm -rf !(fileA|fileB)
cd ..
done
当然也可以同时保留三个,类似这样。
cat paired.list | while read input
do
cd riceGSE/PAIRED/${input}
rm -rf !(SRR_Acc_List.txt|fastq|SRR)
cd ../../..
done
查看内核版本
cat /proc/version
查看当前目录下文件夹大小
du -lh --max-depth=1
查看当前目录下文件个数
cat final.list | while read input; do cd ${input}; echo ${input}; ls -l | grep ^- | wc -l ; cd ..; done
使用cGroup限制高占用用户
ubuntu使用cgroup: link.
将dash改为bash
exec bash
更改pip的默认缓存位置
pip config set global.cache-dir "/mnt/data/bowen/.cache/pip"
rsync 传输文件
sudo rsync -v --no-inc-recursive --info=progress2 -a /mnt/md0/ .