Tamanho dos diretórios: mudanças entre as edições

De Wiki Clusterlab.com.br
Ir para navegação Ir para pesquisar
(Criou página com '<pre> du -sk * | sort -n -k1 | awk '{ if ($1 < 1024) print $1"K " $2 ; else if ( $1 >= 1024 && $1 <= 1048576 ) print $1/1024"M " $2; else if ($1 > 1048576 ) print $1/1048576"G...')
 
Sem resumo de edição
Linha 1: Linha 1:
<pre>
<syntaxhighlight lang=text line=1 highlight=2>
du -sk * | sort -n -k1 | awk '{ if ($1 < 1024) print $1"K " $2 ; else if ( $1 >= 1024 && $1 <= 1048576 ) print $1/1024"M " $2; else if ($1 > 1048576 ) print $1/1048576"G " $2}'
du -sk * | sort -n -k1 | awk '{ if ($1 < 1024) print $1"K " $2 ; else if ( $1 >= 1024 && $1 <= 1048576 ) print $1/1024"M " $2; else if ($1 > 1048576 ) print $1/1048576"G " $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"}'
</pre>
</syntaxhighlight>
=script=
=script=
<syntaxhighlight lang=bash line=1>
<syntaxhighlight lang=bash line=1>

Edição das 17h21min de 16 de maio de 2021

du -sk * | sort -n -k1 | awk '{ if ($1 < 1024) print $1"K " $2 ; else if ( $1 >= 1024 && $1 <= 1048576 ) print $1/1024"M " $2; else if ($1 > 1048576 ) print $1/1048576"G " $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"}'

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"}'