(새 문서: 분류: 파일시스템 ==개요== ;함수 disk_used_space() ==PHP== 분류: PHP {{참고|PHP disk_used_space()}} <syntaxhighlight lang='php' run> <?php echo disk_free_space(...) |
(→Bash) |
||
(같은 사용자의 중간 판 3개는 보이지 않습니다) | |||
2번째 줄: | 2번째 줄: | ||
==개요== | ==개요== | ||
;함수 disk_used_space() | ;함수 disk_used_space() | ||
==Bash== | |||
[[분류: Bash]] | |||
{{참고|Bash disk_used_space}} | |||
<syntaxhighlight lang='bash' run> | |||
df --block-size=1 --output=used / | sed 1d | |||
</syntaxhighlight> | |||
==Go== | |||
[[분류: Go]] | |||
{{참고|Go disk_used_space}} | |||
<syntaxhighlight lang='go' run> | |||
package main | |||
import ( | |||
"fmt" | |||
"golang.org/x/sys/unix" | |||
) | |||
func main() { | |||
var stat unix.Statfs_t | |||
unix.Statfs("/", &stat) | |||
fmt.Println((stat.Blocks - stat.Bavail) * uint64(stat.Bsize)) | |||
} | |||
</syntaxhighlight> | |||
==PHP== | ==PHP== | ||
8번째 줄: | 34번째 줄: | ||
<syntaxhighlight lang='php' run> | <syntaxhighlight lang='php' run> | ||
<?php | <?php | ||
echo | echo disk_total_space("/")-disk_free_space("/"); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
2023년 2월 26일 (일) 17:42 기준 최신판
1 개요[ | ]
- 함수 disk_used_space()
2 Bash[ | ]

Bash
Copy
df --block-size=1 --output=used / | sed 1d
Loading
3 Go[ | ]

Go
Copy
package main
import (
"fmt"
"golang.org/x/sys/unix"
)
func main() {
var stat unix.Statfs_t
unix.Statfs("/", &stat)
fmt.Println((stat.Blocks - stat.Bavail) * uint64(stat.Bsize))
}
Loading
4 PHP[ | ]

PHP
Copy
<?php
echo disk_total_space("/")-disk_free_space("/");
Loading