TurboShell command examples
Try these 21 examples with TurboShell on your QNAP NAS. Each output comes from a real run on the lessons' sample files, in a folder like /share/Public/lessons; on your NAS the file names and the results will differ.
Install TurboShell first: Before you start. Then sign in over SSH, go to a folder of your own and type the commands.
Find files and text
Find files by extension
fd -e jpg finds the files with the .jpg extension in this folder and below it; sort puts them in order.
fd -e jpg | sortTerminal
$ fd -e jpg | sort
photos/beach.jpg
photos/cat.jpg
photos/garden.jpgShow a folder tree
tree -h shows the folder structure with the size of each entry.
tree -h photosTerminal
$ tree -h photos
[4.0K] photos
├── [4.1K] beach.jpg
├── [ 900] cat.jpg
├── [2.5K] garden.jpg
├── [ 120] notes.txt
├── [7.1K] trip.mp4
└── [ 15K] wedding.mov
1 directory, 6 filesFind lines in a log
rg -n prints the matching lines with their numbers; -i makes the search case-insensitive.
rg -n -i 'warn|error' nas.logTerminal
$ rg -n -i 'warn|error' nas.log
3:2027-01-04 08:31:12 WARN disk 3 temperature 51
4:2027-01-04 09:02:44 ERROR share Documents is full
6:2027-01-05 02:03:10 ERROR backup stopped: no space
7:2027-01-05 02:03:10 WARN free space below 5 percent
11:2027-01-06 14:20:05 WARN disk 3 temperature 53
12:2027-01-06 18:09:33 ERROR disk 3 read errorSpace and sizes
Sort by the space used
du -ah shows the space each file and folder takes; sort -h orders the sizes from smallest to largest. QTS's own sort has no -h.
du -ah photos | sort -hTerminal
$ du -ah photos | sort -h
4.0K photos/cat.jpg
4.0K photos/garden.jpg
4.0K photos/notes.txt
8.0K photos/beach.jpg
8.0K photos/trip.mp4
16K photos/wedding.mov
48K photosWrite byte counts with G and T
numfmt --to=iec rewrites the first number of each line in powers of 1024, with G and T.
awk 'NR>1 {print $2*1024, $6}' df.txt | numfmt --to=iecTerminal
$ awk 'NR>1 {print $2*1024, $6}' df.txt | numfmt --to=iec
7.3T /volume/data
3.7T /volume/media
932G /volume/fastArchives
Pack a folder with zstd
tar --zstd makes a zstd-compressed archive of photos and lists what is in it. QTS's own tar has no --zstd.
tar --zstd -cf photos.tar.zst photos && tar --zstd -tf photos.tar.zstTerminal
$ tar --zstd -cf photos.tar.zst photos && tar --zstd -tf photos.tar.zst
photos/
photos/beach.jpg
photos/cat.jpg
photos/garden.jpg
photos/notes.txt
photos/trip.mp4
photos/wedding.movMake and test a 7z archive
7zz a makes the archive and 7zz t tests every file in it.
7zz a -bso0 -bsp0 photos.7z photos && 7zz t photos.7z | tail -n 4Terminal
$ 7zz a -bso0 -bsp0 photos.7z photos && 7zz t photos.7z | tail -n 4
Folders: 1
Files: 6
Size: 30920
Compressed: 337Compress an archive and compare sizes
xz -k keeps the original archive; wc -c gives both sizes in bytes.
tar -cf photos.tar photos && xz -k -9 photos.tar && wc -c photos.tar photos.tar.xzTerminal
$ tar -cf photos.tar photos && xz -k -9 photos.tar && wc -c photos.tar photos.tar.xz
40960 photos.tar
344 photos.tar.xz
41304 totalCopies and backups
Copy a folder's contents with rsync
rsync -a copies the contents of photos/ to copy/; --stats reports how many files it copied and their size.
rsync -a --stats photos/ copy/ | grep -E 'files transferred|Total transferred'Terminal
$ rsync -a --stats photos/ copy/ | grep -E 'files transferred|Total transferred'
Number of regular files transferred: 6
Total transferred file size: 30,920 bytesBack up a folder with restic
restic makes an encrypted backup of photos in the folder repo and reports what the latest snapshot holds. Use your own password.
export RESTIC_PASSWORD=example
restic init -q -r repo && restic -q -r repo backup photos && restic -r repo stats latestTerminal
$ export RESTIC_PASSWORD=example
$ restic init -q -r repo && restic -q -r repo backup photos && restic -r repo stats latest
scanning...
[0:00] 100.00% 1 / 1 snapshots, 7 files, 30.195 KiB
Stats in restore-size mode:
Snapshots processed: 1
Total File Count: 7
Total Size: 30.195 KiBCalculate checksums of files
xxhsum prints a checksum for each .jpg file; run it again after a copy and compare.
xxhsum photos/*.jpgTerminal
$ xxhsum photos/*.jpg
236703b780254370 photos/beach.jpg
45d484da9e2a135c photos/cat.jpg
4aa003055ee586d6 photos/garden.jpgData and tables
Align comma-separated fields
column -t -s, splits each line at the commas and lines the fields up in columns.
column -t -s, disks.csvTerminal
$ column -t -s, disks.csv
slot model size_gb temp_c
1 Example HDD A 8000 38
2 Example HDD A 8000 39
3 Example HDD B 12000 53
4 Example SSD C 1000 44Pick values out of a JSON file
jq prints the name and the used share of each volume that is more than 80% full.
jq -r '.[] | select(.used_pct > 80) | "\(.name) \(.used_pct)%"' volumes.jsonTerminal
$ jq -r '.[] | select(.used_pct > 80) | "\(.name) \(.used_pct)%"' volumes.json
Media 93%Query a SQLite database
sqlite3 lists the disks from the hottest to the coolest; -box draws the result as a table.
sqlite3 -box disks.db 'SELECT slot, model, temp_c FROM disks ORDER BY temp_c DESC'Terminal
$ sqlite3 -box disks.db 'SELECT slot, model, temp_c FROM disks ORDER BY temp_c DESC'
╭──────┬───────────────┬────────╮
│ slot │ model │ temp_c │
╞══════╪═══════════════╪════════╡
│ 3 │ Example HDD B │ 53 │
│ 4 │ Example SSD C │ 44 │
│ 2 │ Example HDD A │ 39 │
│ 1 │ Example HDD A │ 38 │
╰──────┴───────────────┴────────╯Read an INI file with Python
python3 reads config.ini with the configparser module of its standard library and prints the section [report].
python3 -c 'import configparser as c; p=c.ConfigParser(); p.read("config.ini"); print(dict(p["report"]))'Terminal
$ python3 -c 'import configparser as c; p=c.ConfigParser(); p.read("config.ini"); print(dict(p["report"]))'
{'title': 'Morning check', 'limit': '90'}Look inside files
See the bytes of a file
hexdump -C shows the bytes in hex, with the printable characters on the right and dots for the others.
hexdump -C config.ini | head -n 4Terminal
$ hexdump -C config.ini | head -n 4
00000000 5b 72 65 70 6f 72 74 5d 0a 74 69 74 6c 65 3d 4d |[report].title=M|
00000010 6f 72 6e 69 6e 67 20 63 68 65 63 6b 0a 6c 69 6d |orning check.lim|
00000020 69 74 3d 39 30 0a 0a 5b 62 61 63 6b 75 70 5d 0a |it=90..[backup].|
00000030 66 6f 6c 64 65 72 3d 62 61 63 6b 75 70 73 0a 6b |folder=backups.k|Identify file types
file reads the start of each file and names its type.
file nas.log disks.csv disks.db volumes.jsonTerminal
$ file nas.log disks.csv disks.db volumes.json
nas.log: ASCII text
disks.csv: CSV ASCII text
disks.db: SQLite 3.x database, last written using SQLite version 3053004, file counter 2, database pages 2, cookie 0x1, schema 4, UTF-8, version-valid-for 2
volumes.json: JSON text dataKeep a version of a file in Git
Git records check.ini in a first commit and shows it in the history.
git init -q notes && cd notes && echo 'limit=90' > check.ini && git add check.ini && git commit -qm 'First check' && git log --onelineTerminal
$ git init -q notes && cd notes && echo 'limit=90' > check.ini && git add check.ini && git commit -qm 'First check' && git log --oneline
ed68266 First checkInteractive programs
Manage files in two panels
mc photos . opens photos and the current folder side by side; F5 copies, F6 moves and F10 quits.
mc photos .Left File Command Options Right ┌<─ /share/Public/lessons/photos ───.[^]>┐┌<─ /share/Public/lessons ──────────.[^]>┐ │.n Name │ Size │Modify time ││.n Name │ Size │Modify time │ │/.. │UP--DIR│Nov 27 09:30││/.. │UP--DIR│Nov 27 22:15│ │ beach.jpg │ 4200│Nov 27 09:30││/home │ 4096│Nov 27 22:15│ │ cat.jpg │ 900│Nov 27 09:30││/photos │ 4096│Nov 27 09:30│ │ garden.jpg │ 2600│Nov 27 09:30││ config.ini │ 70│Nov 27 09:30│ │ notes.txt │ 120│Nov 27 09:30││ df.txt │ 283│Nov 27 09:30│ │ trip.mp4 │ 7300│Nov 27 09:30││ disks.csv │ 123│Nov 27 09:30│ │ wedding.mov │ 15800│Nov 27 09:30││ disks.db │ 8192│Nov 27 09:30│ │ │ │ ││ nas.log │ 534│Nov 27 09:30│ │ │ │ ││ smartctl.txt │ 726│Nov 27 09:30│ │ │ │ ││ volumes.json │ 192│Nov 27 09:30│ │ │ │ ││ words.txt │ 87│Nov 27 09:30│ │ │ │ ││ │ │ │ │ │ │ ││ │ │ │ │ │ │ ││ │ │ │ │ │ │ ││ │ │ │ ├──────────────────────────────────────┤├──────────────────────────────────────┤ │UP--DIR ││UP--DIR │ └──────────────── 1124G / 3152G (35%) ─┘└──────────────── 1124G / 3152G (35%) ─┘ GNU Midnight Commander 4.8.33 (claude-lanes)root@claude-lanes:/share/Public/lessons/photos# 1Help 2Menu 3View 4Edit 5Copy 6RenMov 7Mkdir 8Delete 9PullDn10Quit
Pick a path by typing
fzf narrows the paths from fd as you type; Enter prints the chosen path.
fd | fzf▌ photos/garden.jpg ▌ photos/beach.jpg ▌ photos/cat.jpg 3/16 ──────────────────────────────────────────────────────────────────────── > jpg
Edit a file in the terminal
micro config.ini opens the file in a terminal editor: Ctrl+S saves, Ctrl+Q quits.
micro config.ini1 [report] 2 title=Morning check 3 limit=90 4 5 [backup] 6 folder=backups 7 keep=3 8 config.ini (1,1) | ft:ini | unix | utf-8 Alt-g: bindings, Ctrl-g: help