Ctrl + D
*****************************************************************************************
Show Printer Queue
# lpq
*****************************************************************************************
Show Disk Quota
# quota
*****************************************************************************************
Show free space in disk
# df -h -T
*****************************************************************************************
Show total disk space used in the current directory
# du -ch | grep total
*****************************************************************************************
Show disk space used by files in the current directory ordered by size
# du -ah | sort -n
*****************************************************************************************
Web Browser in text/console mode
# links
*****************************************************************************************
Generate text file from a Man Page
#man foo | col -b > foo.txt
*****************************************************************************************
Show only executable files in the current directory
#ls $(file * | grep ELF | cut -d: -f 1)
*****************************************************************************************
Multipart compression using Tar
Compress
# tar -c -M -L 1000 -f parte-01.tar -f part-02.tar -f part-03.tar arquivo.iso
Descompress
# tar -x -M -f parte-01.tar -f part-02.tar -f part-03.tar
*****************************************************************************************
Change Print priority
http://docs.sun.com/app/docs/doc/819-7355/printadmin-30451?l=ru&a=view
Take a look in the print requests IDS you want to change priority.
# lpstat
Change the priority of the print request.
# lp -i request-id -H change-priority
*****************************************************************************************
Join PDF files using GhostScript
# gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=finished.pdf file1.pdf file2.pdf
*****************************************************************************************
Remove/Cut margins out of a PDF files
# pdfcrop --margins 10 input.pdf output.pdf
# pdfcrop --margins '5 10 5 20' --clip input.pdf output.pdf
*****************************************************************************************
Mount ISO/Disk Image
sudo mkdir /mnt/disk
sudo mount -o loop imagem.iso /mnt/disk
*****************************************************************************************
Search string using Vi, Less and Man pages
start searching string : /
*****************************************************************************************
Play DVD from ISO/Disk Image using Mplayer
# mplayer dvd://1 -dvd-device imagem.iso
PS: 1 refers to the first title in disk
*****************************************************************************************
Search files that contains a string
grep -slir "text to find" *
The -l make it to only show file names where occurences of the string exists (instead of showing each line where the string appears), the -i make search case insesitive, and the -r force recursive search in subdirectories.
*****************************************************************************************
Running the Filezilla trough a ssh tunnel (FTP GUI through ssh)
ssh -D 1024 nome_usuario@gate.ifi.unicamp.br
click in menu editar> Configurações
click in proxy genérico
in Porta de proxy colocar 1024
now go the menu Arquivo>Gerenciador de sites
Criar um novo site
colocar o host neste exemplo quero acessar arquivo da maquina ams na rede ifi.unicamp.br
Host= ams.ifi.unicamp.br
Tipo de Servidor= SFTP
Usuario= nome_de_usuario
Senha=senha de_usuario
clicar em OK
Este é o passo manual agora vai o script que executa tudo (Deve se ter o Site Criado neste exemplo o nome sera IFGWSITE)
#!/bin/bash
gnome-terminal -x bash -c "ssh -D 1024 trmasaki@gate.ifi.unicamp.br"
~/programas/loadfilezilla.sh
"loadfilezilla.sh"
#!/bin/bash
sleep 7
filezilla -c "0/IFGWSITE"
*****************************************************************************************
Copy and Paste in Vi
press the key v to start selecting
move the cursor to the end of the text you want to, and then press d to cut
or press y to copy
*****************************************************************************************
programs for terminal
cmus e mpd: to play musicc
mc: to navigate in files
gpm: to use the mouse
screen: to have multiple screens in the same terminal, and to keep sessions runnig after disconnecting
screen-profile: to choose screen profiles in ubuntu
*****************************************************************************************
Connect to Wi-fi/Wireless using command line
$ sudo iwlist eth1 scan
$ sudo iwconfig eth1 essid "bestcoffee"
$ sudo dhclient eth1
$ sudo iwconfig eth1 essid any # any is a keyword, not the name of an ESSID.
$ sudo iwconfig eth1 key s:password # translates to the hex for me.
$ sudo iwconfig eth1 key ACDB-1234-1234-EFG2
Log in ssh an reopen screen
ssh -t raXXXXXX@ssh.students.ic.unicamp.br screen -RR
*****************************************************************************************
Open remote files in emacs (http://www.gnu.org/software/emacs/manual/html_node/emacs/Remote-Files.html)
C-x C-f
/host:filename
/user@host:filename
/user@host#port:filename
/method:user@host:filename
/method:user@host#port:filename
/ftp:user@host:filename
Examples
/ssh:raXXXXXX@ssh.students.ic.unicamp.br:filename
or
/ssh:raXXXXXX@ssh.students.ic.unicamp.br: [enter]
para navegar nas pastas.
*****************************************************************************************
Execute the .bashrc file
. ~/.bashrc
or
source . ~/.bashrc
*****************************************************************************************
Turn off the computer after executing a processs
Give permission to turn off the pc, by non-root user
chmod u+s /sbin/halt
chmod u+s /sbin/reboot
Example:
p1=$!
wait $p1
halt
# wget http://www.uol.com.br/jogo.zip
[Ctrl + z]
# bg
# ps
PID TTY TIME CMD
5876 pts/0 00:00:00 bash
11415 pts/0 00:00:00 wget
# wait 11415; halt
*****************************************************************************************
Go back to previous directory
Example
/home/masaki/Documentos# cd /usr/src/linux
/usr/src/linux# cd -
/home/masaki/Documentos# pwd
/home/masaki/Documentos
*****************************************************************************************
Multiple window Terminal for Gnome
You can track the latest stable release by adding the following to /etc/apt/sources.list:
deb http://ppa.launchpad.net/gnome-terminator/ubuntu intrepid main restricted universe multiverse
Then run sudo apt-get update && sudo apt-get install terminator.
Split window Ctrl+Shift+o , Ctrl+Shift+e
Switch windows Alt+esq,Alt+dir,Alt+cima,Alt+baixo.
*****************************************************************************************
Auto completion in Vi and Emacs
Ctrl+n in Vi
Alt + / in Emacs
*****************************************************************************************
Compare contents of directories
vimdiff <(ls
To close vimdiff
:qa
****************************************************************************************
Get the Pid of a process by the name
"pidof"
kill -USR1 `pidof Xephyr`
****************************************************************************************
Create parent directories recursirvely
. ..
mkdir -p a/b/c/d
find .
.
./a
./a/b
./a/b/c
./a/b/c/d
****************************************************************************************
How to dowload a whole full web site from terminal
wget -nd -r -l1 http://www.uol.com.br/blabal
-nd: para nao criar subdiretorios (ex. não www/uol/com/br/blabla/arquivos e sim /arquivos)
-r: baixar todos os arquivos da paginas e seguir links
-l1: não seguir mais que um nivel na recursao de links
Log in text mode (Ctrl+Alt+F1), and start another Xwindow sesion
xinit -- :1
No terminal de segurança
$ mkdir /tmp/seu_login
$ HOME=/tmp/seu_login
$ startkde
Real Transparency Real with Compiz
Va em Gerenciador de configuracoes do CompizConfig
Clique em Opacidade, Brilho e Saturacao
Ai em Definicoes especificas de janelas adicione as seguintes janelas
popupmenu | 70 = Menu do botao direito
dropdownmenu | 84 = Menu do Gnome
yakuake | 56 = Yakuake Terminal Estilo Quake (Esta dica é para ter o yakuake transparente no Gnome, no KDE ja funciona normalmente)
feito isto edite o perfil para transparencia do yakuake desejada.
.myenv
##echo "Seja Bem Vindo $USER"
alias ls='ls -CF --color'
Encontrar arquivos
find / -size +20480000c -exec du -h {} \;
find / -type f -size +20000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'
find /path -size +1048576 -exec ll {} \;
find {/path/to/directory/} -type f -size +{size-in-kb}k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'
$ find . -type f -size +50000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'
find {/path/to/directory} -type f -size +{file-size-in-kb}k -exec ls -lh {} \; | awk '{ print $8 ": " $5 }'
find . -type f -size +10000k -exec ls -lh {} \; | awk '{ print $8 ": " $5 }'
find $HOME -size -500b
The 10 bigger files in directory
$ ls -lS | head +10
$ ls -lSr | tail -10
SSH tunnel
ssh -f <user>@<middle-machine> -L <locahost-port>:<destination-machine>:<destination-port> -N
SSH tunnel
ssh -f <user>@<middle-machine> -L <locahost-port>:<destination-machine>:<destination-port> -N
No comments:
Post a Comment