UbuntuTips

From Linusphere
Jump to: navigation, search

Packages

  • /var/log/apt/history.log - to see when you update the packages last time & which packages are updated.
  • Use 'deb mirror://mirrors.ubuntu.com/mirrors.txt precise' instead of downloading packages from mirror site
  • /etc/apt/sources.d/ - extra repository info

Backup

  • Setup the permission
#!/bin/bash
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
  • Rsync
#!/bin/bash
TARGET_DIR="my dir"
REMOTE_DIR="/work/project/"$TARGET_DIR
LOCAL_DIR="/work/project/"$TARGET_DIR

REMOTE_HOST="id@host"

LOG=$LOCAL_DIR"my_log_file.log"
LOG_FILELIST=${LOG/.log/}".lst"
LOG_BIGFILE=${LOG/.log/}".lst_10G"
echo $LOG

echo >> $LOG
date >> $LOG
echo "remote_host:"$REMOTE_HOST $REMOTE_DIR >> $LOG
#rsync -e ssh -avz --prune-empty-dirs --no-perms --omit-dir-times --include="*/*zip" --include="*/*gz" --exclude="*/*" $REMOTE_HOST:$REMOTE_DIR $LOCAL_DIR | tee -a $LOG

rsync -e ssh -avz --prune-empty-dirs --no-perms --omit-dir-times $REMOTE_HOST:$REMOTE_DIR $LOCAL_DIR | tee -a $LOG

ls -sSRh -1 $LOCAL_DIR > $LOG_FILELIST
find $LOCAL_DIR -size +10G -exec ls -hs {} \; > $LOG_BIGFILE


Make clean/new/update repos

$ sudo apt-get clean
$ sudo mv /var/lib/apt/lists/ /tmp/
$ sudo apt-get clean
$ sudo apt-get update

UUID mounting

$ sudo blkid

Multiple ports for SSH

Time setting

https://help.ubuntu.com/lts/serverguide/NTP.html

$ ntpdate -s ntp.ubuntu.com
$ sudo apt-get install ntp
$ sudo service ntp reload
$ sudo ntpq -p

Dropbox

/etc/apt/sources.list: deb http://linux.dropbox.com/ubuntu natty main
$ sudo apt-key adv --keyserver pgp.mit.edu --recv-keys 5044912E

DNS setting

  • /etc/resolveconf/resolv.conf.d/base
nameserver  8.8.8.8
nameserver  4.4.4.4

Then

$ sudo resolvconf -u
  • Alternatively, you can add the following line at /etc/network/interfaces (but don't use these two methods together). Also this method requires rebooting the system (or at least, ifdown eth0; ifup eth0).
iface eth0 inet static
   [...]
   dns-nameservers 8.8.8.8 4.4.4.4

RSEM

  • install libboost-random-dev and libboost1.54-dev