Tamanho dos diretórios: mudanças entre as edições
Ir para navegação
Ir para pesquisar
(→script) |
Sem resumo de edição |
||
Linha 1: | Linha 1: | ||
<syntaxhighlight lang=text line=1 highlight=2> | <syntaxhighlight lang=text line=1 highlight=2> | ||
$ du -sk * 2>/dev/null | sort -n -k1 | awk '{ if ($1 < 1024) print "\033[1;32m"$1"K " $2 "\033[0m" ; else if ( $1 >= 1024 && $1 <= 1048576 ) print "\033[1;34m"$1/1024"M " $2"\033[0m"; else if ($1 > 1048576 ) print "\033[1;31m"$1/1048576"G " $2"\033[0m"}' | $ du -sk * 2>/dev/null | sort -n -k1 | awk '{ if ($1 < 1024) print "\033[1;32m"$1"K " $2 "\033[0m" ; else if ( $1 >= 1024 && $1 <= 1048576 ) print "\033[1;34m"$1/1024"M " $2"\033[0m"; else if ($1 > 1048576 ) print "\033[1;31m"$1/1048576"G " $2"\033[0m"}' | ||
$ ls -1a | while IFS=\; read obj ; do du -sk $obj 2>/dev/null;done | sort -n -k1 | awk '{ if ($1 < 1024) print "\033[1;32m"$1"K " $2 "\033[0m" ; else if ( $1 >= 1024 && $1 <= 1048576 ) print "\033[1;34m"$1/1024"M " $2"\033[0m"; else if ($1 > 1048576 ) print "\033[1;31m"$1/1048576"G " $2"\033[0m"}' | |||
</syntaxhighlight> | </syntaxhighlight> | ||
=script= | =script= |
Edição atual tal como às 17h37min de 7 de abril de 2022
$ du -sk * 2>/dev/null | sort -n -k1 | awk '{ if ($1 < 1024) print "\033[1;32m"$1"K " $2 "\033[0m" ; else if ( $1 >= 1024 && $1 <= 1048576 ) print "\033[1;34m"$1/1024"M " $2"\033[0m"; else if ($1 > 1048576 ) print "\033[1;31m"$1/1048576"G " $2"\033[0m"}'
$ ls -1a | while IFS=\; read obj ; do du -sk $obj 2>/dev/null;done | sort -n -k1 | awk '{ if ($1 < 1024) print "\033[1;32m"$1"K " $2 "\033[0m" ; else if ( $1 >= 1024 && $1 <= 1048576 ) print "\033[1;34m"$1/1024"M " $2"\033[0m"; else if ($1 > 1048576 ) print "\033[1;31m"$1/1048576"G " $2"\033[0m"}'
script
#!/bin/bash
du -sk * 2>/dev/null | \
sort -n -k1 | \
awk '{ if ($1 < 1024) print "\033[1;32m"$1"K " $2 "\033[0m" ; else if ( $1 >= 1024 && $1 <= 1048576 ) print "\033[1;34m"$1/1024"M " $2"\033[0m"; else if ($1 > 1048576 ) print "\033[1;31m"$1/1048576"G " $2"\033[0m"}'