Dicas boas…
mkdir -p /a/b/c/d
Bem melhor que uma por uma…
mkdir -p project/{lib/ext,bin,src,doc/{html,info,pdf},demo/stat/a}
Rox..
comando1 && comando2
comando1 || comando2
Procuris: [IRC antoszka rxKaffe]
du -sch /* du -h --max-depth=1
Substituir comando:
^texttosobstitute^sobstitution
apt-get updatke ^updatke^update (or simpler: ^tk^t). !$ // ultimo comando
cp -Rp dir1 dir2 // Cópia árvore preservando perm/own/timestamp
ln -s arquivo link // links saves the world -symbolic
vmstat 3 // segundos
time command // Tempo execução
echo 'wget url' | at 01:00 // Faz um download da url à 01:00AM
df -h // Mostra utilização de filesystems
dd if=/dev/sda1 of=/backup/ // Disk duplicate (if/of input/output file)
tar cjvf - documentos/ | split -b 695m - arquivo_
tar cvfz $name *
tar -c pasta > arq.tar tar -cvf arq.tar arq1 arq2 tar -cvf /dev/fd0 /dir1/* tar -cvMf /dev/fd0 /dir1 /dir2/subdir /dir3 tar -c -v -f arq.tar *.ext tar cwf arq.tar pasta tar -czvf /pasta/arq.tgz * tar czwf arq.tar.gz -C /dir1 arq1 -C /dir2 arq2 arq3 tar -rf arq.tar arq* tar -tf arq.tar tar -xv -f arq.tar tar xvMf /dev/fd0 tar xf arq.tar pasta/arq1 tar xzvf /pasta/subdir/arq.tar.gz tar -xzwf arq.tgz
tail -f
tail -50
less textfile // 'q' sair
more textfile
sed '/ *#/d; /^ *$/d' file // Remove comentários e linhas em branco
sed 's/string1/string2/g' file // Substitui string2 por string1
tr -d '\r' < file // converte arquivo texto DOS para unix
cd - // volta para o diretório anterior
cd // vai para o diretório home
cd dir && command // vai , executa , retorna
grep -r String /usr/share/doc/apache/manual/
ls -rt // classificados por timestamp
ls -rS // classificados pelo tamanho
find ~ -name *.txt
find -name '*.[ch]' | xargs grep -E 'search string' Procura em *.c and *.h por "search string" no diretório corrente e abaixo
find -type f | xargs grep -E 'search string' Procura em todos os arquivos regulares por "search string" no diretório atual e abaixo
find -type f -maxdepth 1 | xargs grep -E 'search string' Procura em todos os arquivos regulares por "search string" no diretório atual
find ~ -mmin -90
Só arquivos:
find ~ -type f -mmin -90
find ~ -type f -mtime +1825 | xargs -r ls -l
-r pra nao mostrar tudo caso nao haja resultados.
locate 'file*.txt' Pesquisa indexada por arquivos no sistema
slocate 'file*.txt' Pesquisa indexada por arquivos no sistema, segurança / performance
whereis command Localiza binários, fonte, e arquivos de man page do comando
which command Mostra o caminho completo do comando
$ls -FlAt | head ou $ls -lart
$find / -mtime 1 ou pra meia-noite $find / -daystart -mtime 0
.bashrc
function ls { command ls -F "$@" } function duff { diff -ur "$@" } export -f duff
fusiont:~# cat /etc/squid/squid.conf | sed '/ *#/d; /^ *$/d'
$ egrep -v "^#|^$" [arquivo.conf_original] > [arquivo.conf_descomentado]
Pega soh oq nao tem # ..
sudo apt-get mrxvt
~/.Xdefaults mrxvt.font: 9x15 mrxvt.geometry: 100x30 mrxvt.reverseVideo: True mrxvt.loginShell: True mrxvt.scrollbarRight: True mrxvt.scrollbarStyle: rxvt mrxvt.bottomTabbar: True mrxvt.saveLines: 1500 mrxvt.visualBell: True Mrxvt.macro.Shift+Left: GotoTab -1 Mrxvt.macro.Shift+Right: GotoTab +1
Some tips:
Moves the world
scp file user@host
scp user@host:/folder/file .
ssh-keygen -t dsa
(~/.ssh/id_dsa.pub) blank pass
scp ~/.ssh/id_dsa.pub ceo@macromates.com:
mkdir .ssh # if it's not already there cat id_dsa.pub >>.ssh/authorized_keys rm id_dsa.pub # cleanup
Host mm HostName macromates.com User ceo
Software: zssh
~/.bashrc alias ssh=zssh
When you are on the remote machine just press CTRL-Space to go into interactive mode (very much like FTP). To send a file use this:
sz -e <file>
The -e option works around non 8-Bit clean terminals. You only need the lrzsz and ssh packages installed on the remote machine.
# dmidecode --type memory
http:wiki.splitbrain.org/tutorials http:wiki.splitbrain.org/linuxutils
http://www.pixelbeat.org/cmdline.html
http://www.comptechdoc.org/os/linux/usersguide/linux_ugbasics.html
http:gentoo-wiki.com/TIP_Recently_Changed_Files http:www.hcidata.info/find.htm
http://macromates.com/blog/2005/subversion-support-and-ssh-key-pairs/