devops-exercises/exercises/shell/solutions/files_size.md
2021-11-07 17:54:06 +02:00

18 lines
247 B
Markdown

## Files Size
### Objectives
1. Print the name and size of every file and directory in current path
Note: use at least one for loop!
### Solution
```
#!/usr/bin/env bash
for i in $(ls -S1); do
echo $i: $(du -sh "$i" | cut -f1)
done
```