Public
snipts » ubuntu
showing 1-20 of 40 snipts for ubuntu
-
∞ force umount
force umount -f Force the unmount. This option requires kernel 2.1.116 or later. -l Lazy unmount. Detach the filesystem from the hierarchy immediately, but don't clean up references until it is no longer busy. Requires kernel 2.4.11 or later. e.g. umount -lf /mnt -
∞ Actualizar Ubuntu sin riesgos
; 1. Como root, hacer un backup del / sudo su - cd / tar -cvf /tmp/mi-dir-raiz.tar --exclude=mnt/* --exclude=dev/* --exclude=proc/* --exclude=tmp/* * ; 2. Te guardas /tmp/mi-dir-raiz.tar en un disco externo. ; 3. Actualizas, y si no te gusta el resultado arrancas desde un live-cd, montas la particion / en /mnt, borras todo el contenido de la actualizacion y restauras ahí tu tar. mount /dev/sdaX /mnt cd /mnt rm -rf * tar -xvf /midiscoexterno/mi-dir-raiz.tar ; 4. Ya solo te queda instalar el grub y reiniciar grub-install --root-directory=/mnt reboot
-
∞ Convert file encoding
iconv -f encoding [-t encoding] [inputfile]... useful options: --from-code, -f encoding Convert characters from encoding. --to-code, -t encoding Convert characters to encoding. If not specified the encoding corresponding to the current locale is used. --list, -l List known coded character sets. -c Omit invalid characters from output. --output, -o file Specify output file (instead of stdout). --silent, -s Suppress warnings, but not errors. --verbose Print progress information. example: convert a utf8 encoding file to a gbk encoding file iconv -f utf8 -t gbk red.txt -o newRed.txt
-
∞ Sound problems in Ubuntu
sudo /etc/init.d/alsa-utils reset /sbin/alsa force-reload
-
∞ update fonts in ubuntu
sudo fc-cache -f -v -
∞ Play music on a remote linux (debian branch) computer via SSH
#I used this technique to play music on a computer with a much better sound system from my laptop. #On the "music server" sudo apt-get install openssh-server mplayer #Once done, on the "controler" computer ssh <username>@<server_name_or_ip> cd /path/to/music/files #If you want to play only one song mplayer song.ext #If you want to play the whole directory mplayer *.ext #In case of multiple extentions (example with mp3, wma and ogg files mplayer *.mp3 *.wma *.ogg #You can control your music server from a windows comuputer with PuTTY
-
∞ uninstall apparmor
/etc/init.d/apparmor stop update-rc.d -f apparmor remove apt-get --yes remove apparmor apparmor-utils
-
∞ Fix non sleep aware modules
# echo 'SUSPEND_MODULES="$SUSPEND_MODULES edimax-driver-name-here' > /etc/pm/config.d/edimax-fix -
∞ netstat get an indication of how many requests your web application currently has
If you want to get an indication of how many requests your web application (e.g. JIRA, Confluence) currently has, and it is running on Unix, run the following command: netstat -a -n | grep :<port number> | grep tcp | grep ESTABLISHED | wc -l For example, if the application server has JIRA (or Confluence) running on port 8080: netstat -a -n | grep :8080 | grep tcp | grep ESTABLISHED | wc -l This will return the number of established TCP/IP connections to that port.
-
∞ rename dirs in gnome
#!/bin/bash # Criado em:Qua 07/Out/2009 hs 10:47 # Last Change: Qua 07 Out 2009 11:49:36 BRT # vim:ft=sh:fdm=syntax:nu: # Instituicao: none # Proposito do script: consertar nome das pastas no ubuntu # Autor: Sérgio Luiz Araújo Silva # site: http://vivaotux.blogspot.com # função será executada se o for usuário comum pessoal (){ FILE=~/.config/user-dirs.dirs # backup echo "criando backup de $FILE" sleep 1 cp $FILE{,.backup} cat <<-EOF > $FILE # This file is written by xdg-user-dirs-update # If you want to change or add directories, just edit the line you're # interested in. All local changes will be retained on the next run # Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped # homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an # absolute path. No other format is supported. XDG_DESKTOP_DIR="$HOME/Desktop" XDG_DOWNLOAD_DIR="$HOME/docs/downloads" XDG_TEMPLATES_DIR="$HOME/docs/modelos" XDG_PUBLICSHARE_DIR="$HOME/docs/share" XDG_DOCUMENTS_DIR="$HOME/docs" XDG_MUSIC_DIR="$HOME/docs/musicas" XDG_PICTURES_DIR="$HOME/img" XDG_VIDEOS_DIR="$HOME/docs/videos" EOF } # função "geral" será executada se for root geral () { FILE=/etc/xdg/user-dirs.defaults # backup cp $FILE{,.backup} echo "criando backup de $FILE" sleep 1 cat <<-EOF > $FILE # Default settings for user directories # # The values are relative pathnames from the home directory and # will be translated on a per-path-element basis into the users locale DESKTOP=Desktop DOWNLOAD=docs/downloads TEMPLATES=docs/modelos PUBLICSHARE=docs/publico DOCUMENTS=docs MUSIC=docs/musica PICTURES=docs/img VIDEOS=docs/videos # Another alternative is: #MUSIC=Documents/Music #PICTURES=Documents/Pictures #VIDEOS=Documents/Videos EOF } [ "$(id -u)" != "0" ] && pessoal || geral
-
∞ Install denyhosts in ubuntu
Install denyhosts in ubuntu apt-get install denyhosts vi /etc/denyhosts.conf, add following lines: SECURE_LOG = /var/log/auth.log HOSTS_DENY = /etc/hosts.deny PURGE_DENY = 1w BLOCK_SERVICE = sshd DENY_THRESHOLD_INVALID = 5 DENY_THRESHOLD_VALID = 10 DENY_THRESHOLD_ROOT = 1 DENY_THRESHOLD_RESTRICTED = 1 WORK_DIR = /var/lib/denyhosts SUSPICIOUS_LOGIN_REPORT_ALLOWED_HOSTS=YES HOSTNAME_LOOKUP=NO LOCK_FILE = /var/run/denyhosts.pid ADMIN_EMAIL = root@localhost SMTP_HOST = localhost SMTP_PORT = 25 SMTP_FROM = DenyHosts <nobody@localhost> SMTP_SUBJECT = DenyHosts Report AGE_RESET_VALID=5d AGE_RESET_ROOT=25d AGE_RESET_RESTRICTED=25d AGE_RESET_INVALID=10d DAEMON_LOG = /var/log/denyhosts DAEMON_SLEEP = 30s DAEMON_PURGE = 1h
-
∞ elinks shortcuts
F10: Menu Open new tab: t Go to URL: g Go back: left Go forward: u Exit: q Search: / Find next: n Find previous: N Toggle html/plain: \ Toggle images: * Wrap text on/off: W Reload document: Ctrl-R Next tab: > Prev tab: < Close tab: c Open in new tab in background: T Download link: d -
∞ Turn off the system speaker
rmmod pcspkr
-
∞ Handle system services from the command line
# Stop a service sudo invoke-rc.d <SERVICE> stop # Start a service sudo invoke-rc.d <SERVICE> start # Remove a service from system start-up sudo update-rc.d -f <SERVICE> remove # Add a service to system start-up specifying its priority # eg.: sudo update-rc.d apparmor start 37 S . sudo update-rc.d <SERVICE> start <NUMBER> <WHEN> .
-
∞ X,gnome start/stop
/etc/init.d/gdm stop /etc/init.d/gdm start
-
∞ how to install php apc package on Ubuntu
# On Ubuntu $ apt-get install php5-dev apache-prefork-dev $ pecl install apc $ echo "extension=apc.so" > /etc/php5/conf.d/apc.ini $ apachectl restart
-
∞ set apt-cacher proxy and temporarily disable it
In this example an apt-cacher proxy is running on the server at 192.168.0.2. ---- /etc/apt/apt.conf.d/01proxy: Acquire::http::Proxy "http://192.168.0.2:3142/apt-cacher/"; Bypassing the proxy temporarily: # apt-get install -o Acquire::http::Proxy=none ack-grep
-
∞ Importing Ubuntu Update Repository Public Keys
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys <KeyID> # Get <KeyID> from "sudo apt-get update" sudo apt-get update -
∞ Booting Existing Windows with VirtualBox on Ubuntu
# Run MergeIDE on windows before beginning. [ http://www.virtualbox.org/attachment/wiki/Migrate_Windows/MergeIDE.zip ] # Set correct permissions for the user to read raw disk sudo usermod -aG disk $USER # Create Fake MBR install-mbr --force ~/.VirtualBox/WinXP.mbr # Create and Register the VMDK out of RAW Disk VBoxManage internalcommands createrawvmdk -filename ~/.VirtualBox/WinXP.vmdk -rawdisk /dev/sda -partitions 1 -mbr ~/.VirtualBox/WinXP.mbr -register # Edit the VMDK file so that following parameters correspond to fdisk -l /dev/sda ddb.geometry.biosCylinders="1023" ddb.geometry.biosHeads="240" ddb.geometry.biosSectors="63" # Create new Virtual Machine and enable ACPI, IO APIC, VT-x/AMD-v
-
∞ install apache with php on ubuntu
#!/bin/bash # Install apache sudo aptitude install apache2 # Enable URL rewrite module sudo a2enmod rewrite # Enable user directory module sudo a2enmod userdir mkdir -p $HOME/public_html cp /var/www/index.html # Install PHP sudo aptitude install php5 libapache2-mod-php5 echo '<?php phpinfo(); ?>' | sudo tee /var/www/info.php # Restart Apache and test it sudo service apache2 restart firefox http://localhost/info.php # Install PHP extensions (optional) sudo aptitude install php-pear php5-gd php5-tidy smarty # Install MySQL support (optional) sudo aptitude install php5-mysql mysql-server mysql-client mysql-query-browser # Install PostgreSQL support (optional) sudo aptitude install php5-pgsql postgresql pgadmin3 # Restart Apache service sudo service apache2 restart # Install Rapache frontend (optional) sudo aptitude install rapache



Beginning Ubuntu Linux