Files
MarkdownNotes/howto - tar without paths.md
chawley 65c434952a Catagorized Notes
Renamed notes to fit categories and be easier to find later: blog, config, howto
2023-04-28 10:31:11 -04:00

19 lines
514 B
Markdown

# tar without paths
[linux - tar - Remove leading directory components on extraction - Server Fault](https://serverfault.com/questions/330127/tar-remove-leading-directory-components-on-extraction)
You want to use the `--strip-components=NUMBER` option of `tar`:
```
--strip-components=NUMBER
```
strip NUMBER leading components from file names on extraction
Your command would be:
```
tar xfz /var/www/site.gz --strip-components=2 -C /tmp
```
[Reference](https://serverfault.com/a/330131)