Bedtools Installation On A Debian, Ubuntu, Kali, Fedora, Raspbian And MacOS
Install bedtools
-
Debian
apt-get install BEDToolsClick to copy -
Ubuntu
apt-get install BEDToolsClick to copy -
Kali Linux
apt-get install BEDToolsClick to copy -
Fedora
dnf install BEDToolsClick to copy -
Raspbian
apt-get install BEDToolsClick to copy -
macOS
brew install BEDToolsClick to copy
A swiss-army knife of tools for genomic-analysis tasks. Used to intersect, group, convert and count data in BAM, BED, GFF/GTF, VCF format.
How to use bedtools?
Below are few example commands for bedtools that you can use in the terminal.
Intersect two files with respect to the sequences' strand and save the result to {{path/to/output_file}}:bedtools intersect -a path/to/file_1 -b path/to/file_2 -s > path/to/output_fileClick to copyIntersect two files with a left outer join, i.e. report each feature from {{file_1}} and NULL if no overlap with {{file_2}}:bedtools intersect -a path/to/file_1 -b path/to/file_2 -lof > path/to/output_fileClick to copyUsing more efficient algorithm to intersect two pre-sorted files:bedtools intersect -a path/to/file_1 -b path/to/file_2 -sorted > path/to/output_fileClick to copyGroup file {{path/to/file}} based on the first three and the fifth column and summarize the sixth column by summing it up:bedtools groupby -i path/to/file -c 1-3,5 -g 6 -o sumClick to copyConvert bam-formated file to a bed-formated one:bedtools bamtobed -i path/to/file.bam > path/to/file.bedClick to copyFind for all features in {{file_1}}.bed the closest one in {{file_2}}.bed and write their distance in an extra column (input files must be sorted):bedtools closest -a path/to/file_1.bed -b path/to/file_2.bed -dClick to copy
Installation of latest bedtools command is available for Debian, Ubuntu, Kali, Fedora, Raspbian and macOS. You can copy the command for your OS from above and paste it into your terminal. Once you run the command it will download the 2026 latest package from the repository and install it in your computer/server.




