Skip to content

Instantly share code, notes, and snippets.

@afeijo
Created June 15, 2012 21:55
Show Gist options
  • Save afeijo/2938893 to your computer and use it in GitHub Desktop.
Save afeijo/2938893 to your computer and use it in GitHub Desktop.
Feijo linux notes
#duplicar DVD
k9copy
#medir uso da conexão
bmon
# contar arquivos
ls -R | wc -l
# atualizar postfix aliases
cd /etc/postfix;sudo postmap virtual
# run files from the current path
$PATH="$PATH:./"
# add to .bashrc
export PATH=PATH:./
# matar todos os processos
killall
#reset plasma
killall plasma; plasma
http://techbase.kde.org/index.php?title=Projects/Plasma/FAQ#My_panel_is_gone.2C_how_do_I_get_it_back.3F
# logoff another user
who -u
kill ps#
# se conexão parar
sudo dhclient
# comandos de rede
tracepath
# retirar o default duplicado
sudo route del default
# sequencia para restaurar conexão
sudo dhclient -r
#sudo dhclient
#sudo route del default [repetir se necessario]
sudo route add default netmask 255.255.255.0 gw 192.168.0.1 dev eth0
#sudo route add -net default netmask 255.255.255.0 gw 192.168.0.1 dev eth0
#dns configuration
http://www.ubuntugeek.com/ubuntu-networking-configuration-using-command-line.html
#reiniciar a rede
sudo /etc/init.d/networking restart
# montar .iso
sudo mount -o loop -t iso9660 file.iso /media/iso
sudo dd if=/dev/scd0 of=/path/to/file.iso
# versão do linux
uname -a
# sensors, temperature
// to install
sudo sensors-detect
// to start the drivers: modprobe (i2c-i801, lm85, coretemp)
// to run
sensors
# removendo kernel antigo
dpkg -l | grep linux-image # lista todos
sudo apt-get --purge remove linux-image-<ver>-generic
sudo apt-get autoremove
# instalando rewrite module no apache
sudo a2enmod rewrite
sudo /etc/init.d/apache2 force-reload
/* Basically, to get mod_rewrite to work, load the module by symlinking to mods-available/rewrite.conf in mods-enabled, then set AllowOverride to “all” in sites-available/default in both the root (”/”) container and the /var/www/ container. Whilst you’re there, it may be a good idea to get rid of the RedirectMatch, simply because it’s annoying… I haven’t, but only because I haven’t bothered to put something in the root of the default site. */
# kubuntu version
lsb_release -a
# copiando com as permissões
cp -a
# exportar lista de progs instalados
sudo dpkg --get-selections | grep '[[:space:]]install$' | awk '{print $1}' > package_list
#importar lista de progs instalados
cat package_list | xargs sudo apt-get install -y
#instalando flash
sudo apt-get install flashplugin-nonfree
# firedog?
sudo lshw -vv
#instalando LAMP
sudo apt-get install apache2 mysql-server-5.0 php5 php5-mysql phpmyadmin
#montando disco da rede
mount -t cifs //COMPUTER_NAME/Share_name /remote -o username=username
http://www.ubuntugeek.com/nfs-server-and-client-configuration-in-ubuntu.html
#montando ssh
sshfs feijo@espelho.mmda.com.br:/var/www/plugger /mnt/mmda/
# ** GRUB **
# to update grub
update-grub
dpkg -l [string] # list packages
# ** PHPMYADMIN **
no kubuntu, ver /etc/phpmyadmin
# reset sound
sudo alsa force-reload
# samba
http://www.guiadohardware.net/artigos/servidor-rede-local/
sudo nano /etc/samba/smb.conf
# sync clock
http://www.ubuntugeek.com/keeping-your-system-clock-current-automatically-via-network-time-protocol-ntp.html
sudo apt-get install ntpdate
/etc/network/if-up.d/ntpdate
# nslookup, trace, ping
dig d.com +short
dig d.com +trace
# delete files in subdirs
find sites/default/files/legendas -name *.srt|xargs rm -rf
#delete old files
find -atime +30 -delete
# find big files (size)
find . -type f -size +20000k -exec ls -lh {} \; | awk '{ print $NF ": " $5 }'
find . -size +20000k -exec du -h {} \;
# count files
ls -1 | wc -l
# rename extensions
for f in *.FOO; do ext=${f##*.}; mv "$f" "${f%.*}.${ext,,}"; done
# gzip test
http://nontroppo.org/tools/gziptest/
# compact apache pages
apt-get install php5-memcache php-apc php5-cgi php5-fpm
# php-fpm
// melhorias no nano
sudo nano /usr/share/nano/php.nanorc
syntax "php" "\.php[2345s~]|.inc|.module|.info|.install?$"
## debug
color white,red "\<(dsm|print_r|var_dump)\>"
## strings
color brightyellow "<[^= ]*>" ""(\.|[^"])*""
## variables
color brightgreen "\$\{?[a-zA-Z_0-9]+\}?"
## strings
color brightyellow ""(\\.|[^\"])*"" "'(\\.|[^'])*'"
# copiar partições
<iceroot> sudo dd if=/dev/sdX of=/dev/sdX
<iceroot> afeijo: maybe you have to edit the uuid in /etc/fstab on the new drive. you can get the new uuid with "sudo blkid /dev/sdb"
<iceroot> afeijo: but this should fix it "sudo dd if=/dev/sdb of=/dev/sda1 bs=512 count=1" when sda is the new drive. then you have the partion-layout + mbr there
#install pecl uploadprogress
http://ubuntuforums.org/showthread.php?t=1163903
# prompt
PS1="[\t] \u@\h \w> "
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;36m\]\u@\h\[\033[00m\] \[\033[01;34m\]\w$(__git_ps1)\[\033[00m\]\$ '
#ssl no nginx
http://nginx.groups.wuyasea.com/articles/how-to-setup-godaddy-ssl-certificate-on-nginx/2
#novo usuario
adduser -m username
passwd username
#install mariadb
http://kb.askmonty.org/en/installing-mariadb-deb-files (apt key)
http://downloads.askmonty.org/mariadb/repositories
#install nginx+mysql+php
www.howtoforge.com/installing-php-5.3-nginx-and-php-fpm-on-ubuntu-debian
#gerar arquivo grande para testes
dd if=/dev/zero of=test.bin bs=1M count=50
dd if=/dev/urandom of=test.bin bs=1M count=50
# change swap usage, http://unix.stackexchange.com/questions/2658/why-use-swap-when-there-is-more-than-enough-ram
sudo sysctl vm.swappiness=10
# delayed reboot
sudo shutdown -P 03:00 &
#gerenciar zonas de dominios
nano /etc/bind/named.conf.local
nano /var/lib/bind/*
sudo rndc reload dominio.com
sudo rndc reload
#pra testar
named-checkzone outer-core.com outer-core.com.hosts
http://www.dnssy.com/report.php?q=outer-core.org
# verificar registros MX
dig -t mx dominio.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment