linux

Not enough disk space to update linux

I sometimes get an error from the package manager when trying to update my system. The error reports that I don't have enough disk space. I'm running Xubuntu 14.04. Here's the solution I found.

Tags linux kernel update

Linux terminal: Available space on harddrive

df -h

Example output

Tags linux terminal

Linux terminal: Create hierarchy of folders

mkdir -p files/{css,js/{custom,external},fonts}

The above command will create a file structure as shown below. Cool if you need to create the same folder structure over and over - or dynamically. The -p stands for parent and the flag is defined as no error if existing, make parent directories as needed in the man pages.

└── files
    ├── css
    ├── fonts
    └── js
        ├── custom
        └── external
Tags mkdir linux terminal

Resize a windows without hazzle

Alt + right-click + drag

Simple as that. Hold the alt key, right click anywhere in the windows and drag to resize.

Doens't work for windows that are maximized.

Tags xubuntu linux xfce

Check if package is installed on Ubuntu

$ sudo apt-cache policy <package name>

Example:

$ sudo apt-cache policy drush
drush:
  Installed: 5.8-1
  Candidate: 5.8-1
  Version table:
 *** 5.8-1 0
        500 http://dk.archive.ubuntu.com/ubuntu/ raring/universe amd64 Packages
        100 /var/lib/dpkg/status
Tags ubuntu linux terminal package

Search recursive in files from terminal

grep -r "word or phrase" ./

To show only filenames add -l flag:

grep -lr "word or phrase" ./
Tags terminal linux grep search

Check if package is installed on CentOS

rpm -q <packagename>

Example

rpm -q iptables
Tags centos terminal linux

Screenshot via terminal command

$ xwd > name.dmp

Run in terminal and click a window. A screenshot of the window will be saved to name.dmp

Tags terminal linux screenshot

What should I back up?

I don't stick with an OS installation for very long. I can't seem to find one that I like and settle with it. I'm sure that the grass is greener on the other side - that another OS is better than the one I'm using. This post is about linux, so if you use Windows you might not get all of it.

Tags backup reinstall linux

Determine system architecture on linux

Sometimes when you need to download and install software you need to choose between 32-bit and 64-bit. I can never remember what my system is, so I use this method to find out.
 
Execute the following command in a terminal
pg /proc/cpuinfo | grep "model name"
This will output the model name of your processor. For me it output "Intel(R) Core(TM)2 Duo CPU     P7570  @ 2.26GHz".

Tags how-to linux