Mittwoch, 24. Juni 2015

Bash function to make an permanet Alias

If you regularly type the same lengthy command into the console, you could make your life easier by using aliases. And even easier if you have a bash function to do that:

e.g you regularly type:

ls -la

you can turn it into an alias just by typing
ali #nameOfAlias #command
ali l ls -la

Which is more convenient than the regular alias. To get the ali function modify your .bashrc file in your home directory (if it doesn't exist on linux mint just create it and it will be used automatically)

function ali() {
 echo "alias $1='${@:2}'" >> ~/.bashrc 
 #in ubuntu use ~/.bash_aliases
 echo "made alias:";
 echo "alias $1='${@:2}'";
 source ~/.bashrc;  #reload bashrc
}

this appends the new alias to .bashrc and it will be available immediately and permanently.




Freitag, 12. Juni 2015

Tackling the Acer Aspire TimelineX overheating problem




The Acer Aspire TimelineX model has two switchable graphic cards. Those laptops have a hidden BIOS menu to configure which card to use, but there are other useful settings as well. How to unlock the menu is described here: http://ubuntuforums.org/showthread.php?t=1787312

Cleaning the laptop did not solve the overheating problem. But changing the BIOS parameters did. So here is my BIOS configuration (as usual, be careful with BIOS settings):











Copying folders so that only the files change that are different (Syncing)

I had 9 GB folder, the Android Sdk, and a copy of it on my USB stick. Then I made changes to the folder by installing new target platforms. Instead of copying the whole folder again on my USB stick a faster way was to use rsync.

rsync -r sourceFolder destinationFolder


This copies only the files that were new or changed.


Linux repeat console command

Repeat inxi -s every second to show the temperature which automatically gets updated

watch --interval 1 --color inxi -s





Linux: getting the system configuration (inxi)

A nice command to list the system information

inxi -F



Mittwoch, 10. Juni 2015

Backups: cloning whole disks (easier and faster than dd)

Important: do not clone disks that are actively used (e.g. your system disk) because the contents on the disk might change while you copy them and the clone could end up corrupted. Therefore:

  • Start a Linux Live System (maybe from an USB Stick)
  • Check the disk names and sizes* carefully (e.g. with the program disk)
  • Start cloning

For cloning many people advise to use "dd", but if you do not use the right block size it is slow. A faster and easier option is to use

cat /dev/sdX > /dev/sdY

wich copies all bits from the device sdX to the device sdY, just like dd. You probabliy need to use sudo:

sudo sh -c 'cat /dev/sdX > /dev/sdY'

Get the progress in bytes like this: grep the pid of cat and then see where the output file descriptor is
top | grep cat
cat /proc/yourCatPid/fdinfo/1


* If the target device is bigger than the source device then you can use gparted to resize the partitions on the new disk after the cloning is finished.


Linux: Error deleting partition

If you want to delete a partition and get this:



then do this (in my case it was /dev/sdc where I deleted partition 1 and 2, d is for "delete" and w is for "write changes"):