Migrated notes from mdnotes
This commit is contained in:
19
tar without paths.md
Normal file
19
tar without paths.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# 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)
|
||||
Reference in New Issue
Block a user