devops-exercises/exercises/shell/solutions/files_size.md

18 lines
247 B
Markdown
Raw Normal View History

2021-11-07 16:54:06 +01:00
## 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
```