ubuntu
remove windows line breaks
# install dos2unix$ sudo apt-get install -y dos2unix# use dos2unix$ dos2unix original.csv
mount and umount a iso file
# create the directory where the iso file will be mountedsudo mkdir /media/iso# mount the filesudo mount -o loop YOUR_FILE.ISO /media/iso# umount the filesudo umount /media/iso
replace servers on sources.list
sudo sed -i 's/us.archive.ubuntu.com/br.archive.ubuntu.com/g' /etc/apt/sources.list
reference: http://askubuntu.com/a/20416
split a file in small pieces
split --verbose --bytes=<size> -d <file> <prefix>
onde:
--bytes=<size>
is the maximum size of each piece, in bytes, or an interger folloed byK
,M
,G
,T
,P
,E
,Z
,Y
-d
adds a numeric suffix in the end of the file name<prefix>
the name of every piece
an example: an iso file can be sliced in several 1Gb files:
$ split --verbose --bytes=1G -d imagefile.iso imgcreating file "img00"creating file "img01"creating file "img02"creating file "img03"creating file "img04"
To join these files back together, use
cat img00 img01 img02 img03 img04 > imagem.iso
identify a new network card
in my case, an Realtek RTL8029AS from parallels desktop.
lsmod |grep nemodprobe -v nemodprobe -v ne2k-pci
the drive was not listed. so, i need to check if the network card was found.
lspci -v | grep -A12 "Ethernet"
the nic was here, but no ip was set up. so, i removed the contents of 70-persistent-net.rules
file, and restarted the server.
echo "" > /etc/udev/rules.d/70-persistent-net.rulesshutdown -r now
fix setting locale failed
error
locale-gen pt_BR.UTF-8locale-gen en_US.UTF-8dpkg-reconfigure locales
creating a swap file
# create a 4Gb swap filesudo fallocate -l 4G /swapfile# set permissionssudo chmod 600 /swapfile# format the filesudo mkswap /swapfile# enable swap on this filesudo swapon /swapfile# set some options on ubuntu, to better swap usesudo sysctl vm.swappiness=10sudo sysctl vm.vfs_cache_pressure=50
to made this changes permanent, add this to /etc/fstab
/swapfile none swap sw 0 0
and add this to /etc/sysctl.conf
vm.swappiness = 10vm.vfs_cache_pressure = 50
removing the canonical landscape service
sudo apt-get remove --purge landscape-client landscape-client-ui landscape-client-ui-install landscape-common
reference: How do I remove a computer from Landscape?
install vmware tools
sudo apt-get install --no-install-recommends open-vm-dkmssudo apt-get install open-vm-tools
redefining the apt-cacher's cache
# stop the servicesudo /etc/init.d/apt-cacher-ng stop# move the old cache to a new place. This way, we can remove it# in background (depending on the size, deletion may take a while)sudo mv /var/cache/apt-cacher-ng /var/cache/apt-cacher-ng.oldsudo rm -rf /var/cache/apt-cacher-ng.old &# create the new cache hierarchy, and set the correct ownersudo mkdir -p /var/cache/apt-cacher-ng/{headers,import,packages,private,temp}sudo chown -R apt-cacher-ng:apt-cacher-ng /var/cache/apt-cacher-ng# start the service againsudo /etc/init.d/apt-cacher-ng start