Clear /boot from un-used packages
:~$ dpkg -l linux-* | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e [0-9] | xargs sudo apt-get -y purge
Very good to use when /boot is full and you can’t upgrade any more. Works flawlessly on Ubuntu Server.
Search for files larger than (200000k)
:~$ sudo find / -type f -size +200000k -exec ls -lh {} \; | less
Search for specific packages
If you for some reason installed the -dev packages on your system and want to purge all of them, then you first have to find what packages are installed. Use this command:
:~$ aptitude -F '%I %p' search '~i -dev$'
Uninstall packages from your system
:~$ apt-get purge [package-name]
Removes the specific package
:~$ apt-get autoremove
Removes all unused packages
To become root
Write this after you have logged in in the terminal:
:~$ sudo -i
List files in a folder:
:~$ ls -l
Reboot system or power-off completely:
:~$ sudo reboot
:~$ sudo poweroff
Set www-data rights to a folder:
:~$ chown -R www-data:www-data /path/to/folder/
To upgrade your system, write this in terminal:
:~$ sudo apt-get update
:~$ sudo apt-get upgrade
To update the whole system, write this in terminal:
:~$ sudo aptitude full-upgrade
After this a reboot is needed!
:~$ sudo reboot
Create a matrix effect in your terminal
Source: http://www.climagic.org/coolstuff/matrix-effect.html
:~$ echo -e "\e[1;40m" ; clear ; while :; do echo $LINES $COLUMNS $(( $RANDOM % $COLUMNS)) $( printf "\U$(( $RANDOM % 500 ))" ) ;sleep 0.05; done|gawk '{c=$4; letter=$4;a[$3]=0;for (x in a) {o=a[x];a[x]=a[x]+1; printf "\033[%s;%sH\033[2;32m%s",o,x,letter; printf "\033[%s;%sH\033[1;37m%s\033[0;0H",a[x],x,letter;if (a[x] >= $1) { a[x]=0; } }}'
Real time PING
:~$ mtr <IP-ADRESS>
Make the terminal speak
:~$ espeak "Tech & Me is great!"
Hit enter on all options in bash scripts, useful when you are scripting
:~$ yes " " | [command]