Skip to content

Linux Crafts

Sriranga Kashyap edited this page Feb 21, 2022 · 4 revisions

Look two depth-levels into a tar-gz file

tar --exclude="*/*/*" -tf sub-01_dicoms.tar.gz

Only extract folder of interest from tar file

tar -xvf sub-01_dicoms.tar.gz sub-01/001-AALScout

Zip all folders in a directory into separate tarballs

for i in */; do tar -zcvf "${i%/}.tar.gz" "$i"; done

Remove from PATH

directory_to_remove=/home/${USER}/Github_Projects/hello_world

PATH=:$PATH:PATH=${PATH//:$directory_to_remove:/:}

PATH=${PATH#:}; PATH=${PATH%:}