Command line gives the power to automate different processes over multiple files in reusable fashion.
Example usecases#
- Resize images and create panels of images Image Manipulation
 
- Join, split or summarize tables/text files sed
 
- Convert video from one format to another, extract audio etc.ffmpeg
 
- Search for text in pdf files. papers-tools
 
- Download video and audio from youtube yt-dlp
 
Shutdown your pc after given time in seconds#
open cmd using Windows key + R type cmd and enter following lin
shutdown -s -t 1800
This will shutdown the computer in 30 minutes
Running wsl installed utilities from gibash#
The number of packages which could be installed through gitbash is limited.
To use all the packages available to ubuntu you can install them in wsl and then run them from the gitbash.
Run manually from gitbash#
wsl pdfgrep -in YAP Zanconato_2015
This runs the pdfgrep installed in wsl.
Add alias to the utility you want to run#
open ~/.bashrc
add
alias pdfgrep="wsl pdfgrep"
Save ~/.bashrc and source ~/.bashrc
 
 
  
  
    download as pdf
How to set up infrastructure for ChIP-seq analysis using the Biostars Handbook 2nd edition according to Ming Tangs Guide.
Setting up the folder structure Go to the directory for ChIP-seq with your analysis
cd ~/work/ChIP-seq_<analysis-name> mkdir {data,results,scripts,software} mkdir -p results/{bams,peaks,fastqc,motifs} cd data Download data Get the annotation list from the sra run selector IDs.txt Prefetch and convert files to fastq Go into the ~/work/ChIP-seq_/data
time parallel -j 10 'prefetch {}' :::: IDs....
   
  
  
 
  
  
    Remote desktop Remote desktop can be used to not only work on the remote computer, but also copy clipboard and normal files between the remote computer and your local computer
Change settings in the connection Remote Desktop Menu Select “More” in Local Resources Enable Local Discs Locate your local drives File Explorer Sidebar File Explorer Sidebar - detail WSL2 current setup: Name, volumes, environments The WSL2 for bioinformatics is available as “Ubuntu” from the Start menu...
   
  
  
 
  
  
    .bashrc # set case insensitivity for the terminal bind "set completion-ignore-case on" # set vim motions on set -o vi .vimrc " set numbering of lines to relative set relativenumber " set formatoptions-=r " set textwidth=80 " if you want to reformat the document, go to start of document and type gqG " set moving up and down centered on the screen nnoremap <C-d> <C-d>zz nnoremap <C-u> <C-u>zz " set the cursor in different modes to be different let &t_EI ="\e[2 q" " block in edit mode let &t_SI ="\e[1 q" " blinking block in insert mode let &t_SR ="\e[3 q" " block in replace mode " set leader to space let mapleader = " " " clear all registers command!...
   
  
  
 
  
  
    Extracting relevant columns from csv and tab delimited files.
Download as a pdf
Exemplary workflow for quick look of papers from pubmed “similar or cited by” Download the citation/similar articles in csv format from pubmed Check the number of lines in the file wc -l file.csv See the names of columns of the file csvcut -n file.csv Create an output for a quick visual check with title and doi, most recent first Option 1: for the output in terminal, comma separated...
   
  
  
 
  
  
    Stream editor (sed) edits text files without opening them.
Most often, the editing would be a replacement of one character or word by another. This way a delimiter of a csv file can be changed from comma to semicolon, name of a person can be replaced throughout the text. But that is just a beggining; sed has much more to offer:
The “word” can be a regular expression making it super flexible The lines where this replacement will be done, can be specified by their line number, range, or content Taken togehter, sed helps to delete, replace, and append characters, words, lines or whole files....
   
  
  
 
  
  
    How to manage versions of documents and scripts from the command line. What is a work tree, staging, and commiting?. How can I go back to a previous version of a file? How to branch to test new variant without losing the functional version, how to tag the version. How to push to GitHub from the command mode using ssh authorization.
Resource ProGit book link first three chapters are sufficient....
   
  
  
 
  
  
    Command line utility ffmpeg, dedicated to different transformations of video, is one of the tools which genuinly feel like magic.
ffmpeg download link can do a lot, so it is no surprise that the documentation is overwhelming.
Below are some usecases so that I do not have to search for them again and again.
Dowload this document as a pdf
Use cases Convert between formats This probably cannot be easier using ffmpeg...
   
  
  
 
  
  
    Setting in .bashrc awk defaults to working with whitespace, not with commas, better ot set the comma as an field separator, and otuput field separator and name this modification awkc.
Add this to ~/.bashrc
# make a csv specific awk alias awkc='awk -F, -v OFS=,' Split a csv file into multiple files based on 7th column awk -F',' 'NR==1{h=$0; next} { f = $7 ".csv" if (!(f in seen)) { print h > f seen[f] } print >> f }' input....
   
  
  
 
  
  
    🔁 Restore Xubuntu SSD Backup using Macrium Reflect (Windows) This guide explains how to restore a full disk backup of your Xubuntu SSD that was created using Macrium Reflect Free. This is ideal for recovering or migrating your Linux installation (e.g. from backup to a new drive).
🧰 Requirements ✅ A previously created .mrimg backup image (e.g. stored on D: drive) ✅ The drive you want to restore (target SSD) ✅ Macrium Reflect Free installed ✅ Optional: USB drive (to create recovery media if restoring OS disk) 🧪 Step-by-Step Restoration 1....
   
  
  
 
  
  
    Make a panel montage -label %f -geometry 400x300+4+4 -tile 2x3 *.jpg output_panel.jpg This will make a panel (two columns, three rows) where each image is 400x300pxs big with 4 pxs spacing in horizontal and vertical axis, name of each file will be under the image
Resize images Crop to fit 1920 to 1080 no distortion magick mogrify -path output -resize 1920x1080^ -gravity center -extent 1920x1080 *.jpg path output → saves processed images in a new folder called output resize 1920x1080^ → scales so the shorter side matches 1080p, without stretching gravity center -extent 1920x1080 → crops excess from the center so every image is exactly 1920×1080 Converting rgb tif files to cmyk files Looks power point is not able to export tiff into CMYK, only RGB...